在tomcat服务器中部署war文件时出现此异常

发布于 2024-12-29 04:27:14 字数 6961 浏览 3 评论 0原文

我正在使用 Eclipse 中的 jetty 服务器在 Tapestry 中做 Web 项目。

在 eclipse 中运行时它工作正常。但是当我在Tomcat服务器中部署war文件时。 我得到下面的堆栈跟踪。请帮我

org.apache.tapestry5.ioc.internal.OperationException
java.lang.ClassNotFoundException: caught an exception while obtaining a class file for net.video.pages.Index

trace
Constructing instance of page class net.video.pages.Index
Creating ComponentAssembler for net.video.pages.Index

java.lang.ClassNotFoundException
caught an exception while obtaining a class file for net.video.pages.Index

exception
org.apache.tapestry5.ioc.internal.OperationException: javassist.NotFoundException: org.json.JSONException

org.apache.tapestry5.ioc.internal.OperationException
javassist.NotFoundException: org.json.JSONException

trace
Constructing instance of page class net.video.pages.Index
Creating ComponentAssembler for net.video.pages.Index
Transforming component class net.video.pages.Index

javassist.NotFoundException
org.json.JSONException

javassist.ClassPool.get(ClassPool.java:436)
javassist.ClassPool.get(ClassPool.java:655)
javassist.CtBehavior.getExceptionTypes(CtBehavior.java:335)
    org.apache.tapestry5.internal.services.InternalClassTransformationImpl.toMethodSignature(InternalClassTransformationImpl.java:1595)
    org.apache.tapestry5.internal.services.InternalClassTransformationImpl.access$000(InternalClassTransformationImpl.java:54)
    org.apache.tapestry5.internal.services.InternalClassTransformationImpl$TransformMethodImpl.<init>(InternalClassTransformationImpl.java:107)
    org.apache.tapestry5.internal.services.InternalClassTransformationImpl.recordMethod(InternalClassTransformationImpl.java:1143)
    org.apache.tapestry5.internal.services.InternalClassTransformationImpl.preloadMethods(InternalClassTransformationImpl.java:894)
    org.apache.tapestry5.internal.services.InternalClassTransformationImpl.preloadMembers(InternalClassTransformationImpl.java:887)
    org.apache.tapestry5.internal.services.InternalClassTransformationImpl.<init>(InternalClassTransformationImpl.java:805)
    org.apache.tapestry5.internal.services.ComponentClassTransformerImpl$1.run(ComponentClassTransformerImpl.java:186)
    org.apache.tapestry5.ioc.internal.OperationTrackerImpl$1.invoke(OperationTrackerImpl.java:50)
    org.apache.tapestry5.ioc.internal.OperationTrackerImpl$1.invoke(OperationTrackerImpl.java:47)
    org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:65)
    org.apache.tapestry5.ioc.internal.OperationTrackerImpl.run(OperationTrackerImpl.java:46)
    org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.run(PerThreadOperationTracker.java:56)
    org.apache.tapestry5.ioc.internal.RegistryImpl.run(RegistryImpl.java:1058)
    org.apache.tapestry5.internal.services.ComponentClassTransformerImpl.transformComponentClass(ComponentClassTransformerImpl.java:111)
    org.apache.tapestry5.internal.services.ComponentInstantiatorSourceImpl.onLoad(ComponentInstantiatorSourceImpl.java:212)
    javassist.Loader.findClass(Loader.java:340)
    org.apache.tapestry5.internal.services.ComponentInstantiatorSourceImpl$PackageAwareLoader.findClass(ComponentInstantiatorSourceImpl.java:102)
    javassist.Loader.loadClass(Loader.java:311)
    java.lang.ClassLoader.loadClass(ClassLoader.java:266)
    org.apache.tapestry5.internal.services.ComponentInstantiatorSourceImpl.findClass(ComponentInstantiatorSourceImpl.java:305)
    org.apache.tapestry5.internal.services.ComponentInstantiatorSourceImpl.getInstantiator(ComponentInstantiatorSourceImpl.java:285)
    org.apache.tapestry5.internal.pageload.PageLoaderImpl$4.invoke(PageLoaderImpl.java:222)
    org.apache.tapestry5.internal.pageload.PageLoaderImpl$4.invoke(PageLoaderImpl.java:219)
    org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:65)
    org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:68)
    org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1063)
    org.apache.tapestry5.internal.pageload.PageLoaderImpl.createAssembler(PageLoaderImpl.java:218)
    org.apache.tapestry5.internal.pageload.PageLoaderImpl.getAssembler(PageLoaderImpl.java:208)
    org.apache.tapestry5.internal.pageload.PageLoaderImpl$3.invoke(PageLoaderImpl.java:180)
    org.apache.tapestry5.internal.pageload.PageLoaderImpl$3.invoke(PageLoaderImpl.java:174)
    org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:65)
    org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:68)
    org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1063)
    org.apache.tapestry5.internal.pageload.PageLoaderImpl.loadPage(PageLoaderImpl.java:173)
    org.apache.tapestry5.internal.services.PageSourceImpl.getPage(PageSourceImpl.java:81)
    org.apache.tapestry5.internal.services.NonPoolingRequestPageCacheImpl.get(NonPoolingRequestPageCacheImpl.java:74)
    org.apache.tapestry5.internal.services.PageRenderRequestHandlerImpl.handle(PageRenderRequestHandlerImpl.java:55)
    org.apache.tapestry5.services.TapestryModule$36.handle(TapestryModule.java:2326)
    org.apache.tapestry5.internal.services.ComponentRequestHandlerTerminator.handlePageRender(ComponentRequestHandlerTerminator.java:48)
    org.apache.tapestry5.services.InitializeActivePageName.handlePageRender(InitializeActivePageName.java:47)
    org.apache.tapestry5.internal.services.PageRenderDispatcher.dispatch(PageRenderDispatcher.java:45)
    org.apache.tapestry5.services.TapestryModule$RequestHandlerTerminator.service(TapestryModule.java:321)
    net.snovabits.services.AppModule$1.service(AppModule.java:90)
    org.apache.tapestry5.internal.services.RequestErrorFilter.service(RequestErrorFilter.java:26)
    org.apache.tapestry5.services.TapestryModule$4.service(TapestryModule.java:984)
    org.apache.tapestry5.services.TapestryModule$3.service(TapestryModule.java:974)
    org.apache.tapestry5.internal.services.StaticFilesFilter.service(StaticFilesFilter.java:90)
    org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:90)
    org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:80)
    org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withRead(ConcurrentBarrier.java:85)
    org.apache.tapestry5.internal.services.CheckForUpdatesFilter.service(CheckForUpdatesFilter.java:103)
    org.apache.tapestry5.services.TapestryModule$HttpServletRequestHandlerTerminator.service(TapestryModule.java:272)
    org.apache.tapestry5.internal.gzip.GZipFilter.service(GZipFilter.java:53)
    org.apache.tapestry5.internal.services.IgnoredPathsFilter.service(IgnoredPathsFilter.java:62)
    org.apache.tapestry5.services.TapestryModule$2.service(TapestryModule.java:928)
    org.apache.tapestry5.TapestryFilter.doFilter(TapestryFilter.java:147) 

