2

我正在使用 IBM MobileFirst Platform Studio(v6.3 - 前 IBM Worklight)开发混合应用程序。

由于需要调用包含 OUT 参数的 Oracle 存储的 PL/SQL 过程,因此我使用了此处提供的解决方案How to get OUT parameter when invoking a stored procedure?- 在 java 中调用存储过程并从适配器过程调用 java 类。

我将 StoredProcedure.java src 文件添加到我项目中的 server/java 文件夹中。我还将 commons-dbutils-1.6.jar 和 ojdbc6.jar 添加到 server/lib 文件夹。StoredProcedure 类建立在保存并部署在 MobileFirst Development 服务器上。我还在 server.xml 中定义了所需的数据源,但是当我尝试测试我实现的适配器过程时(R-单击适配器运行方式 -> 部署 MobileFirstAdapter,R-单击适配器运行方式 -> 调用 MobileFirst 过程)我收到此错误信息:

[ERROR   ] FWLSE0099E: An error occurred while invoking procedure  [project MxP]StoredProcedure/pretragaVozilaFWLSE0100E:  parameters: [project MxP]
invocation of javascript function 'pretragaVozila' has failed: ResultSetHandler
FWLSE0101E: Caused by:  [project MxP]java.lang.NoClassDefFoundError: ResultSetHandlerjava.lang.RuntimeException:
    invocation of javascript function 'pretragaVozila' has failed: ResultSetHandler
    at com.worklight.integration.js.JavaScriptProcedureInvoker.invoke(JavaScriptProcedureInvoker.java:52)
    at com.worklight.integration.model.ProcedureInvoker.invokeProcedure(ProcedureInvoker.java:54)
    at com.worklight.integration.model.Procedure.invoke(Procedure.java:166)
    at com.worklight.integration.services.impl.DataAccessServiceImpl.callProcedureInternal(DataAccessServiceImpl.java:593)
    at com.worklight.integration.services.impl.DataAccessServiceImpl.callProcedure(DataAccessServiceImpl.java:539)
    at com.worklight.integration.services.impl.DataAccessServiceImpl.access$100(DataAccessServiceImpl.java:58)
    at com.worklight.integration.services.impl.DataAccessServiceImpl$3.execute(DataAccessServiceImpl.java:433)
    at com.worklight.core.auth.impl.AuthenticationServiceBean.accessResource(AuthenticationServiceBean.java:76)
    at com.worklight.integration.services.impl.DataAccessServiceImpl.invokeProcedureInternal(DataAccessServiceImpl.java:430)
    at com.worklight.integration.services.impl.DataAccessServiceImpl.invokeProcedure(DataAccessServiceImpl.java:139)
    at com.worklight.server.dev.InvokeProcedureHandler.handle(InvokeProcedureHandler.java:85)
    at com.worklight.server.dev.DevRootServlet.service(DevRootServlet.java:97)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1274)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:767)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:469)
    at com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTarget(WebAppFilterChain.java:127)
    at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:88)
    at com.worklight.core.auth.impl.AuthenticationFilter.doFilter(AuthenticationFilter.java:151)
    at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:194)
    at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:85)
    at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:968)
    at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1056)
    at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:4553)
    at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$2.handleRequest(DynamicVirtualHost.java:301)
    at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:954)
    at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$2.run(DynamicVirtualHost.java:266)
    at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink$TaskWrapper.run(HttpDispatcherLink.java:776)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NoClassDefFoundError: ResultSetHandler
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2615)
    at java.lang.Class.getDeclaredMethods(Class.java:1860)
    at org.mozilla.javascript.JavaMembers.discoverAccessibleMethods(JavaMembers.java:315)
    at org.mozilla.javascript.JavaMembers.discoverAccessibleMethods(JavaMembers.java:302)
    at org.mozilla.javascript.JavaMembers.reflect(JavaMembers.java:419)
    at org.mozilla.javascript.JavaMembers.<init>(JavaMembers.java:43)
    at org.mozilla.javascript.JavaMembers.lookupClass(JavaMembers.java:807)
    at org.mozilla.javascript.NativeJavaClass.initMembers(NativeJavaClass.java:49)
    at org.mozilla.javascript.NativeJavaObject.<init>(NativeJavaObject.java:44)
    at org.mozilla.javascript.NativeJavaClass.<init>(NativeJavaClass.java:43)
    at org.mozilla.javascript.NativeJavaClass.<init>(NativeJavaClass.java:39)
    at org.mozilla.javascript.WrapFactory.wrapJavaClass(WrapFactory.java:134)
    at org.mozilla.javascript.NativeJavaPackage.getPkgProperty(NativeJavaPackage.java:133)
    at org.mozilla.javascript.NativeJavaPackage.get(NativeJavaPackage.java:82)
    at org.mozilla.javascript.ScriptableObject.getProperty(ScriptableObject.java:2184)
    at org.mozilla.javascript.ScriptRuntime.getObjectProp(ScriptRuntime.java:1492)
    at org.mozilla.javascript.ScriptRuntime.getObjectProp(ScriptRuntime.java:1485)
    at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:1239)
    at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:815)
    at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:109)
    at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:394)
    at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3091)
    at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:107)
    at com.worklight.integration.js.JavaScriptManager.callFunction(JavaScriptManager.java:267)
    at com.worklight.integration.js.JavaScriptManager.invokeFunction(JavaScriptManager.java:241)
    at com.worklight.integration.js.JavaScriptManager.invokeFunction(JavaScriptManager.java:211)
    at com.worklight.integration.services.impl.AdapterManagerImpl.invokeFunction(AdapterManagerImpl.java:124)
    at com.worklight.integration.js.JavaScriptProcedureInvoker.invoke(JavaScriptProcedureInvoker.java:42)
... 30 more
Caused by: java.lang.ClassNotFoundException: ResultSetHandler
    at com.ibm.ws.classloading.internal.AppClassLoader.findClassCommonLibraryClassLoaders(AppClassLoader.java:436)
    at com.ibm.ws.classloading.internal.AppClassLoader.findClass(AppClassLoader.java:265)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at com.ibm.ws.classloading.internal.AppClassLoader.loadClass(AppClassLoader.java:411)
... 59 more
com.worklight.common.log.filters.ErrorFilter

我还应该怎么做才能让后端服务找到 commons-dbutils-1.6.jar ?

我正在使用 64 位 Java v1.7.0.72 的 Windows 7 64 位上运行 Eclipse 版本:Luna Service Release 1 (4.4.1),连接到 Oracle Server 11g。

4

1 回答 1

1

在 server/lib 目录中删除必要的 jar 对我不起作用。我必须复制所需的 jars (dbutils) 和为调用存储过程而创建的自定义 jar,在 Eclipse 工作区中相对于 WorklightServerConfig 的以下目录中

<workspace>/WorklightServerConfig/shared/resources

映射到 server.xml 中的以下变量

${shared.resource.dir}

然后定义 oracle 库,我在名为 oracle 的子目录中有 ojdbc6.jar

<library id="ORACLE_LIB">
    <fileset dir="${shared.resource.dir}/oracle" includes="*.jar"/>
</library>

<connectionManager id="OraclePool" maxPoolSize="40" minPoolSize="10"/>

<dataSource id="mobileDatasource" jndiName="jdbc/mobile__datasource">
    <jdbcDriver libraryRef="ORACLE_LIB"/>
    <properties.oracle URL="jdbc:oracle:thin:@..." password="..." user="..."/>
</dataSource>
于 2014-12-08T14:10:02.780 回答