JBoss cannot find class for javax.management.DynamicMBean - jboss

I am currently in the process of rearranging application jars so that my application can run smoothly on Websphere as well as JBoss with minimal changes.
With Webshpere's hierarchical class loading, everything works fine. But JBoss is creating lots of issues with its modular loading, with exceptions like -
java.lang.ClassNotFoundException: "javax.management.DynamicMBean" from [Module from local module loader
Since this class is part of JDK 6, should JBoss not pick it up automatically? Does anyone know any solution to this?
I am using JBoss AS 7.3 with JDK 6

Solved this by adding a dependency on javax.api in module.xml for one of my custom jboss modules.

Related

How can I load Java EE application dependency from WildFly modules

I am migrating my JBoss from 4.0.5 to WildFly 9.0.2 release, and my application has some dependency from JRE/lib/rt.jar, but when I deploy that application on WildFly, application gives error like ClassNotFoundException. If I add rt.jar as dependency in lib directory then application works.
So does anyone knows how to overcome from this problem.
Eg.
javax.xml.parsers.SAXParser.class which is available in rt.jar.

debugging classpath - how to?

I have a class path problem and would like to know how approach debugging.
The problem is
java.lang.ClassNotFoundException: org.springframework.http.client.AbstractBufferingClientHttpRequest
but I understand AbstractBufferingClientHttpRequest is in spring-web (http://forum.springsource.org/showthread.php?110684-Where-can-I-download-AbstractBufferingClientHttpRequest-jar), which I do have via maven - I see spring-web-3.0.6.RELEASE.jar in the tomcat web-inf/lib directory.
Dont understand why the class is not found, or worse, how to track the problem down.
Google found the process of getting and unpacking the classpath, using java.lang.System.getProperty("java.class.path"); But this does not include anything that maven has pulled in.
What are my debugging options? Where can I learn more about debugging classpath problems?
The environment includes: MyEclipse for Spring 10, Spring Webflow app, tomcat server, maven, Ubuntu OS.

jBPM and JBoss web app

Ok I'm having quite some issues setting both jbpm and jboss working together...something as simple as running the jbpm process from a servlet is trunning to be a pain and all because jBoss can't find classes.
I made a Dynamic Web Project and didn't use Maven project so things are cleaner...and because it should work.
I just want to load a jbpmn2.0 from the repository in a servlet and run it using a WorkItemHanlder....but I get this:
java.lang.ClassNotFoundException: org.drools.runtime.process.WorkItemHandler
For some reason jBoss can't find a class from jBPM that should work on JBoss. What I did....and I think it's not the right solution...was add the knowledge-api.jar to the WEB-INF/lib. Although I can now deploy the app when I try to run it I get:
Error Unable to instantiate service for Class 'org.drools.builder.KnowledgeBuilderFactoryService'
I Honestly don't get why is it so hard to make a Jboss Web app using jBpm.
You need to make sure all dependencies are on your classpath, this is the same for all Java applications (not just jbpm) and application servers (not just JBossAS).
Which jars did you add? Depending on which features you are using, there could be quite a number of jars that you need to add. One option would for example would be to extract the jars in the jBPM runtime zip that is part of the jBPM downloads into your WEB-INF/lib.
If you use Maven, you would be able to automatically derive all required jars.
Kris

JBoss Seam Project errors

I have a JBoss Seam project that a coworker created about a year ago. I'm taking over it now and it needs some work done. So I'm trying to setup the project in Eclipse Indigo. Here is the list of things I have installed so far:
JBoss 4.2.2 GA
JBoss Seam 2.2.0 GA
Glassfish v2.1
JBoss Seam Tools Plugin for Eclipse Indigo
For some reason I am not able to build the project to get an ear for JBoss. The errors I have are one in glassfish-builld.xml which says "Target clean does not exist in this project." And then I have errors in a bunch of generic.jsp file (I have no idea what their purpose is). The error for those is that a library for JBoss Seam called org.jboss.seam.wiki.util.WikiUtil cannot be found.
Can someone point me in the right direction to get this setup and running on JBoss?
Also org.jboss.seam.wiki.util.WikiUtil is a class that is a part of... Seam example project that is added to JBoss Seam distribution in examples/wiki directory. So if you really need it you will be able to find it there. But honestly I don't see any reason to put any dependency to Seam examples in project. Consider just deleting / commening out the code that refers to this class becasue it is probably some quick and dirty test code.
Do you want to run it on Glassfish or Jboss?
Did you import an entire eclipse project or create a new one?
I would first check the referenced libraries to see if there's anything missing(Libraries under Java Build Path for Helios, not sure if that differs from Indigo). Add a -verbose tag to the build and check out the output.

Deploy vaadin to JBoss 7.0 gives me a ClassNotFoundException

I've created a new Vaadin (6.6.5) project in eclipse and I've tried to deploy it on JBoss 7.0 but it gives me a GWT ClassNotFoundException
Caused by: java.lang.ClassNotFoundException: com.google.gwt.user.client.ui.HasWidgets from [Module "deployment.test.war:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:191)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:358)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:330)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:330)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:307)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:101)
... 64 more
Do I need to do something extra to deploy the gwt libraries?
Seems that some GWT classes in gwt-user.jar required for compiling the Vaadin client side widgetset are loaded by the JBoss7 unnecessarily.
vaadin.jar contains references to gwt-user.jar but it's not required during runtime, only during widgetset compilation time. Still JBoss wants to load these classes causing the problem.
There's a bug report in JBoss for this: http://community.jboss.org/thread/169575?tstart=0
As mentioned there, workaround is to include gwt-user.jar to the deployment package in WEB-INF/lib folder with the vaadin.jar, seems to work.
Vaadin Eclipse plugin creates library dependencies to gwt jar files and generally Eclipse should take care of the runtime classpath when deploying.
As the package name com.google.gwt.user.client suggest this should be in gwt-user.jar.
The gwt-dev.jar should only be needed when compiling client-side code with GWT.
Are you using add-ons? Add-ons (and their dependencies) should be always added to WEB-INF/lib to make the server-side classes available to the application and client-side code available to the GWT compiler.
On possible cause of the problem is (unnecessary) dependency to client-side class which is not available in the server at runtime. So, you might also check your code for unnecessary server-side dependencies to client-side GWT classes (like HasWidgets).
Check your code to ensure that you do not accidentally access this com.google.gwt.** class from your code. As said above, there is no need to deploy gwt libraries in the server.
Vaadin has now published an add-on to fix this, see https://vaadin.com/directory#!addon/vaadin-application-server-class-loader-workaround