xpages: java.lang.ClassNotFoundException: Cannot find class org.apache.commons.httpclient.HttpMethod in NSF

你说的曾经没有我的故事 提交于 2019-12-11 20:08:56

问题


I have written a java class that utilises org.apache.commons.httpclient.

Initially i imported the java files into my nsf along with codec dependencies; the application worked fine. I then found that these were available in the eclipse plugins directory; so i then added them as a dependency in the plugin.xml

Now when i try to run the application i get an error 500 and the following is recorded in the xpages_exc tech support file:

22/06/12 14:33: Exception Thrown
javax.servlet.ServletException: java.lang.NoClassDefFoundError: org.apache.commons.httpclient.HttpMethod
    at com.ibm.xsp.webapp.FacesServlet.handleError(FacesServlet.java:619)
    at com.ibm.xsp.webapp.FacesServlet.renderErrorPage(FacesServlet.java:453)
    at com.ibm.xsp.webapp.FacesServlet.service(FacesServlet.java:183)
    at com.ibm.xsp.webapp.FacesServletEx.service(FacesServletEx.java:137)
    at com.ibm.xsp.webapp.DesignerFacesServlet.service(DesignerFacesServlet.java:103)
    at com.ibm.designer.runtime.domino.adapter.ComponentModule.invokeServlet(ComponentModule.java:576)
    at com.ibm.domino.xsp.module.nsf.NSFComponentModule.invokeServlet(NSFComponentModule.java:1267)
    at com.ibm.designer.runtime.domino.adapter.ComponentModule$AdapterInvoker.invokeServlet(ComponentModule.java:847)
    at com.ibm.designer.runtime.domino.adapter.ComponentModule$ServletInvoker.doService(ComponentModule.java:796)
    at com.ibm.designer.runtime.domino.adapter.ComponentModule.doService(ComponentModule.java:565)
    at com.ibm.domino.xsp.module.nsf.NSFComponentModule.doService(NSFComponentModule.java:1251)
    at com.ibm.domino.xsp.module.nsf.NSFService.doServiceInternal(NSFService.java:598)
    at com.ibm.domino.xsp.module.nsf.NSFService.doService(NSFService.java:421)
    at com.ibm.designer.runtime.domino.adapter.LCDEnvironment.doService(LCDEnvironment.java:341)
    at com.ibm.designer.runtime.domino.adapter.LCDEnvironment.service(LCDEnvironment.java:297)
    at com.ibm.domino.xsp.bridge.http.engine.XspCmdManager.service(XspCmdManager.java:272)
