<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1276" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=910394307-15012004>Hi!</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=910394307-15012004></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=910394307-15012004>I found out that Jboss class loader doesn't like the
use of the Class.forName in
org.jdom.xpath.XPath.newInstance().</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=910394307-15012004></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=910394307-15012004>To get around this i made a copy of
org.jdom.xpath.JaxenXPath.java and moved it to my own package. I then modified
it and made the class public to be able to instanciate it outside of the
package.</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=910394307-15012004></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=910394307-15012004>I then replaced all calls to XPath.newIstance with a
direct instanciation of my modified class and now it works. </SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=910394307-15012004></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=910394307-15012004>/Johan</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=910394307-15012004></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=910394307-15012004></SPAN></FONT> </DIV><BR>
<BLOCKQUOTE
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> Sanjeev Verma
[mailto:Sanjeev.Verma@Sun.COM] <BR><B>Sent:</B> den 4 november 2003
21:28<BR><B>To:</B> Johan Mörén<BR><B>Cc:</B>
jdom-interest@jdom.org<BR><B>Subject:</B> Re: [jdom-interest] Problems with
Jboss 3.2.1 and 3.2.2<BR></FONT><BR></DIV>
<DIV></DIV>Hi Johan:
<P>I have not worked with JBoss extensively, but trying to add/replace
libraries in the app server installation is never a good idea. What you can
try is package your application such that the library jar files lie inside the
archive. See this link for details on how to do this:
<P>www.onjava.com/pub/a/onjava/2001/06/26/ejb.html
<P>This article provides for a cleaner solution.
<P>Hope this helps.
<P>Best regards
<P>Sanjeev <BR>
<P>Johan Mörén wrote:
<BLOCKQUOTE TYPE="CITE">Hi!
<P>Im trying use the Xpath feature of JDOM B9 in a SessionBean running on a
JBOSS 3.2.2 server but Jboss is having troubles finding the saxpath library
required at runtime.
<P>I have tried with both adding and/or replacing the jdom libraries in
${JBOSS_HOME}/lib and {JBOSS_HOME}/server/default/lib but i always end up
with this exception when initilizing the SessionBean:
<P><trace>
<P>09:47:44,397 ERROR [LogInterceptor] Unexpected Error:
<BR>java.lang.NoClassDefFoundError: org/saxpath/SAXPathException
<BR> at
java.lang.Class.forName0(Native Method)
<BR> at
java.lang.Class.forName(Class.java:140)
<BR> at
org.jdom.xpath.XPath.newInstance(XPath.java:133)
<BR> at
net.spray.se.pravda2.ejb.NewsItemServiceBean.setSessionContext(Unknown
Source) <BR> at
net.spray.se.pravda2.ejb.NewsItemServiceSession.setSessionContext(Unknown
Source) <BR> at
org.jboss.ejb.StatelessSessionEnterpriseContext.<init>(StatelessSessionEnterpriseContext.java:47)
<BR> at
org.jboss.ejb.plugins.StatelessSessionInstancePool.create(StatelessSessionInstancePool.java:35)
<BR> at
org.jboss.ejb.plugins.AbstractInstancePool.get(AbstractInstancePool.java:168)
<BR> at
org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceIntercepto
<BR>r.java:58) <BR> at
org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84)
<BR> at
org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:267)
<BR> at
org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:128)
<BR> at
org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:118)
<BR> at
org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
<BR> at
org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
<BR> at
org.jboss.ejb.StatelessSessionContainer.internalInvoke(StatelessSessionContainer.java:331)
<BR> at
org.jboss.ejb.Container.invoke(Container.java:700)
<BR> at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
<BR> at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
<BR> at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
<BR> at
java.lang.reflect.Method.invoke(Method.java:324)
<BR> at
org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
<BR> at
org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
<BR> at
org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:367)
<BR> at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
<BR> at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
<BR> at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
<BR> at
java.lang.reflect.Method.invoke(Method.java:324)
<BR> at
sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
<BR> at
sun.rmi.transport.Transport$1.run(Transport.java:148)
<BR> at
java.security.AccessController.doPrivileged(Native Method)
<BR> at
sun.rmi.transport.Transport.serviceCall(Transport.java:144)
<BR> at
sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
<BR> at
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
<BR> at
java.lang.Thread.run(Thread.java:536)
<P></trace>
<P>This is the Xpath specific code that runns in the setSessionContext
method. However i dont thing the code is the problem since i can get the
code to compile and run outside Jboss.
<P><code>
<BR>
try
<BR>
{
<BR>
log.debug("Creating XPath instances...");
<BR>
xpStartDate = XPath.newInstance("/sprayNewsItem/header/startDate");
<BR>
xpEndDate = XPath.newInstance("/sprayNewsItem/header/endDate");
<BR>
xpProvider = XPath.newInstance("/sprayNewsItem/header/provider");
<BR>
xpPhase = XPath.newInstance("/sprayNewsItem/header/phase");
<BR>
xpPriority = XPath.newInstance("/sprayNewsItem/header/priority");
<BR>
xpCategory = XPath.newInstance("/sprayNewsItem/header/category");
<BR>
xpSubCategory =
<BR>
XPath.newInstance("/sprayNewsItem/header/subCategory");
<BR>
log.debug("Created XPath instances");
<BR>
}
<BR>
catch (Exception e)
<BR>
{
<BR>
log.error("Failed to create XPath instances" + e);
<BR>
throw new RemoteException("Failed to create XPath instances, " + e);
<BR>
} <BR></code>
<P>Does anyone of you had similar troubles? And perhaps found a soloution
and/or an explanation?
<P>Regards, <BR>Johan Mrn <BR> <BR> <BR>
<P>_____________________________________________________s_p_r_a_y__
<P>Johan Mrn | Systems developer <BR>Spray Network AB Box 5169 SE-102 44
Stockholm Sweden <BR>johan.moren@staff.spray.se | Phone: +46-(0)8-410 90 000
<P><A href="http://www.spray.se">http://www.spray.se</A> - nu r det lttare
att umgs <BR>
<P>"It gets harder the more you know. Because the more you know the uglier
everything seems" - Frank Zappa <BR>
<P>_______________________________________________ <BR>To control your
jdom-interest membership: <BR><A
href="http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com">http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com</A></P></BLOCKQUOTE><PRE>--
Best Regards
Sanjeev Verma
Sun ONE App Server Migration Consultant
Web Services, Tools and Migration Tools
Market Development Engineering</PRE> </BLOCKQUOTE></BODY></HTML>