ClassNotFoundException while deploying ear in wildfly8.1 - jboss

I am moving my jboss 4 application to wildfly
It consist of 10 modules
i have added it in appliction.xml
i have also added this entry true
i copied my all my thirdparty jars into ear/lib folder
i have updated all my ejb-jar.xml DTDs
my ejb modules are 2.0
but while deploying i am getting these error
caused by: java.lang.ClassNotFoundException: com.firstapex.fic.cps.services.vo.CPSDetailVo from [Module "deployment.FirstGen20140802_121633.ear.ficquot.jar:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:213) [jboss-modules.jar:1.3.3.Final]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:459) [jboss-modules.jar:1.3.3.Final]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:408) [jboss-modules.jar:1.3.3.Final]
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:389) [jboss-modules.jar:1.3.3.Final]
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:134) [jboss-modules.jar:1.3.3.Final]
... 14 more
server version : wildfly 8.1 final
os: windows xp
jdk:1.7

Related

Broadleaf Jboss Setup ClassNoFound

When trying to do a broadleaf Jboss setup, I am getting the below error
I have checked the source code com.broadleafcommerce.customersegment.admin.dataimport.persistence.CustomerSegmentRecordPersistencePreProcessor is available in broadleaf-merchandising-group-1.2.1-GA.jar but strangely the class com.broadleafcommerce.dataimport.service.RecordPersistencePreProcessor is no where found, please help.
2018-01-02 21:51:54,565 WARN [org.jboss.modules] (MSC service thread 1-7) Failed to define class com.broadleafcommerce.customersegment.admin.dataimport.persistence.CustomerSegmentRecordPersistencePreProcessor in Module "deployment.admin.war" from Service Module Loader: java.lang.NoClassDefFoundError: Failed to link com/broadleafcommerce/customersegment/admin/dataimport/persistence/CustomerSegmentRecordPersistencePreProcessor (Module "deployment.admin.war" from Service Module Loader): com/broadleafcommerce/dataimport/service/RecordPersistencePreProcessor
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:446)
at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:274)
at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:77)
at org.jboss.modules.Module.loadModuleClass(Module.java:713)
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:412)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:400)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:116)
at org.wildfly.extension.undertow.deployment.ServletContainerInitializerDeploymentProcessor.loadClassInfoSet(ServletContainerInitializerDeploymentProcessor.java:259)
at org.wildfly.extension.undertow.deployment.ServletContainerInitializerDeploymentProcessor.deploy(ServletContainerInitializerDeploymentProcessor.java:169)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:165)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:2032)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1955)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
2018-01-02 21:51:54,565 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-7) MSC000001: Failed to start service jboss.deployment.unit."admin.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."admin.war".INSTALL: WFLYSRV0153: Failed to process phase INSTALL of deployment "admin.war"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:172)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:2032)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1955)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NoClassDefFoundError: Failed to link com/broadleafcommerce/customersegment/admin/dataimport/persistence/CustomerSegmentRecordPersistencePreProcessor (Module "deployment.admin.war" from Service Module Loader): com/broadleafcommerce/dataimport/service/RecordPersistencePreProcessor
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:446)
at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:274)
at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:77)
at org.jboss.modules.Module.loadModuleClass(Module.java:713)
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:412)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:400)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:116)
at org.wildfly.extension.undertow.deployment.ServletContainerInitializerDeploymentProcessor.loadClassInfoSet(ServletContainerInitializerDeploymentProcessor.java:259)
at org.wildfly.extension.undertow.deployment.ServletContainerInitializerDeploymentProcessor.deploy(ServletContainerInitializerDeploymentProcessor.java:169)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:165)
... 5 more
The issue that you are running into is the ServletContextInitializer scanning in Servlet 3.0+ containers. In Tomcat, you can control this with this guide: https://wiki.apache.org/tomcat/HowTo/FasterStartUp#JAR_scanning. Jboss is utilizing its class loader to check for ServletContextInitializer classes, and in some of the Broadleaf jars we link in at compile time some conditional classes that may not be available at runtime.
Are you using the Spring Boot project based on Broadleaf 5.2.x? You can try adding a web.xml that has an empty <absolute-ordering />: https://www.broadleafcommerce.com/docs/core/current/broadleaf-concepts/key-aspects-and-configuration/app-server-configuration/using-a-web.xml
I would also question the use of Jboss at all. There is almost zero reason to ever use a full-blown JEE application server within a Spring application and frankly, you are asking for more issues as time goes on. You are trying to combine a fat .war (a Spring application built with Maven) with a fat application server (jboss). You should instead pair a fat .war file with a light servlet container (like Tomcat) or a light .war file (a JEE application) with a JEE application server.