Caused by: java.lang.NoClassDefFoundError: org.apache.commons.httpclient.HttpMethod
    at java.lang.J9VMInternals.verifyImpl(Native Method)
    at java.lang.J9VMInternals.verify(J9VMInternals.java:72)
    at java.lang.J9VMInternals.initialize(J9VMInternals.java:134)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:56)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:39)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:527)
    at com.ibm.jscript.types.JavaAccessObject.construct(JavaAccessObject.java:260)
    at com.ibm.jscript.types.JavaWrapperObject.construct(JavaWrapperObject.java:1)
    at com.ibm.jscript.ASTTree.ASTNew.interpret(ASTNew.java:109)
    at com.ibm.jscript.ASTTree.ASTVariableDecl.interpret(ASTVariableDecl.java:82)
    at com.ibm.jscript.ASTTree.ASTBlock.interpret(ASTBlock.java:100)
    at com.ibm.jscript.ASTTree.ASTIf.interpret(ASTIf.java:85)
    at com.ibm.jscript.ASTTree.ASTBlock.interpret(ASTBlock.java:100)
    at com.ibm.jscript.ASTTree.ASTTry.interpret(ASTTry.java:109)
    at com.ibm.jscript.ASTTree.ASTProgram.interpret(ASTProgram.java:119)
    at com.ibm.jscript.ASTTree.ASTProgram.interpretEx(ASTProgram.java:139)
    at com.ibm.jscript.JSExpression._interpretExpression(JSExpression.java:435)
    at com.ibm.jscript.JSExpression.access$1(JSExpression.java:424)
    at com.ibm.jscript.JSExpression$2.run(JSExpression.java:414)
    at java.security.AccessController.doPrivileged(AccessController.java:284)
    at com.ibm.jscript.JSExpression.interpretExpression(JSExpression.java:410)
    at com.ibm.jscript.JSExpression.evaluateValue(JSExpression.java:251)
    at com.ibm.jscript.JSExpression.evaluateValue(JSExpression.java:234)
    at com.ibm.xsp.javascript.JavaScriptInterpreter.interpret(JavaScriptInterpreter.java:221)
    at com.ibm.xsp.binding.javascript.JavaScriptMethodBinding.invoke(JavaScriptMethodBinding.java:111)
    at com.ibm.xsp.component.UIIncludeComposite.initBeforePageContents(UIIncludeComposite.java:672)
    at com.ibm.xsp.page.compiled.AbstractCompiledPage.initComponent(AbstractCompiledPage.java:339)
    at com.ibm.xsp.page.compiled.AbstractCompiledPage.createTree(AbstractCompiledPage.java:256)
    at com.ibm.xsp.page.compiled.AbstractCompiledPage.addComponent(AbstractCompiledPage.java:389)
    at com.ibm.xsp.component.UIIncludeComposite.buildContents(UIIncludeComposite.java:453)
    at com.ibm.xsp.page.compiled.AbstractCompiledPage.initComponent(AbstractCompiledPage.java:334)
    at com.ibm.xsp.page.compiled.CompiledComponentBuilder.buildChildren(CompiledComponentBuilder.java:123)
    at com.ibm.xsp.page.compiled.CompiledComponentBuilder.buildAll(CompiledComponentBuilder.java:84)
    at com.ibm.xsp.component.UIViewRootEx.buildContents(UIViewRootEx.java:1649)
    at com.ibm.xsp.component.UIViewRootEx2.buildContents(UIViewRootEx2.java:246)
    at com.ibm.xsp.page.compiled.AbstractCompiledPage.initComponent(AbstractCompiledPage.java:334)
    at com.ibm.xsp.page.compiled.AbstractCompiledPage.createTree(AbstractCompiledPage.java:256)
    at com.ibm.xsp.page.compiled.AbstractCompiledPage.createViewRoot(AbstractCompiledPage.java:167)
    at com.ibm.xsp.application.ViewHandlerExImpl._createViewRoot(ViewHandlerExImpl.java:511)
    at com.ibm.xsp.application.ViewHandlerExImpl.createViewRoot(ViewHandlerExImpl.java:557)
    at com.ibm.xsp.application.ViewHandlerExImpl.doCreateView(ViewHandlerExImpl.java:141)
    at com.ibm.xsp.application.ViewHandlerEx.createView(ViewHandlerEx.java:90)
    at com.ibm.xsp.webapp.FacesServlet.serviceView(FacesServlet.java:238)
    at com.ibm.xsp.webapp.FacesServletEx.serviceView(FacesServletEx.java:200)
    at com.ibm.xsp.webapp.FacesServlet.service(FacesServlet.java:160)
    ... 13 more
Caused by: java.lang.ClassNotFoundException: Cannot find class org.apache.commons.httpclient.HttpMethod in NSF
    at com.ibm.domino.xsp.module.nsf.ModuleClassLoader$DynamicClassLoader.findClass(ModuleClassLoader.java:432)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:653)
    at com.ibm.domino.xsp.module.nsf.ModuleClassLoader$DynamicClassLoader.loadClass(ModuleClassLoader.java:341)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:619)
    ... 59 more

回答1:


Create a folder under WebContent\WEB-INF called lib. You don’t need to add it into the Build Path. Import the apache commons jar into that as a jar. Then it worked for me, but as I say I haven’t tested on more than one method on one server.

Also covered in this question Imported plugin into XPages Project not working



来源:https://stackoverflow.com/questions/11157168/xpages-java-lang-classnotfoundexception-cannot-find-class-org-apache-commons-h

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!