简单的servlet Jboss 7.1.1

时间:2013-09-12 21:09:30

标签: java maven servlets jboss7.x

我是java web开发的新手。我正在使该项目适应服务器jboss 7.1.1。我写空胴体servlet。将project.war复制到服务器。新文件存在project.war.deployed。好的,但如果我声明变量:

private org.h2.tools.Server server; 

将project.war复制到服务器后,显示文件project.war.failed。在文件中,pom.xml包含库。请帮帮我。

日志文件:

09:00:39,380 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-6) JBAS015876: Starting deployment of "project.war"
09:00:42,054 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-4) Class Path entry jaxb-api.jar in "/c:/jbpm-installer/content/project.war/WEB-INF/lib/jaxb-impl-2.2.4-1.jar"  does not point to a valid jar for a Class-Path reference.
09:00:42,055 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-4) Class Path entry activation.jar in "/c:/jbpm-installer/content/project.war/WEB-INF/lib/jaxb-impl-2.2.4-1.jar"  does not point to a valid jar for a Class-Path reference.
09:00:42,056 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-4) Class Path entry jsr173_1.0_api.jar in "/c:/jbpm-installer/content/project.war/WEB-INF/lib/jaxb-impl-2.2.4-1.jar"  does not point to a valid jar for a Class-Path reference.
09:00:42,057 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-4) Class Path entry jaxb1-impl.jar in "/c:/jbpm-installer/content/project.war/WEB-INF/lib/jaxb-impl-2.2.4-1.jar"  does not point to a valid jar for a Class-Path reference.
09:00:42,058 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-4) Class Path entry jaxb-api.jar in "/c:/jbpm-installer/content/project.war/WEB-INF/lib/jaxb-xjc-2.2.4-1.jar"  does not point to a valid jar for a Class-Path reference.
09:00:42,059 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-4) Class Path entry jaxb-impl.jar in "/c:/jbpm-installer/content/project.war/WEB-INF/lib/jaxb-xjc-2.2.4-1.jar"  does not point to a valid jar for a Class-Path reference.
09:00:42,061 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-4) Class Path entry jsr173_1.0_api.jar in "/c:/jbpm-installer/content/project.war/WEB-INF/lib/jaxb-xjc-2.2.4-1.jar"  does not point to a valid jar for a Class-Path reference.
09:00:42,062 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-4) Class Path entry activation.jar in "/c:/jbpm-installer/content/project.war/WEB-INF/lib/jaxb-xjc-2.2.4-1.jar"  does not point to a valid jar for a Class-Path reference.
09:00:42,077 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-4) JBAS015893: Encountered invalid class name 'org.springframework.context.ApplicationContext,org.springframework.beans.BeansException' for service type 'org.apache.cxf.bus.factory'
09:00:42,078 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-4) JBAS015893: Encountered invalid class name 'org.xmlpull.mxp1.MXParser,org.xmlpull.mxp1_serializer.MXSerializer' for service type 'org.xmlpull.v1.XmlPullParserFactory'
09:00:42,079 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-4) JBAS015893: Encountered invalid class name 'org.xmlpull.mxp1.MXParser,org.xmlpull.mxp1_serializer.MXSerializer' for service type 'org.xmlpull.v1.XmlPullParserFactory'
09:00:42,089 INFO  [org.jboss.as.jpa] (MSC service thread 1-4) JBAS011401: Read persistence.xml for jbpm
09:00:42,090 INFO  [org.jboss.as.jpa] (MSC service thread 1-4) JBAS011401: Read persistence.xml for org.jbpm.task
09:00:42,243 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC00001: Failed to start service jboss.deployment.unit."project.war".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.unit."project.war".POST_MODULE: Failed to process phase POST_MODULE of deployment "project.war"
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_25]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_25]
    at java.lang.Thread.run(Thread.java:724) [rt.jar:1.7.0_25]
Caused by: java.lang.RuntimeException: Error getting reflective information for class org.jboss.jbpm.webapp.servelet.HumanTaskStartupServlet with ClassLoader ModuleClassLoader for Module "deployment.project.war:main" from Service Module Loader
    at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:70) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
    at org.jboss.as.ee.metadata.MethodAnnotationAggregator.runtimeAnnotationInformation(MethodAnnotationAggregator.java:58)
    at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.handleAnnotations(InterceptorAnnotationProcessor.java:85)
    at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.processComponentConfig(InterceptorAnnotationProcessor.java:70)
    at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.deploy(InterceptorAnnotationProcessor.java:55)
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
    ... 5 more
Caused by: java.lang.NoClassDefFoundError: Lorg/h2/tools/Server;
    at java.lang.Class.getDeclaredFields0(Native Method) [rt.jar:1.7.0_25]
    at java.lang.Class.privateGetDeclaredFields(Class.java:2387) [rt.jar:1.7.0_25]
    at java.lang.Class.getDeclaredFields(Class.java:1796) [rt.jar:1.7.0_25]
    at org.jboss.as.server.deployment.reflect.ClassReflectionIndex.<init>(ClassReflectionIndex.java:57) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
    at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:66) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
    ... 10 more
Caused by: java.lang.ClassNotFoundException: org.h2.tools.Server from [Module "deployment.project.war:main" from Service Module Loader]
    at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
    at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
    ... 15 more
09:00:42,256 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015870: Deploy of deployment "project.war" was rolled back with failure message {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"project.war\".POST_MODULE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"project.war\".POST_MODULE: Failed to process phase POST_MODULE of deployment \"project.war\""}}
09:00:42,458 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015877: Stopped deployment project.war in 202ms
09:00:42,461 INFO  [org.jboss.as.controller] (DeploymentScanner-threads - 2) JBAS014774: Service status report
JBAS014777:   Services which failed to start:      service jboss.deployment.unit."project.war".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.unit."project.war".POST_MODULE: Failed to process phase POST_MODULE of deployment "project.war"
09:00:42,463 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"project.war\".POST_MODULE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"project.war\".POST_MODULE: Failed to process phase POST_MODULE of deployment \"project.war\""}}}}

1 个答案:

答案 0 :(得分:0)

弗拉基米尔,

显然加载servlet的ClassLoader似乎无法找到类org.h2.tools.Server。

从与Nambari的对话中,似乎h2.jar未复制到WEB-INF / lib文件夹。你不想复制文件是有道理的。因为,我相信Jboss AS 7.1.1已经附带了这个jar作为模块。

对于非隐式依赖项(https://docs.jboss.org/author/display/AS7/Implicit+module+dependencies+for+deployments),我猜您需要在.war META-INF中为此jar提供显式依赖项,如下所示。

依赖项:com.h2database.h2

有关详细信息,请参阅http://www.mastertheboss.com/jboss-as-7/jboss-as-7-classloading

上的“显式依赖关系”部分

祝你好运。