Using JBoss AS 7.1.1 I want to get code coverage after testing of my project, deployed as an .war.
It seemingly works as expected until the point where I am starting the server. Here is the error message:
13:20:49,571 SEVERE [net.sourceforge.cobertura.coveragedata.TouchCollector] (MSC service thread 1-8) Exception when registering class: com/project/Creator: java.lang.ClassNotFoundException: com.project.Creator from [Module "org.jboss.as.server:main" from local module loader #30c01f1c (roots: C:\Jboss\jboss-as-7.1.1.Final\modules)]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190) [jboss-modules.jar:1.1.1.GA]
at
An important part may be that without using --auxClasspath argument, I did get errors instrumenting this class because of dependencies. This should be fixed by the mentioned argument though.
Edit:
There are in two situations where I get problems.
During instrumentation, using the following command for instrumentation
C:\cobertura\cobertura-2.0.3\cobertura-instrument.bat" --basedir C:\Jboss\jboss-as-7.1.1.Final\standalone\deployments project.war --datafile C:\Jboss\jboss-as-7.1.1.Final\bin\cobertura.ser --auxClasspath ""C:\workspace\jboss-build\src\com\arbitrage\j2ee\common\dto\TypeData.java
which gives me the error
java.lang.RuntimeException: java.lang.ClassNotFoundException: com.arbitrage.j2ee.common.dto.TypeData
at net.sourceforge.cobertura.instrument.CoberturaClassWriter.getCommonSuperClass(CoberturaClassWriter.java:35)
But, when I start up JBoss, it does so without giving any errors.
However, when I stop JBoss I get this error:
ERROR [stderr] Exception in thread "Thread-45" java.lang.NoClassDefFoundError: net/sourceforge/cobertura/coveragedata/TouchCollector$ApplyToClassDataLightClassmapListener
In the second case instrumentation goes well with the following command
C:\cobertura\cobertura-2.0.3\cobertura-instrument.bat" addInstrumentationToArchive C:\Jboss\jboss-as-7.1.1.Final\standalone\deployments\screator.war --includeClasses "com.project.*" --datafile C:\Jboss\jboss-as-7.1.1.Final\bin\cobertura.ser --auxClasspath "C:.m2\repository\com\project\1\project-1.jar
Which gives me an OK
INFO: Cobertura: Saved information on 41 classes.
Now the problem occurs when starting up JBoss
SEVERE net.sourceforge.cobertura.coveragedata.TouchCollector Exception when registering class: com/project/Creator: java.lang.ClassNotFoundException: com.project.Creator from [Module "org.jboss.as.server:main" from local module loader #30c01f1 (roots: C:\Jboss\jboss-as-7.1.1.Final\modules)].
etc etc.
I have added -Djboss.shutdown.forceHalt=false to the VM arguments.
Help is much appreciated,
Thanks!
Related
I am trying to deploy my legacy application in web-logic 12c but problem is every time its showing exception like > "ClassNotFoundException: org.objectweb.asm.ClassVisitor,Basically this issue comes if application not have asm.jar but in my application asm.jar is there and moreover my application successfully deployed in web-logic 11
After lot of research i found below document in that they are saying WebLogic 12.2.1 infra to WebLogic 12.2.1.3 infra, the class org.objectweb.asm.ClassVisitorbelow can NOT be found when starting the server with customer's application deployed. Please some one guide me how can i resolve this issue
Document
https://support.oracle.com/knowledge/Middleware/2526226_1.html#FIX
Deployment issue
<Dec 6, 2019 5:58:46,064 AM GMT> <Error> <HTTP> <WL-101216> <Servlet: "JerseyRESTService" failed to preload on startup in Web application: "CDMWeb.war".
A MultiException has 1 exceptions. They are:
1. java.lang.NoClassDefFoundError: org/objectweb/asm/ClassVisitor
at org.jvnet.hk2.internal.Utilities.justCreate(Utilities.java:1085)
at org.jvnet.hk2.internal.ServiceLocatorImpl.create(ServiceLocatorImpl.java:978)
at org.jvnet.hk2.internal.ServiceLocatorImpl.createAndInitialize(ServiceLocatorImpl.java:1082)
at org.jvnet.hk2.internal.ServiceLocatorImpl.createAndInitialize(ServiceLocatorImpl.java:1074)
at org.glassfish.jersey.server.ApplicationHandler.createApplication(ApplicationHandler.java:385)
Truncated. see log file for complete stacktrace
Caused By: java.lang.NoClassDefFoundError: org/objectweb/asm/ClassVisitor
at com.sun.jersey.api.core.ScanningResourceConfig.init(ScanningResourceConfig.java:79)
at com.sun.jersey.api.core.PackagesResourceConfig.init(PackagesResourceConfig.java:104)
at com.sun.jersey.api.core.PackagesResourceConfig.<init>(PackagesResourceConfig.java:78)
at com.verizon.application.Application.<init>(Application.java:12)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
Truncated. see log file for complete stacktrace
Caused By: java.lang.ClassNotFoundException: org.objectweb.asm.ClassVisitor
at com.oracle.classloader.PolicyClassLoader.findClass(PolicyClassLoader.java:398)
at com.oracle.classloader.PolicyClassLoader.loadClass(PolicyClassLoader.java:371)
at com.oracle.classloader.weblogic.LaunchClassLoader.loadClass(LaunchClassLoader.java:55)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at com.sun.jersey.api.core.ScanningResourceConfig.init(ScanningResourceConfig.java:79)
Truncated. see log file for complete stacktrace
>
You can try adding the asm.jar to your Applications's WEB-INF/lib directory. From the error it's clear that JVM not able to locate the class, hence java.lang.ClassNotFoundException
Getting a classNotFound exception on Wildfly 10.0.
Caused by: java.lang.ClassNotFoundException: org.jboss.security.SecurityAssociation from [Module "deployment.employee-app-1.2.1.ear.authorization-service-login-modules-jboss-1.1.2.jar:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:198)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:363)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:351)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:93)
... 36 more
I tried adding the jbosssx jar to my ear but still getting the classNotFound issue. Is it possible to add jar to a dir within Wildfly?
thanks
I couldn't find the exact point in time it happened but org.jboss.security.SecurityAssociation was renamed org.jboss.security.SecurityContextAssociation. Therefore by changing your references to org.jboss.security.SecurityAssociation in authorization-service-login-modules-jboss, you should be good to go.
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver from [Module "deployment.Sample.war:main" from Service Module Loader].
The above one is my error message.
I have included mysql-connector-java-5.1.35-bin.jar in my class path and it is shown in the libraries as well.
I am using JBoss AS 7.1.0.Final server to run it. How to resolve this error?
We have a bunch of "identical" CentOS 6.2 servers (in terms of Java version, OS version, JBoss AS7 7.1, version of our app's war file) where most of them are now failing when creating a javax.xml.ws.Service. One of them is still working and the same JBoss AS7 and war files work locally on our developer machines (Macs). The service exists, its wsdl location URL and service name are the same on the working box and the non-working one.
I've diff'd the entire JBoss AS7 directory which includes all of the JBoss libraries, scripts, configs and our war between the working machine and a non-working one. The only diffs I see are related to the IP addresses of the machine itself.
Here's the cause of the stack trace we're seeing with a few lines omitted:
...a lot of stuff omitted...
Caused by: java.lang.NoClassDefFoundError: org/jboss/xb/binding/ObjectModelFactory
at org.jboss.ws.core.jaxws.spi.ServiceDelegateImpl.<init>(ServiceDelegateImpl.java:137) [jbossws-native-core-3.1.1.GA.jar:3.1.1.GA]
at org.jboss.ws.core.jaxws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:63) [jbossws-native-core-3.1.1.GA.jar:3.1.1.GA]
at javax.xml.ws.Service.<init>(Service.java:57) [jboss-jaxws-api_2.2_spec-2.0.0.Final.jar:2.0.0.Final]
at schemas.dynamics.microsoft.nav.system.SystemService.<init>(SystemService.java:41) [navisionws-1001.0-SNAPSHOT.jar:]
...our code omitted...
... 79 more
Caused by: java.lang.ClassNotFoundException: org.jboss.xb.binding.ObjectModelFactory from [Module "deployment.arinweb_public-1001.0-SNAPSHOT.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.performLoadClassChecked(ConcurrentClassLoader.java:423)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
... 86 more
We've tried a bunch of things including:
Moving the entire jboss directory from the non-working machine to the working machine where it starts to work.
Doing the opposite of #1 where the jboss that worked on one machine no longer works on the non-working machine.
Compared all environment variables on the two machines and they match.
I'd like suggestions on what to try next to figure out what the problem is. Either that or the solution would be great.
EDIT - classloading problems while JBoss is starting deployment:
We're getting some classloading issues while JBoss starts deployment of each app. I've compared these warnings between the working machine and the non-working one and they are the same. Here's an example (there are 37 of the first warning type and 55 of the second on both servers):
18:20:04,352 WARN [org.jboss.as.server.deployment] (MSC service thread 1-2) JBAS015893: Encountered invalid class name 'implementingClassName=org.jboss.shrinkwrap.impl.base.ConfigurableArchiveImpl' for service type 'org.jboss.shrinkwrap.spi.Configurable'
16:34:16,370 WARN [org.jboss.as.server.deployment] (MSC service thread 1-40) Class Path entry shrinkwrap-resolver-impl-maven-1.0.0-beta-6.jar in "/content/snipped_war_name.war/WEB-INF/lib/snipped_jar_name.jar" does not point to a valid jar for a Class-Path reference.
Thank you all for the suggestions. After a lot of debugging, we found the issue and I'll post the details here for the one-in-a-million chance someone has the same issue:
These jars we package in our wars were the culprit:
jbossws-native-core-3.1.1.GA.jar
jbossws-native-jaxws-3.1.1.GA.jar
jbossws-native-saaj-3.1.1.GA.jar
jbossws-native-jaxrpc-3.1.1.GA.jar
jbossws-native-jaxws-ext-3.1.1.GA.jar
JBoss AS 7 packages its own version which is newer than the one we were packaging. Once we removed these jars from our wars and bounced the server, the problem seems to go away.
Our long term solution to remove these dependencies was to upgrade JBoss web services from 3.1.1.GA to 4.0.1.GA which is CXF based. This involved a bunch of code changes but allowed us to remove the bad dependencies.
I am running a grails test run-app all day with my application and it is fine. I type "grails prod war" to get a war, and dump it in the webapps folder of my tomcat install. Now i get the message like so:
11.11.2010 16:35:11 *ERROR* GrailsExceptionResolver: Executing action [index] of controller [ResumeController] caused e
xception: java.lang.NoClassDefFoundError: Could not initialize class org.docx4j.jaxb.Context (GrailsExceptionResolver.ja
va, line 72)
org.codehaus.groovy.grails.web.servlet.mvc.exceptions.ControllerExecutionException: Executing action [index] of controll
er [ResumeController] caused exception: java.lang.NoClassDefFoundError: Could not initialize class org.docx4j.jaxb.Cont
ext
at org.jsecurity.web.servlet.JSecurityFilter.doFilterInternal(JSecurityFilter.java:382)
at org.jsecurity.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:180)
at java.lang.Thread.run(Unknown Source)
Caused by: org.codehaus.groovy.runtime.InvokerInvocationException: java.lang.NoClassDefFoundError: Could not initialize
class org.docx4j.jaxb.Context
... 3 more
Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.docx4j.jaxb.Context
at org.docx4j.openpackaging.contenttype.ContentTypeManager.parseContentTypesFile(ContentTypeManager.java:599)
at org.docx4j.openpackaging.io.LoadFromZipNG.process(LoadFromZipNG.java:199)
at org.docx4j.openpackaging.io.LoadFromZipNG.get(LoadFromZipNG.java:188)
at org.docx4j.openpackaging.packages.OpcPackage.load(OpcPackage.java:188)
at org.docx4j.openpackaging.packages.WordprocessingMLPackage.load(WordprocessingMLPackage.java:169)
at com.iai.skillsdb.DocxHelpers.DocxParser.openDocx4j(DocxParser.java:70)
at ResumeController$_closure8.doCall(ResumeController.groovy:164)
at ResumeController$_closure8.doCall(ResumeController.groovy)
at ResumeController.invokeMethod(ResumeController.groovy)
at ResumeController$_closure1.doCall(ResumeController.groovy:41)
at ResumeController$_closure1.doCall(ResumeController.groovy)
... 3 more
What is causing this? I have the docx4j jar in my WAR for sure, and it is there in the web-inf lib folder as well.
You're getting a java.lang.NoClassDefFoundError, not a java.lang.ClassNotFoundException. The class is being loaded, but a class that it depends on (directly or indirectly via another class) isn't there. You're most likely missing a jar that docx4j requires as a dependency.
Make sure that you have the correct version of docx4j and that there is absolutely no other version of docx4j in your classpath, there may be a version of this lib that did not have the 'Content' class implemented.