Jboss Deployment Failure - ClassNotFoundException

I encountered ClassNotFoundException during deploying a war file to my jboss server. I think it is related to log4j since it returns "Deployment error processing SCI for JAR: log4j-web-2.2.jar" error. However, the web app works properly on apache tomcat on eclipse. I have no idea of how to solve it. Thank you in advance.
Log:
12:32:52,002 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC00001: Failed to start service jboss.deployment.unit."WarTest.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."WarTest.war".INSTALL: Failed to process phase INSTALL of deployment "WarTest.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_91]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_91]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_91]
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: Deployment error processing SCI for JAR: log4j-web-2.2.jar
at org.jboss.as.web.deployment.ServletContainerInitializerDeploymentProcessor.loadSci(ServletContainerInitializerDeploymentProcessor.java:186)
at org.jboss.as.web.deployment.ServletContainerInitializerDeploymentProcessor.deploy(ServletContainerInitializerDeploymentProcessor.java:121)
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: # from [Module "deployment.WarTest.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)
at org.jboss.as.web.deployment.ServletContainerInitializerDeploymentProcessor.loadSci(ServletContainerInitializerDeploymentProcessor.java:183)
... 7 more
From the log it looks like jboss needs a jar in your WAR's WEB-INF/lib - this is what it mean when it says java.lang.ClassNotFoundException: # from [Module "deployment.WarTest.war:main" from Service Module Loader]
There is a detailed discussion here:
https://issues.apache.org/jira/browse/LOG4J2-890
If you're using Jakarta EE 9 or 10, you'll have to upgrade your version of Wildfly to a version that supports Jakarta EE > 9. In my case, I had the stable release of version 26 that supported Jakarta EE 8, and not 9. So I upgraded to the beta version (version 27) of Wildfly that came with support for Jakarta EE >= 9 out of the box. If you can't find the war file, generate it using the maven command mvn -e -U clean install

JBoss EAP 6.4 Jackson module classloading

I made a small project which looks like this
playboss.ear
lib
commonlib.jar
JsonDeserializer.class
testlib.jar
JsonMessage.class
Version.class
jackson-1.9.4.jar
playboss_ejb.jar
MessageTimer.class
JsonMessage has a member: *private Class msgVersion = Version.V0.class;
MessageTimer is just a Bean with a timeout which does nothing but deserializes an example String of JsonMessage using JsonDeserializer.
Everything works fine, i.e. the String is converted to JsonMessage!
Now I add a dependency to my project containing a JAX-RS API and model objects such that lib is extended.
lib
SomeAPI.jar
javax.ws.rs-api-2.0.jar
Now when I start the JBoss EAP 6.4 I get the following exception:
Caused by: java.lang.ClassNotFoundException: playground.testlib.Version$V0 from [Module "org.codehaus.jackson.jackson-mapper-asl:main" from local module loader #9e89d68
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:213) [jboss-modules.jar:1.3.7.Final-redhat-1]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:459) [jboss-modules.jar:1.3.7.Final-redhat-1]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:408) [jboss-modules.jar:1.3.7.Final-redhat-1]
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:389) [jboss-modules.jar:1.3.7.Final-redhat-1]
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:134) [jboss-modules.jar:1.3.7.Final-redhat-1]
at java.lang.Class.forName0(Native Method) [rt.jar:1.8.0_66]
at java.lang.Class.forName(Class.java:264) [rt.jar:1.8.0_66]
at org.codehaus.jackson.map.deser.std.ClassDeserializer.deserialize(ClassDeserializer.java:42) [jackson-mapper-asl-1.9.9.redhat-4.jar:1.9.9.redhat-4]
I figure that due to https://docs.jboss.org/author/display/AS7/Implicit+module+dependencies+for+deployments the jax-rs module dependency is triggered and jackson gets loaded from modules.
My questions:
1) What is the recommended / best way to get my deserialization working again
2) I would like to understand how object mapping is done with jax-rs if the module classloader does obviously not see my model classes.

