3
votes

When i deploy my working war file in JBoss AS 7 i got following exception

11:59:11,090 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-6) JBAS015893: Encountered invalid class name 'com.sun.jersey.server.impl.model.parameter.multivalued.StringReaderProviders$StringConstructor' for service type 'com.sun.jersey.spi.StringReaderProvider'
11:59:11,091 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-6) JBAS015893: Encountered invalid class name 'com.sun.jersey.server.impl.model.parameter.multivalued.StringReaderProviders$DateProvider' for service type 'com.sun.jersey.spi.StringReaderProvider'
11:59:11,092 WARN  [org.jboss.as.server.deployment] (MSC service thread 1-6) JBAS015893: Encountered invalid class name 'com.sun.jersey.server.impl.model.parameter.multivalued.JAXBStringReaderProviders$RootElementProvider' for service type 'com.sun.jersey.spi.StringReaderProvider'
11:59:11,923 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-5) MSC00001: Failed to start service jboss.deployment.unit."myimpl.war".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.unit."myimpl.war".POST_MODULE: Failed to process phase POST_MODULE of deployment "myimpl.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$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_37]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_37]
    at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_37]
Caused by: java.lang.NoClassDefFoundError: org/hibernate/exception/ConstraintViolationException
    at java.lang.Class.getDeclaredConstructors0(Native Method) [rt.jar:1.6.0_37]
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389) [rt.jar:1.6.0_37]
    at java.lang.Class.getConstructor0(Class.java:2699) [rt.jar:1.6.0_37]
    at java.lang.Class.getConstructor(Class.java:1657) [rt.jar:1.6.0_37]
    at org.jboss.as.web.deployment.jsf.JsfManagedBeanProcessor.deploy(JsfManagedBeanProcessor.java:108)
    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.ClassNotFoundException: org.hibernate.exception.ConstraintViolationException from [Module "deployment.myimpl.war:main" from Service Module Loader]
    at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190) [jboss-modules.jar:1.1.1.GA]
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468) [jboss-modules.jar:1.1.1.GA]
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456) [jboss-modules.jar:1.1.1.GA]
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423) [jboss-modules.jar:1.1.1.GA]
    at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398) [jboss-modules.jar:1.1.1.GA]
    at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120) [jboss-modules.jar:1.1.1.GA]
    ... 11 more

11:59:11,938 INFO  [org.jboss.as] (MSC service thread 1-7) JBAS015951: Admin console listening on http://127.0.0.1:9990
11:59:11,938 ERROR [org.jboss.as] (MSC service thread 1-7) JBAS015875: JBoss AS 7.1.1.Final "Brontes" started (with errors) in 72380ms - Started 1402 of 1548 services (1 services failed or missing dependencies, 136 services are passive or on-demand)
11:59:11,939 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015870: Deploy of deployment "myimpl.war" was rolled back with failure message {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"myimpl.war\".POST_MODULE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"myimpl.war\".POST_MODULE: Failed to process phase POST_MODULE of deployment \"myimpl.war\""}}
11:59:12,036 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-5) JBAS015877: Stopped deployment myimpl.war in 95ms
11:59:12,038 INFO  [org.jboss.as.controller] (DeploymentScanner-threads - 2) JBAS014774: Service status report
JBAS014777:   Services which failed to start:      service jboss.deployment.unit."myimpl.war".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.unit."myimpl.war".POST_MODULE: Failed to process phase POST_MODULE of deployment "myimpl.war"

11:59:12,040 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.\"myimpl.war\".POST_MODULE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"myimpl.war\".POST_MODULE: Failed to process phase POST_MODULE of deployment \"myimpl.war\""}}}}

I think by default JBoss AS 7 support to add hibernate jars into classpath on the launching time (because hibernate module is already available in JBoss AS7). I found the ConstraintViolationException class under hibernate-core-4.0.1.Final.jar (under 'modules\org\hibernate\main' folder structure) . Then why this NoClassDefFoundError happens?

Please note that i am not using maven for dependency resolving. For dependency resolving i manually put the jar file into myimpl.war\WEB-INF\lib

Anyway i added the jar for hibernate (hibernate3.jar) in WEB-INF\lib directory after that some new exception comes, which looks like follows

12:51:19,146 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-6) MSC00001: Failed to start service jboss.deployment.unit."myimpl.war".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.unit."myimpl.war".POST_MODULE: Failed to process phase POST_MODULE of deployment "myimpl.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$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_37]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_37]
    at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_37]
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS011232: Only one JAX-RS Application Class allowed.  com.sun.jersey.api.core.WebAppResourceConfig com.sun.jersey.api.core.ResourceConfig com.sun.jersey.api.core.ClassNamesResourceConfig com.sun.jersey.api.core.ScanningResourceConfig com.sun.jersey.api.core.ClasspathResourceConfig com.sun.jersey.api.core.DefaultResourceConfig com.sun.jersey.api.core.PackagesResourceConfig com.sun.jersey.server.impl.application.DeferredResourceConfig com.sun.jersey.api.core.ApplicationAdapter
    at org.jboss.as.jaxrs.deployment.JaxrsScanningProcessor.scan(JaxrsScanningProcessor.java:209)
    at org.jboss.as.jaxrs.deployment.JaxrsScanningProcessor.deploy(JaxrsScanningProcessor.java:105)
    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

Please give me a brief idea to how to resolve this problem

4
you can find the jars in WEB-INF/lib folder from This LinkAnish Antony

4 Answers

1
votes

You have to add the dependency for hibernate jars in jboss deployment structure xml file.Try that and let me know the results

1
votes

Resolved the org.jboss.as.server.deployment.DeploymentUnitProcessingException by removing the following two lines from stanalone.xml



    <extension module="org.jboss.as.jaxrs"/>
    <subsystem xmlns="urn:jboss:domain:jaxrs:1.0"/>


Also the hibernate NoClassDefFoundError is due to the hibernate jar version problem. On the war file i am using hibernate3.jar and on the hibernate module directory of JBoss AS7 which contains a hibernate 4.0.1 version

1
votes

Check the classpath too

Issue-java.lang.NoClassDefFoundError

Root Cause: Incorrect Java path set in Environment Variable Section

Solution: Set correct JAVA_HOME Path

Steps->Environment Variable Setting (My Comp-Right Click ->Properties->Env Variable->Advance Tab ->Variable)

Create new JAVA_HOME Environment Variable.

JAVA_HOME .;C:\Program Files (x86)\Java\jdk1.6.0_14

Set JAVA_HOME variable in PATH Variable section.

PATH %JAVA_HOME%\bin

Set JAVA_HOME variable in CLASSPATH Variable

CLASSPATH %JAVA_HOME%\jre\lib

Restart System

Verify all variable

echo %CLASSPATH%

echo %JAVA_HOME%

echo %PATH%

Compile & Run the program

1
votes

I agree with sankar on adding explict dependency for hibernate module provided by jboss. Other way of adding dependecies is through MANIFEST file under META-INF.

Below link is good article on Jboss ClassLoading and Dependencies. Hope it helps.

http://www.mastertheboss.com/jboss-as-7/jboss-as-7-classloading