我正在尝试从 WSO2 Carbon 3.0.0 升级到 Carbon 4.0.3。使用 Carbon 3.0.0,在安装了必要的特性之后,我可以编写可以调用外部 Java 库的 JavaScript Mashup 服务——而且由于 WSO2 carbon 使用 Rhino,我可以使用 importPackage。我无法在 Carbon 4.0.3 上获得相同的功能。
我遵循的程序是:
- 下载并解压 WSO2 Carbon 4.0.3
- 启动碳
- 导航到“功能管理”页面
- 添加 4.0.3 Carbon p2 存储库 ( http://dist.wso2.org/p2/carbon/releases/4.0.3/ )
- 搜索并安装“应用服务器”功能
- 重启碳
- 部署我的测试 Mashup 服务
- 使用“tryit”工具执行我的测试 Mashup 服务的 echo 操作。
我的测试混搭服务(TestMashup.js):
this.serviceName = "TestMashup";
echo.inputTypes = "#raw";
echo.outputType = "#raw";
function echo(parameter) {
var javaDate = new Packages.java.util.Date();
var response = "<echo><value>" + parameter.toXMLString() + "</value><timestamp>" + javaDate.getTime() + "</timestamp></echo>";
return new XML(response);
}
我已将此 Mashup 服务安装到 CARBON_HOME/repository/deployment/server/jsservices/admin/
当我在 Carbon 3.0.0 上运行此操作时,我得到以下响应:
<echo>
<value>
<r>test</r>
</value>
<timestamp>1360699125311</timestamp>
</echo>
当我尝试在 Carbon 4.0.3 上运行此操作时,我得到以下堆栈跟踪:
[2013-02-12 14:46:32,511] ERROR {org.jaggeryjs.scriptengine.engine.RhinoEngine} - org.mozilla.javascript.EcmaError: ReferenceError: "Packages" is not defined.(//C:\WSO2CA~1\WSO2CA~1.3\bin\..\repository\deployment\server\jsservices\admin\TestMashup.js#6)
[2013-02-12 14:46:32,512] ERROR {org.jaggeryjs.scriptengine.engine.RhinoEngine} - org.jaggeryjs.scriptengine.exceptions.ScriptException: org.mozilla.javascript.EcmaError: ReferenceError: "Packages" is not defined. (//C:\WSO2CA~1\WSO2CA~1.3\bin\..\repository\deployment\server\jsservices\admin\TestMashup.js#6)
[2013-02-12 14:46:32,512] ERROR {org.apache.axis2.receivers.AbstractMessageReceiver} - org.jaggeryjs.scriptengine.exceptions.ScriptException: org.mozilla.javascript.EcmaError: ReferenceError: "Packages" is not defined. (//C:\WSO2CA~1\WSO2CA~1.3\bin\..\repository\deployment\server\jsservices\admin\TestMashup.js#6)
org.apache.axis2.AxisFault: org.jaggeryjs.scriptengine.exceptions.ScriptException: org.mozilla.javascript.EcmaError: ReferenceError: "Packages" is not defined.(//C:\WSO2CA~1\WSO2CA~1.3\bin\..\repository\deployment\server\jsservices\admin\TestMashup.js#6)
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
at org.wso2.carbon.mashup.javascript.messagereceiver.JavaScriptEngine.call(JavaScriptEngine.java:176)
at org.wso2.carbon.mashup.javascript.messagereceiver.JavaScriptEngine.call(JavaScriptEngine.java:208)
at org.wso2.carbon.mashup.javascript.messagereceiver.JavaScriptReceiver.invokeBusinessLogic(JavaScriptReceiver.java:185)
at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)
at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:110)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:181)
at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:172)
at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:146)
at org.wso2.carbon.core.transports.CarbonServlet.doPost(CarbonServlet.java:231)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.eclipse.equinox.http.helper.FilterServletAdaptor$FilterChainImpl.doFilter(FilterServletAdaptor.java:56)
at org.wso2.carbon.mashup.jsservices.custom.ui.CustomUIServletFilter.doFilter(CustomUIServletFilter.java:233)
at org.eclipse.equinox.http.helper.FilterServletAdaptor.service(FilterServletAdaptor.java:37)
at org.eclipse.equinox.http.servlet.internal.ServletRegistration.handleRequest(ServletRegistration.java:90)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:111)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:67)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.wso2.carbon.tomcat.ext.servlet.DelegationServlet.service(DelegationServlet.java:68)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.wso2.carbon.tomcat.ext.filter.CharacterSetFilter.doFilter(CharacterSetFilter.java:61)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.wso2.carbon.tomcat.ext.valves.CompositeValve.invoke(CompositeValve.java:172)
at org.wso2.carbon.tomcat.ext.valves.CarbonStuckThreadDetectionValve.invoke(CarbonStuckThreadDetectionValve.java:156)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
at org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve.invoke(CarbonContextCreatorValve.java:52)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1001)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1653)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: org.jaggeryjs.scriptengine.exceptions.ScriptException: org.jaggeryjs.scriptengine.exceptions.ScriptException: org.mozilla.javascript.EcmaError: ReferenceError: "Packages" is not defined. (//C:\WSO2CA~1\WSO2CA~1.3\bin\..\repository\deployment\server\jsservices\admin\TestMashup.js#6)
at org.jaggeryjs.scriptengine.engine.RhinoEngine.execFunc(RhinoEngine.java:383)
at org.jaggeryjs.scriptengine.engine.RhinoEngine.call(RhinoEngine.java:251)
at org.wso2.carbon.mashup.javascript.messagereceiver.JavaScriptEngine.call(JavaScriptEngine.java:169)
... 40 more
Caused by: org.jaggeryjs.scriptengine.exceptions.ScriptException: org.mozilla.javascript.EcmaError: ReferenceError: "Packages" is not defined. (//C:\WSO2CA~1\WSO2CA~1.3\bin\..\repository\deployment\server\jsservices\admin\TestMashup.js#6)
at org.jaggeryjs.scriptengine.engine.RhinoEngine.execFunc(RhinoEngine.java:401)
at org.jaggeryjs.scriptengine.engine.RhinoEngine.execFunc(RhinoEngine.java:380)
... 42 more
Caused by: org.mozilla.javascript.EcmaError: ReferenceError: "Packages" is not defined. (//C:\WSO2CA~1\WSO2CA~1.3\bin\..\repository\deployment\server\jsservices\admin\TestMashup.js#6)
at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3557)
at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3535)
at org.mozilla.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:3620)
at org.mozilla.javascript.ScriptRuntime.name(ScriptRuntime.java:1652)
at org.jaggeryjs.rhino.c0._c1(//C:\WSO2CA~1\WSO2CA~1.3\bin\..\repository\deployment\server\jsservices\admin\TestMashup.js:6)
at org.jaggeryjs.rhino.c0.call(//C:\WSO2CA~1\WSO2CA~1.3\bin\..\repository\deployment\server\jsservices\admin\TestMashup.js)
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:401)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3003)
at org.jaggeryjs.rhino.c0.call(//C:\WSO2CA~1\WSO2CA~1.3\bin\..\repository\deployment\server\jsservices\admin\TestMashup.js)
at org.jaggeryjs.scriptengine.engine.RhinoEngine.execFunc(RhinoEngine.java:398)
... 43 more
如何解决此问题,以便我可以继续使用我的 JavaScript Mashup 服务中的 Java 库?