JBoss&Hibernate

I'm using JBoss AS 7.1 and Hibernate in Eclipse 3.7.2 to build a Dynamic Web Project using Java and JSP. All of the proper JAR files are in the WAR (I checked), but I'm getting this error:
java.lang.ClassNotFoundException: org.hibernate.cfg.EJB3DTDEntityResolver from [Module "deployment.MyProject.war:main" from Service Module Loader]
org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423)
org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
org.hibernate.cfg.Configuration.reset(Configuration.java:326)
org.hibernate.cfg.Configuration.<init>(Configuration.java:265)
org.hibernate.cfg.Configuration.<init>(Configuration.java:269)
my.project.MyManager.<init>(MyManager.java:79)
org.apache.jsp.index_jsp._jspService(index_jsp.java:68)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253)
javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
The relavent line of the manager class is Configuration cfg = new Configuration();. Everything works perfectly in a standalone eclipse project. It only breaks when I try to make a JBoss Page.
Make sure the hibernate-annotations.jar is properly setup in your WAR file. It's probably missing.
So, apparently the problem was trying to include hibernate jars at all. JBoss AS 7.1.1 has hibernate built in. You have to add Dependencies: org.hibernate, org.hibernate.envers to MANIFEST.MF.

java.lang.NoClassDefFoundError in eclipse and tomcat however WAR is working in standalone tomcat

I am trying to deploy maven generated war file into tomcat server in eclipse.. but I get java.lang.NoClassDefFoundError on a jar file. I verified multiple times, jar is in .war and corresponding class file is also available in jar.
I can copy the war from generated location in eclipse and deploy into webapps of tomcat (using the same server as installed server in eclipse) successfully.
I am not sure what else to check in configuration apart from deployment assembly (which has jar listed) and Java Build path ( jar is available in Maven Dependencies). I am using JRE --> Alternate JRE pointing to JDK 1.6
Complete ERROR LOG:
2012-05-24 16:43:09,379 [main] ERROR org.springframework.web.context.ContextLoader - Context initialization failed
java.lang.NoClassDefFoundError: Lcom/att/cso/uss/client/ws/CciClientImpl;
at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(Class.java:2291)
at java.lang.Class.getDeclaredFields(Class.java:1743)
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.findPersistenceMetadata(PersistenceAnnotationBeanPostProcessor.java:373)
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessMergedBeanDefinition(PersistenceAnnotationBeanPostProcessor.java:321)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyMergedBeanDefinitionPostProcessors(AbstractAutowireCapableBeanFactory.java:830)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:493)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:385)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:284)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3972)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4467)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:593)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: java.lang.ClassNotFoundException: com.att.cso.uss.client.ws.CciClientImpl
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1484)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1329)
... 33 more
Please advise.
Using server instance is not same as deploying WAR in tomcat. The servers view integration of tomcat 'hot' deploys the source folder. I suggest you check you Java Build path settings because those are used when you 'deploy' the source project into the server in servers view. How are you creating the war? I am assuming you are using maven for it.. If you are using maven (I have personal dislike for it), it should be managing the dependencies for you. You might have to replicate settings of maven in java or may be use maven plugin for eclipse. [http://www.eclipse.org/m2e/]