at work we're in the process of migrating from jboss 7 to 8 (wildfly/undertow) and i've had trouble starting the server when "JRebel agent" is enabled (v5.5.2). i get tons of WARN msgs like this:
15:08:21,372 WARN [org.jboss.modules] (MSC service thread 1-8) Failed to define class net.sourceforge.barbecue.BarcodePortlet in Module "deployment.myApp.ear:main" from Service Module Loader: java.lang.LinkageError: Failed to link net/sourceforge/barbecue/BarcodePortlet (Module "deployment.myApp.ear:main" from Service Module Loader)
...
Caused by: java.lang.NoClassDefFoundError: javax/portlet/GenericPortlet
...
Caused by: java.lang.ClassNotFoundException: javax.portlet.GenericPortlet from [Module "deployment.takecargo.ear:main" from Service Module Loader]
HOW TO DEBUG
using the above WARN as an example, open a java file in your project and write something like this:
BarcodePortlet a = null;
save
ctrl+shift+o
if it resolves (adds an import line), then you have a library somewhere in your project that has that class file.
put the cursor on the class name, BarcodePortlet, then hit f3 to find the jar library, e.g.:
barbecue-1.5-alpha2.jar
in eclipse project settings:
"Java Build Path" > "Libraries" (tab) > select "barbecue-1.5-alpha2.jar" and hit "Remove" > "OK"
if you get errors in the "Markers" tab, under "Java Problems", then you need the library.
if you don't get any errors, then search your project in *.java and *.xml files to see if the class or package is referenced there. if you still don't find anything then you *probably* don't need it and can delete it from your project.
in my case, some classes were using "barbecue-1.5-alpha2.jar", so then we look at the next related stack trace element in the output console in eclipse:
Caused by: java.lang.NoClassDefFoundError: javax/portlet/GenericPortlet
there wasn't any module in the jboss wildfly modules folders for "javax/portlet":
<wildfly-8.0.0.Final>/modules/system/layers/base/javax
so i needed to find a jar library, by googling, that has the class "javax.portlet.GenericPortlet", e.g. here:
http://mirrors.ibiblio.org/pub/mirrors/maven2/javax/portlet/portlet-api/2.0/portlet-api-2.0.jar
i added "portlet-api-2.0.jar" to my eclipse project's "lib" folder (or wherever you place your jars to be bundled in your ear)
refreshed the "lib" folder in eclipse
added the jar to the "Libraries" tab:
"Java Build Path" > "Libraries" (tab) > "Add JARs..." > selected "portlet-api-2.0.jar" from the "lib" folder > "OK"
the project rebuilds automatically and no errors occurred from adding the jar, so we're good.
if you rebuild your project and start up wildfly, then that "WARN" should be gone from the output.
IT, computer and programming tutorials and tips that i couldnt find anywhere else using google, from my daily work as a Senior Developer of solutions using Java and Linux.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment