-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Confiuration fails to find mapping files jar
PostPosted: Thu Mar 11, 2004 3:20 pm 
Beginner
Beginner

Joined: Mon Feb 09, 2004 3:06 pm
Posts: 26
Location: Tampa, FL
I am specifiying my mapping file using the <mapping jar="hibdefs.jar"> element in the my hibernate.cfg.xml file. When I initialize hibernate from within a session bean (packaged in an ear, deployed on JBoss 3.2.3), hibernate can't find the jar file. I've included the jar in the manifest's class-path and made sure it was packaged in the ear, but it still can't be found.

Using Hibernate 2.1.2 . Here's a snip of the stack trace

2004-03-11 14:17:05,978 DEBUG [net.sf.hibernate.cfg.Configuration] java:comp/env/hibernate/OraSessionFactory<-org.dom4j.tree.DefaultAttribute@18665a0 [Attribute: name jar value "/hibdefs.jar"]
2004-03-11 14:17:28,291 ERROR [org.arbfile.ejb.webrpt.sb.SBWebRptRequestBean] java.lang.NullPointerException
java.lang.NullPointerException
at net.sf.hibernate.cfg.Configuration.addJar(Configuration.java:346)
at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:981)
at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:928)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:871)
at org.arbfile.util.hibernate.util.HibernateLoader.getSessionFactory(HibernateLoader.java:70)
at org.arbfile.util.hibernate.util.HibernateLoader.getSession(HibernateLoader.java:56)
at org.arbfile.ejb.webrpt.sb.SBWebRptRequestBean.addWebRptRequest(SBWebRptRequestBean.java:154)
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.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:683)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:185)
at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:72)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:320)
at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:128)
at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:118)

_________________
Bill Pfeiffer


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 12, 2004 5:28 am 
Beginner
Beginner

Joined: Wed Feb 11, 2004 6:08 am
Posts: 29
Location: Germany
where is your hibernate.jar located ? I dont know JBoss very well, but I know about class loader hierarchies:

If your hibernate.jar is in your server root classpath, then your hibdefs.jar must be on the same classpath (or on a classpath up in the class loader hierarchy), because hibernate.jar attempts to load classes from hibdefs.jar. maybee this helps...


Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 14, 2004 5:42 pm 
Newbie

Joined: Mon Nov 10, 2003 9:07 am
Posts: 5
It appears the location of the JAR file specified the <mapping> tag needs to be relative to the location of the hibernate.cfg.xml file. In my case, the hibernate.cfg.xml config file is located in WEB-INF/classes, so I have the following statement in my hibernate.cfg.xml:

Code:
<mapping jar="../lib/hibernate-mappings.jar"/>


This seems to work in both Tomcat (4.1.30) and Resin (3.0.6).

HTH,

Phil..


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 15, 2004 6:13 pm 
Beginner
Beginner

Joined: Mon Feb 09, 2004 3:06 pm
Posts: 26
Location: Tampa, FL
My hibernate2 jar and my hibdefs.jar are both in the root of my ear file just as are all other jar to be used by my EJB's. The ejb jar manifest lists all of these, including the hibdefs jar. I just tested using the following from within a SessionBean:

HibernateLoader.class.getResource("/hibdefs.jar");

HibernateLoader is a class I wrote. This finds the jar just fine.

The code in the hibernate Configuration class:

Thread.currentThread().getContextClassLoader().getResource(resource)

where resource = "/hibdefs.jar", returns null.

I included the same code in my Session bean and it returns null there as well.

Is this some weird app server classloading thing?

_________________
Bill Pfeiffer


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.