无法在JBoss 7.1.1下部署动态Web项目(链接到EJB项目)

时间:2017-03-27 07:17:46

标签: java java-ee jboss ejb

我需要一些帮助,我从今天早上开始尝试运行它,我有2个项目,

  • EJB项目( StudentManajementEJB
  • 动态网络项目( StudentManajementWeb

    enter image description here

网络服务器:

jboss-as-7.1.1.Final

StudentManajementEJB 已成功部署(表格在数据库中创建),作为证明:

enter image description here 现在我将StudentManajementWeb链接到StudentManajementEJB。 enter image description here

现在我正确点击运行服务器 StudentManajementWeb ,我一直得到:

enter image description here

的persistence.xml:

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0"
    xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
    <persistence-unit name="StudentMgtPU"
        transaction-type="JTA">
        <jta-data-source>java:/StudentMgtDS</jta-data-source>
        <properties>
            <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />
            <property name="hibernate.hbm2ddl.auto" value="create" />
        </properties>
    </persistence-unit>
</persistence>

的web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    id="WebApp_ID" version="2.5">
    <display-name>StudentManagementWeb</display-name>
    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>
    <servlet>
        <description></description>
        <display-name>ManageStudentServlet</display-name>
        <servlet-name>ManageStudentServlet</servlet-name>
        <servlet-class>com.sameera.controller.ManageStudentServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>ManageStudentServlet</servlet-name>
        <url-pattern>/ManageStudentServlet</url-pattern>
    </servlet-mapping>
</web-app>

这是失败的日志:

13:58:43,295 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC00001: Failed to start service jboss.deployment.unit."StudentManagementWeb.war".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.unit."StudentManagementWeb.war".POST_MODULE: Failed to process phase POST_MODULE of deployment "StudentManagementWeb.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_60]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_60]
    at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_60]
Caused by: java.lang.RuntimeException: Error getting reflective information for class com.sameera.controller.ManageStudentServlet with ClassLoader ModuleClassLoader for Module "deployment.StudentManagementWeb.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: Lcom/sameera/session/ManageStudentSessionBeanLocal;
    at java.lang.Class.getDeclaredFields0(Native Method) [rt.jar:1.7.0_60]
    at java.lang.Class.privateGetDeclaredFields(Class.java:2436) [rt.jar:1.7.0_60]
    at java.lang.Class.getDeclaredFields(Class.java:1806) [rt.jar:1.7.0_60]
    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: com.sameera.session.ManageStudentSessionBeanLocal from [Module "deployment.StudentManagementWeb.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

1 个答案:

答案 0 :(得分:1)

在构建路径中使用类有利于构建时,但对于部署,容器需要访问依赖项。尝试include your jar file in your war file