0

我是 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\""}}}}
4

1 回答 1

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- 中为此 jar 提供显式依赖项INF 如下所示。

依赖:com.h2database.h2

有关这方面的更多信息,请查看http://www.mastertheboss.com/jboss-as-7/jboss-as-7-classloading上的“显式依赖项”部分

祝你好运。

于 2014-04-22T21:59:26.740 回答