我试图在IntelliJ Idea中调试一个web应用程序,该应用程序以爆炸战争的形式部署到本地Tomcat6服务器上。
在应用程序开始时,我得到ClassNotFoundExceptions
,尽管分解的WAR目录包含这些类(在其WEB-INF/CLASSE
子目录中)。
当我在IntelliJ Idea中启动web应用程序(按debug'Tomcat'
按钮)并查看Tomcat webapp目录(C:\program files\Apache Software Foundation\tomcat6.0\webapps
)时,我没有看到一个目录包含我的爆炸战争。
因此,我认为未将爆炸的WAR复制到相应的Tomcat目录中。
我如何修复这个问题(确保Tomcat可以看到我分解的WAR目录中的所有类文件)?
org.apache.tomcat.util.modeler.BaseModelMBean invoke
SEVERE: Exception invoking method manageApp
java.lang.NoClassDefFoundError: ru/mycompany/MyClass
at ru.mycompany.MyCustomRealm.start(Unknown Source)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4594)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1429)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:297)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:631)
at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:568)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:295)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1487)
at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:97)
at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1328)
at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1420)
at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:848)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:322)
at sun.rmi.transport.Transport$1.run(Transport.java:177)
at sun.rmi.transport.Transport$1.run(Transport.java:174)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:173)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:553)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:808)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:667)
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.ClassNotFoundException: ru.mycompany.MyClass
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 42 more
сен 18, 2013 1:38:26 PM org.apache.tomcat.util.modeler.BaseModelMBean invoke
SEVERE: Exception invoking method createStandardContext
javax.management.RuntimeErrorException: Error invoking method manageApp
at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:308)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:631)
at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:568)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:295)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1487)
at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:97)
at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1328)
at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1420)
at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:848)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:322)
at sun.rmi.transport.Transport$1.run(Transport.java:177)
at sun.rmi.transport.Transport$1.run(Transport.java:174)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:173)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:553)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:808)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:667)
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: ru/mycompany/MyClass
at ru.mycompany.MyCustomRealm.start(Unknown Source)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4594)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1429)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:297)
... 31 more
Caused by: java.lang.ClassNotFoundException: ru.mycompany.MyClass
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 42 more
我有一个类似的应用程序,碰巧是一个maven项目,默认情况下它使用目标(输出)目录。但是,这可以通过以下方式加以验证:
>
使用catalina_base在启动日志中查找以下行:“C:\users\xxxxx\.intellijidea12\system\tomcat\unnamed_bpt_5”
进入日志消息中指定的目录,然后进入conf\catalina\localhost
此外,请确保在启动前
部分的run/debug configuration
页上添加了make
(或maven package)目标,以便它能够编译您的类和资源
我有一个Java web应用程序,我正在IntelliJ中开发,并使用Apache Tomcat进行部署。我定义了一些在团队中每个人之间共享的运行配置。这些运行配置定义为将分解的war工件部署到本地tomcat中。其他团队成员能够很好地部署和运行,但我遇到以下错误: IntelliJ似乎不想创建分解/项目。war目录。如果我手动创建这些目录,我不会收到该错误消息,但WAR内容都不会放入该目录。 我
我一直在努力研究如何使用maven overlay插件将项目排除在爆炸战争之外。 我有以下内容: xml和applicationcontext.xml可以很好地排除,但它们位于:${basedir}/src/main/webapp/web-inf/下 无论我尝试什么,这些文件是静止的,覆盖,尽管排除。
对于我当前的项目,我创建了独立的基于Spingboot的应用程序。目前,我正在WildFly standalone deployment文件夹中以war文件的形式部署应用程序。为了在war文件中进行任何更改(比如更新JNDI名称),我需要将war作为zip打开,解压缩并更改应用程序。属性文件,然后将其打包为war。 有什么方法可以让我把爆炸的战争保存在部署文件夹中吗?
我们在IntelliJ(Ultimate 14.1.14)中有一个java web项目,我们希望从爆炸战争中排除某个文件夹。
我跟随以下帖子,但这些都没有帮助我。邮政一、邮政二、邮政03、邮政04 我花了两天时间寻找答案,请帮帮我。
我创建了一个迷你应用程序,它依赖于Wiremock来模仿restful服务。 我遇到的问题是,当我尝试并使用该应用程序时,通过WebLogic12c,Wiremock期望的上下文路径不是正确的路径。我已经通过附加调试器证明了这一点。它会更改路径并添加到另一个文件夹中。