I'm doing web project in tapestry by using jetty server in Eclipse.

It works fine while running in eclipse. but when i deployed the war file in Tomcat server.
I'm getting the below Stack Trace. please help me

org.apache.tapestry5.ioc.internal.OperationException
java.lang.ClassNotFoundException: caught an exception while obtaining a class file for net.video.pages.Index

trace
Constructing instance of page class net.video.pages.Index
Creating ComponentAssembler for net.video.pages.Index

java.lang.ClassNotFoundException
caught an exception while obtaining a class file for net.video.pages.Index

exception
org.apache.tapestry5.ioc.internal.OperationException: javassist.NotFoundException: org.json.JSONException

org.apache.tapestry5.ioc.internal.OperationException
javassist.NotFoundException: org.json.JSONException

trace
Constructing instance of page class net.video.pages.Index
Creating ComponentAssembler for net.video.pages.Index
Transforming component class net.video.pages.Index

javassist.NotFoundException
org.json.JSONException

javassist.ClassPool.get(ClassPool.java:436)
javassist.ClassPool.get(ClassPool.java:655)
javassist.CtBehavior.getExceptionTypes(CtBehavior.java:335)
    org.apache.tapestry5.internal.services.InternalClassTransformationImpl.toMethodSignature(InternalClassTransformationImpl.java:1595)
    org.apache.tapestry5.internal.services.InternalClassTransformationImpl.access$000(InternalClassTransformationImpl.java:54)
    org.apache.tapestry5.internal.services.InternalClassTransformationImpl$TransformMethodImpl.<init>(InternalClassTransformationImpl.java:107)
    org.apache.tapestry5.internal.services.InternalClassTransformationImpl.recordMethod(InternalClassTransformationImpl.java:1143)
    org.apache.tapestry5.internal.services.InternalClassTransformationImpl.preloadMethods(InternalClassTransformationImpl.java:894)
    org.apache.tapestry5.internal.services.InternalClassTransformationImpl.preloadMembers(InternalClassTransformationImpl.java:887)
    org.apache.tapestry5.internal.services.InternalClassTransformationImpl.<init>(InternalClassTransformationImpl.java:805)
    org.apache.tapestry5.internal.services.ComponentClassTransformerImpl$1.run(ComponentClassTransformerImpl.java:186)
    org.apache.tapestry5.ioc.internal.OperationTrackerImpl$1.invoke(OperationTrackerImpl.java:50)
    org.apache.tapestry5.ioc.internal.OperationTrackerImpl$1.invoke(OperationTrackerImpl.java:47)
    org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:65)
    org.apache.tapestry5.ioc.internal.OperationTrackerImpl.run(OperationTrackerImpl.java:46)
    org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.run(PerThreadOperationTracker.java:56)
    org.apache.tapestry5.ioc.internal.RegistryImpl.run(RegistryImpl.java:1058)
    org.apache.tapestry5.internal.services.ComponentClassTransformerImpl.transformComponentClass(ComponentClassTransformerImpl.java:111)
    org.apache.tapestry5.internal.services.ComponentInstantiatorSourceImpl.onLoad(ComponentInstantiatorSourceImpl.java:212)
    javassist.Loader.findClass(Loader.java:340)
    org.apache.tapestry5.internal.services.ComponentInstantiatorSourceImpl$PackageAwareLoader.findClass(ComponentInstantiatorSourceImpl.java:102)
    javassist.Loader.loadClass(Loader.java:311)
    java.lang.ClassLoader.loadClass(ClassLoader.java:266)
    org.apache.tapestry5.internal.services.ComponentInstantiatorSourceImpl.findClass(ComponentInstantiatorSourceImpl.java:305)
    org.apache.tapestry5.internal.services.ComponentInstantiatorSourceImpl.getInstantiator(ComponentInstantiatorSourceImpl.java:285)
    org.apache.tapestry5.internal.pageload.PageLoaderImpl$4.invoke(PageLoaderImpl.java:222)
    org.apache.tapestry5.internal.pageload.PageLoaderImpl$4.invoke(PageLoaderImpl.java:219)
    org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:65)
    org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:68)
    org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1063)
    org.apache.tapestry5.internal.pageload.PageLoaderImpl.createAssembler(PageLoaderImpl.java:218)
    org.apache.tapestry5.internal.pageload.PageLoaderImpl.getAssembler(PageLoaderImpl.java:208)
    org.apache.tapestry5.internal.pageload.PageLoaderImpl$3.invoke(PageLoaderImpl.java:180)
    org.apache.tapestry5.internal.pageload.PageLoaderImpl$3.invoke(PageLoaderImpl.java:174)
    org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:65)
    org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:68)
    org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:1063)
    org.apache.tapestry5.internal.pageload.PageLoaderImpl.loadPage(PageLoaderImpl.java:173)
    org.apache.tapestry5.internal.services.PageSourceImpl.getPage(PageSourceImpl.java:81)
    org.apache.tapestry5.internal.services.NonPoolingRequestPageCacheImpl.get(NonPoolingRequestPageCacheImpl.java:74)
    org.apache.tapestry5.internal.services.PageRenderRequestHandlerImpl.handle(PageRenderRequestHandlerImpl.java:55)
    org.apache.tapestry5.services.TapestryModule$36.handle(TapestryModule.java:2326)
    org.apache.tapestry5.internal.services.ComponentRequestHandlerTerminator.handlePageRender(ComponentRequestHandlerTerminator.java:48)
    org.apache.tapestry5.services.InitializeActivePageName.handlePageRender(InitializeActivePageName.java:47)
    org.apache.tapestry5.internal.services.PageRenderDispatcher.dispatch(PageRenderDispatcher.java:45)
    org.apache.tapestry5.services.TapestryModule$RequestHandlerTerminator.service(TapestryModule.java:321)
    net.snovabits.services.AppModule$1.service(AppModule.java:90)
    org.apache.tapestry5.internal.services.RequestErrorFilter.service(RequestErrorFilter.java:26)
    org.apache.tapestry5.services.TapestryModule$4.service(TapestryModule.java:984)
    org.apache.tapestry5.services.TapestryModule$3.service(TapestryModule.java:974)
    org.apache.tapestry5.internal.services.StaticFilesFilter.service(StaticFilesFilter.java:90)
    org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:90)
    org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:80)
    org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withRead(ConcurrentBarrier.java:85)
    org.apache.tapestry5.internal.services.CheckForUpdatesFilter.service(CheckForUpdatesFilter.java:103)
    org.apache.tapestry5.services.TapestryModule$HttpServletRequestHandlerTerminator.service(TapestryModule.java:272)
    org.apache.tapestry5.internal.gzip.GZipFilter.service(GZipFilter.java:53)
    org.apache.tapestry5.internal.services.IgnoredPathsFilter.service(IgnoredPathsFilter.java:62)
    org.apache.tapestry5.services.TapestryModule$2.service(TapestryModule.java:928)
    org.apache.tapestry5.TapestryFilter.doFilter(TapestryFilter.java:147) 

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

