Tomcat无法启动应用程序,因为它无法找到JSONRPC2ParseException类

时间:2013-12-01 09:14:23

标签: java tomcat json-rpc

我在/var/lib/tomcat7/webapps/code中有应用程序我有使用json-rpc-2.0的init.java文件

我使用以下方法编译它:

export CLASSPATH=$CLASSPATH:/path/jsonrpc2-base-1.35.jar:/path/json-smart-1.2.jar
javac init.java

它编译但是当我运行应用程序(而不是servlet)时,我从Tomcat得到了错误404,而在catalina.out文件中有例外:

org.apache.catalina.LifecycleException: Failed to start component [StandardEngin
e[Catalina].StandardHost[localhost].StandardContext[/code]]
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase
.java:901)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:87
7)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
        at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.jav
a:1114)
        at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig
.java:1673)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:47
1)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
        at java.util.concurrent.FutureTask.run(FutureTask.java:166)
        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:724)
Caused by: java.lang.NoClassDefFoundError: com/thetransactioncompany/jsonrpc2/JSONRPC2ParseException
        at java.lang.Class.getDeclaredFields0(Native Method)
        at java.lang.Class.privateGetDeclaredFields(Class.java:2387)
        at java.lang.Class.getDeclaredFields(Class.java:1796)
        at org.apache.catalina.util.Introspection.getDeclaredFields(Introspection.java:106)
        at org.apache.catalina.startup.WebAnnotationSet.loadFieldsAnnotation(WebAnnotationSet.java:261)
        at org.apache.catalina.startup.WebAnnotationSet.loadApplicationServletAnnotations(WebAnnotationSet.java:140)
        at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:67)
        at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:405)
        at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:881)
        at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:369)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
        at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5179)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        ... 11 more
Caused by: java.lang.ClassNotFoundException: com.thetransactioncompany.jsonrpc2.JSONRPC2ParseException
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714)
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
        ... 25 more

由于在jar文件中找不到com/thetransactioncompany/jsonrpc2/JSONRPC2ParseException而导致。

这里发生了什么?如何修复它才能使其正常工作?

1 个答案:

答案 0 :(得分:0)

这通常是Tom文件无法使用的jar文件。

解决此问题的最佳方法是将json-rpc-2.0 jar文件放入Tomcat的lib文件夹

<强>更新

根据A4L用户的指定,您也可以将jar放入您的网络应用程序WEB-INF/lib中。