从Eclipse运行Jboss EAP 6.3时出错?

时间:2015-09-30 19:54:44

标签: java eclipse maven jboss6.x

我只是在从eclipse启动Jboss时遇到此错误,当我用完eclipse时,它运行正常。

我正在使用JBoss EAP 6.3。

    ERROR [fail] (MSC service thread 1-8) MSC000001: Failed to start service jboss.deployment.subunit."example.ear"."example-ejb.jar".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.subunit."example.ear"."example-ejb.jar".POST_MODULE: JBAS018733: Failed to process phase POST_MODULE of subdeployment "example-ejb.jar" of deployment "example.ear"
  at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:127)
  at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
  at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
  at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.RuntimeException: JBAS018757: Error getting reflective information for class com.jboss.examples.ejb.ExampleSingleton with ClassLoader ModuleClassLoader for Module "deployment.example.ear.example-ejb.jar:main" from Service Module Loader
  at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:72)
  at org.jboss.as.ee.metadata.MethodAnnotationAggregator.runtimeAnnotationInformation(MethodAnnotationAggregator.java:58)
  at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.handleAnnotations(InterceptorAnnotationProcessor.java:107)
  at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.processComponentConfig(InterceptorAnnotationProcessor.java:92)
  at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.deploy(InterceptorAnnotationProcessor.java:77)
  at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:120)
  ... 5 more
Caused by: java.lang.NoClassDefFoundError: Lcom/jboss/examples/Example;
  at java.lang.Class.getDeclaredFields0(Native Method)
  at java.lang.Class.privateGetDeclaredFields(Class.java:2308)
  at java.lang.Class.getDeclaredFields(Class.java:1760)
  at org.jboss.as.server.deployment.reflect.ClassReflectionIndex.<init>(ClassReflectionIndex.java:57)
  at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:68)
  ... 10 more
Caused by: java.lang.ClassNotFoundException: com.jboss.examples.Example from [Module "deployment.example.ear.example-ejb.jar:main" from Service Module Loader]
  at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:197)
  at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:443)
  at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:431)
  at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:373)
  at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:118)
  ... 15 more

有谁知道会发生什么?

2 个答案:

答案 0 :(得分:3)

从服务器选项卡中删除服务器中的所有已部署项目。尝试启动服务器。从eclipse导出war文件并尝试从管理控制台部署它。

或者您可以尝试重建项目。

这可能是因为您的构建版本不包含必需的* .class文件。

答案 1 :(得分:1)

这是因为我在Maven构建中用于依赖的范围。 我正在使用提供,因此,我更改为默认范围“编译”

有6个范围:

编译 这是默认范围,如果未指定,则使用此范围。编译依赖项在项目的所有类路径中都可用。此外,这些依赖项将传播到依赖项目。

提供 这很像compile,但表示您希望JDK或容器在运行时提供依赖性。例如,在为Java Enterprise Edition构建Web应用程序时,您可以将Servlet API和相关Java EE API的依赖关系设置为提供的范围,因为Web容器提供了这些类。此范围仅在编译和测试类路径中可用,并且不可传递。

运行时 此范围表示编译不需要依赖项,但是用于执行。它位于运行时和测试类路径中,但不是编译类路径。

测试 此范围表示正常使用应用程序不需要依赖关系,并且仅适用于测试编译和执行阶段。

系统 此范围与提供的类似,只是您必须提供明确包含它的JAR。工件始终可用,不会在存储库中查找。

导入(仅适用于Maven 2.0.9或更高版本) 此范围仅用于“dependencyManagement”部分中类型为pom的依赖项。它表示应该用POM的“dependencyManagement”部分中的依赖项替换指定的POM。由于它们被替换,具有导入范围的依赖性实际上并不参与限制依赖的传递性。

我正在使用:

<dependency>
            <groupId>br.com.web</groupId>
            <artifactId>entity</artifactId>
            <scope>provided</scope>
        </dependency>

然后我改为:

<dependency>
                <groupId>br.com.web</groupId>
                <artifactId>entity</artifactId>
            </dependency>