坦然微笑 2025-01-05 04:27:14

我有一个类似的问题,它在 eclipse 中工作,但是当部署在 tomcat 中时,它会抛出错误。这可能是因为在 eclipse 中您在不同位置提供了一些 jar 文件并在类路径中使用它。

因此,请确保您的所有 jar 都在项目 lib 文件夹中可用

I had a similar issue where it works in eclipse but when deployed in tomcat, it throws error. It could be because in eclipse you provide some jar files in different locations and use it in class path.

Hence make sure all your jars are available in project lib folder

陌若浮生 2025-01-05 04:27:14

您的 WAR 文件是否已正确构建,并分别包含 WEB-INF\classesWEB-INF\lib 下的所有编译类和所需库?

Is your WAR file getting built correctly and including all of your compiled classes and needed libraries under WEB-INF\classes and WEB-INF\lib respectively?

哥,最终变帅啦 2025-01-05 04:27:14

类路径加载器默认为 JVM 类路径。
如果当前类与您尝试获取其实例的类位于同一 jar/位置,则使用它来获取当前类的类路径加载器:

    ClassPool pool = ClassPool.getDefault();
    ClassClassPath ccpath = new ClassClassPath(this.getClass());
    pool.insertClassPath(ccpath);
    CtClass superClass =    pool.get("com.some.TestClass");

The classpath loader defaults to the JVM classpath.
Use this to get the classpath loader for the current class if it is in the same jar/location as your class you are trying to get an instance of:

    ClassPool pool = ClassPool.getDefault();
    ClassClassPath ccpath = new ClassClassPath(this.getClass());
    pool.insertClassPath(ccpath);
    CtClass superClass =    pool.get("com.some.TestClass");
旧城烟雨 2025-01-05 04:27:14

看起来你的战争中缺少一个库 - 它只存在于你的 Eclipse 配置中。

looks like a library is missing in your war - which is only present in your eclipse configuration.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文