[jdom-interest] Problems with Jboss 3.2.1 and 3.2.2

Johan Mörén Johan.Moren at staff.spray.se
Thu Jan 15 00:21:42 PST 2004


Hi!
 
I found out that Jboss class loader doesn't like the use of the Class.forName in org.jdom.xpath.XPath.newInstance().
 
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.
 
I then replaced all calls to XPath.newIstance with a direct instanciation of my modified class and now it works. 
 
/Johan
 
 


  _____  

	From: Sanjeev Verma [mailto:Sanjeev.Verma at Sun.COM] 
	Sent: den 4 november 2003 21:28
	To: Johan Mörén
	Cc: jdom-interest at jdom.org
	Subject: Re: [jdom-interest] Problems with Jboss 3.2.1 and 3.2.2
	
	
	Hi Johan: 

	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: 

	www.onjava.com/pub/a/onjava/2001/06/26/ejb.html 

	This article provides for a cleaner solution. 

	Hope this helps. 

	Best regards 

	Sanjeev 
	  

	Johan Mörén wrote: 

		Hi! 

		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. 

		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: 

		<trace> 

		09:47:44,397 ERROR [LogInterceptor] Unexpected Error: 
		java.lang.NoClassDefFoundError: org/saxpath/SAXPathException 
		        at java.lang.Class.forName0(Native Method) 
		        at java.lang.Class.forName(Class.java:140) 
		        at org.jdom.xpath.XPath.newInstance(XPath.java:133) 
		        at net.spray.se.pravda2.ejb.NewsItemServiceBean.setSessionContext(Unknown Source) 
		        at net.spray.se.pravda2.ejb.NewsItemServiceSession.setSessionContext(Unknown Source) 
		        at org.jboss.ejb.StatelessSessionEnterpriseContext.<init>(StatelessSessionEnterpriseContext.java:47) 
		        at org.jboss.ejb.plugins.StatelessSessionInstancePool.create(StatelessSessionInstancePool.java:35) 
		        at org.jboss.ejb.plugins.AbstractInstancePool.get(AbstractInstancePool.java:168) 
		        at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceIntercepto 
		r.java:58) 
		        at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84) 
		        at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:267) 
		        at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:128) 
		        at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:118) 
		        at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191) 
		        at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122) 
		        at org.jboss.ejb.StatelessSessionContainer.internalInvoke(StatelessSessionContainer.java:331) 
		        at org.jboss.ejb.Container.invoke(Container.java:700) 
		        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
		        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
		        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
		        at java.lang.reflect.Method.invoke(Method.java:324) 
		        at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284) 
		        at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546) 
		        at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:367) 
		        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
		        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
		        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
		        at java.lang.reflect.Method.invoke(Method.java:324) 
		        at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261) 
		        at sun.rmi.transport.Transport$1.run(Transport.java:148) 
		        at java.security.AccessController.doPrivileged(Native Method) 
		        at sun.rmi.transport.Transport.serviceCall(Transport.java:144) 
		        at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460) 
		        at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701) 
		        at java.lang.Thread.run(Thread.java:536) 

		</trace> 

		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. 

		<code> 
		                try 
		                { 
		                        log.debug("Creating XPath instances..."); 
		                        xpStartDate = XPath.newInstance("/sprayNewsItem/header/startDate"); 
		                        xpEndDate = XPath.newInstance("/sprayNewsItem/header/endDate"); 
		                        xpProvider = XPath.newInstance("/sprayNewsItem/header/provider"); 
		                        xpPhase = XPath.newInstance("/sprayNewsItem/header/phase"); 
		                        xpPriority = XPath.newInstance("/sprayNewsItem/header/priority"); 
		                        xpCategory = XPath.newInstance("/sprayNewsItem/header/category"); 
		                        xpSubCategory = 
		                                XPath.newInstance("/sprayNewsItem/header/subCategory"); 
		                        log.debug("Created XPath instances"); 
		                } 
		                catch (Exception e) 
		                { 
		                        log.error("Failed to create XPath instances" + e); 
		                        throw new RemoteException("Failed to create XPath instances, " + e); 
		                } 
		</code> 

		Does anyone of you had similar troubles? And perhaps found a soloution and/or an explanation? 

		Regards, 
		Johan Mrn 
		  
		  
		  

		_____________________________________________________s_p_r_a_y__ 

		Johan Mrn | Systems developer 
		Spray Network AB Box 5169 SE-102 44 Stockholm Sweden 
		johan.moren at staff.spray.se | Phone: +46-(0)8-410 90 000 

		http://www.spray.se - nu r det lttare att umgs 
		  

		"It gets harder the more you know. Because the more you know the uglier everything seems" - Frank Zappa 
		  

		_______________________________________________ 
		To control your jdom-interest membership: 
		http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com

	-- 
	Best Regards
	
	Sanjeev Verma
	Sun ONE App Server Migration Consultant
	Web Services, Tools and Migration Tools
	Market Development Engineering
	  

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://jdom.org/pipermail/jdom-interest/attachments/20040115/1dc0a8eb/attachment.htm


More information about the jdom-interest mailing list