Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Class from rt.jar not found

In JBOSS EAP 6 (AS 7):

I am making a call to Spring's WebServiceTemplate.marshalSendAndRecieve which in turn is having trouble finding a class that exisits in rt.jar

Caused by: java.lang.ClassNotFoundException: com.sun.org.apache.xerces.internal.dom.DocumentImpl

I do not understand how this can happen? Surely everything that is in rt.jar gets loaded up on startup?

Any ideas?

Thanks,

Kenny

like image 419
km2000 Avatar asked Mar 28 '13 14:03

km2000


1 Answers

Ok I found a solution (not sure if its the correct way, but it works).

I noticed by running java -verbose:class that only some of the classes in rt.jar were loaded and not the one I needed (com.sun.org.apache.xerces.internal.dom.DocumentImpl)

So in JBoss EAP 6 (As 7) there is a modules directory ($JBOSS_HOME/modules/) And under here there is sun/jdk/main/modules.xml

I added the following entries:

<path name="com/sun/org/apache/xerces/internal/dom"/>
<path name="com/sun/org/apache/xerces/internal/xni"/>
<path name="com/sun/org/apache/xerces/internal/jaxp"/>

(last 2 becuase of subsequent class not found exceptions after adding in dom)

As I said I'm not 100% sure if this is the correct way to do this. Any input is welcome!

Thanks,

Kenny

like image 83
km2000 Avatar answered Sep 30 '22 15:09

km2000