I'm using JBuilder 8 and the version of Tomcat it comes with: 4.1.12, which could use updating, but hey.
I've declared in JBuilder "Library" definitions for each of the Hibernate Distributions. They are below. I've trimmed some out of the Hibernate 2.1.2 definition to rule out things, but I think you'll see there aren't mismatches. When I switch between these hibernate libraries, I do a Make Clean, I make absolutely certain my .war file is gone, I recompile and go from there. It's *real* consistent. In fact, when it has worked when I didn't expect it to (or vice versa), I inevitably double check to find it was my mistake in the rebuild/restart process. My theory right now is something in commons struts uses isn't the same rev as what Hibernate does. Library defs follow: For 2.0.3- <?xml version="1.0" encoding="UTF-8"?> <library> <!--JBuilder Library Definition File--> <fullname>Hibernate 2.0.3</fullname> <class> <path>[../../javalibs/hibernate-2.0.3/lib/ant.jar]</path> <path>[../../javalibs/hibernate-2.0.3/lib/cglib-asm.jar]</path> <path>[../../javalibs/hibernate-2.0.3/lib/commons-beanutils.jar]</path> <path>[../../javalibs/hibernate-2.0.3/lib/commons-collections.jar]</path > <path>[../../javalibs/hibernate-2.0.3/lib/commons-dbcp.jar]</path> <path>[../../javalibs/hibernate-2.0.3/lib/commons-lang.jar]</path> <path>[../../javalibs/hibernate-2.0.3/lib/commons-logging.jar]</path> <path>[../../javalibs/hibernate-2.0.3/lib/commons-pool.jar]</path> <path>[../../javalibs/hibernate-2.0.3/lib/connector.jar]</path> <path>[../../javalibs/hibernate-2.0.3/lib/dom4j.jar]</path> <path>[../../javalibs/hibernate-2.0.3/lib/jaas.jar]</path> <path>[../../javalibs/hibernate-2.0.3/lib/jcs.jar]</path> <path>[../../javalibs/hibernate-2.0.3/lib/jdbc2_0-stdext.jar]</path> <path>[../../javalibs/hibernate-2.0.3/lib/jta.jar]</path> <path>[../../javalibs/hibernate-2.0.3/lib/junit.jar]</path> <path>[../../javalibs/hibernate-2.0.3/lib/odmg.jar]</path> <path>[../../javalibs/hibernate-2.0.3/lib/optional.jar]</path> <path>[../../javalibs/hibernate-2.0.3/lib/proxool.jar]</path> <path>[../../javalibs/hibernate-2.0.3/lib/xalan.jar]</path> <path>[../../javalibs/hibernate-2.0.3/lib/xerces.jar]</path> <path>[../../javalibs/hibernate-2.0.3/lib/xml-apis.jar]</path> <path>[../../javalibs/hibernate-2.0.3/hibernate2.jar]</path> <path>[../../javalibs/hibernate-extensions/tools/hibernate-tools.jar]</p ath> <path>[../../javalibs/hibernate-extensions/tools/lib/jdom.jar]</path> </class> <source> <path>../../javalibs/hibernate-2.0.3/src</path> </source> <documentation> <path>../../javalibs/hibernate-2.0.3/doc</path> </documentation> </library> For 2.1.2 <?xml version="1.0" encoding="UTF-8"?> <library> <!--JBuilder Library Definition File--> <fullname>Hibernate 2.1</fullname> <class> <path>[../../javalibs/hibernate-2.1/lib/xml-apis.jar]</path> <path>[../../javalibs/hibernate-2.1/lib/dom4j-1.4.jar]</path> <path>[../../javalibs/hibernate-2.1/lib/xerces-2.4.0.jar]</path> <path>[../../javalibs/hibernate-2.1/lib/concurrent-1.3.2.jar]</path> <path>[../../javalibs/hibernate-2.1/lib/cglib-2.0.jar]</path> <path>[../../javalibs/hibernate-2.1/lib/jdbc2_0-stdext.jar]</path> <path>[../../javalibs/hibernate-2.1/lib/commons-lang-1.0.1.jar]</path> <path>[../../javalibs/hibernate-2.1/lib/xalan-2.4.0.jar]</path> <path>[../../javalibs/hibernate-2.1/lib/ehcache-0.6.jar]</path> <path>[../../javalibs/hibernate-2.1/hibernate2.jar]</path> <path>[../../javalibs/hibernate-2.1/lib/commons-dbcp-1.1.jar]</path> <path>[../../javalibs/hibernate-2.1/lib/commons-pool-1.1.jar]</path> </class> <source> <path>../../javalibs/hibernate-2.1/eg</path> <path>../../javalibs/hibernate-2.1/src</path> <path>../../javalibs/hibernate-2.1/test</path> </source> <documentation> <path>../../javalibs/hibernate-2.1/doc/api</path> </documentation> </library> > -----Original Message----- > From: David Friedman [mailto:[EMAIL PROTECTED] > Sent: Thursday, April 22, 2004 10:47 PM > To: Struts Users Mailing List > Subject: RE: Hibernate 2.1.X and Struts 1.2 > > > Joe, > > How are you switching between Hibernate versions 2.1.X and > 2.0.3? What is your application manager? Tomcat? Are you > fully shutting down Tomcat and restarting or are you simply > stopping the webapp, changing jars in the WEB-INF/lib > directory, and restarting it? Which jars are you switching? > Can you include the Hibernate plug-in (anything proprietary > removed) and the jar? > > Regards, > David > > -----Original Message----- > From: Joe Hertz [mailto:[EMAIL PROTECTED] > Sent: Thursday, April 22, 2004 10:31 PM > To: 'Struts Users Mailing List' > Subject: RE: Hibernate 2.1.X and Struts 1.2 > > > Dies almost before it begins. Hibernate Logging is set to debug. > > This is everything before the exception > > StandardManager[]: Seeding random number generator class > java.security.SecureRandom > StandardManager[]: Seeding of random number generator has > been completed > > StandardContext[]: Servlet threw load() exception: > javax.servlet.ServletException: > Servlet.init() for servlet action threw exception > javax.servlet.ServletException: > Servlet.init() for servlet action threw exception > > Root cause of Exception: > > > java.lang.NoClassDefFoundError > at > net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configu > ration.jav > a:750) > at bb.hibernate.HibernatePlugIn.init(HibernatePlugIn.java:158) > at > org.apache.struts.action.ActionServlet.initModulePlugIns(Actio > nServlet.j > ava:827) > at > org.apache.struts.action.ActionServlet.init(ActionServlet.java:327) > at javax.servlet.GenericServlet.init(GenericServlet.java:256) > > I know it successfully reads my hibernate config, because it > will complain about classes that attempt to refer to > unmentioned .hbm.xml files. > > It still works great under 2.0.3 > > > -----Original Message----- > > From: David Friedman [mailto:[EMAIL PROTECTED] > > Sent: Thursday, April 22, 2004 9:31 PM > > To: Struts Users Mailing List > > Subject: RE: Hibernate 2.1.X and Struts 1.2 > > > > > > Do you have any hibernate related messages in any of your > logs? And > > the one or two lines above/below NoClassDefFoundError? > > > > Regards, > > David > > > > -----Original Message----- > > From: Joe Hertz [mailto:[EMAIL PROTECTED] > > Sent: Thursday, April 22, 2004 5:02 PM > > To: 'Struts Users Mailing List' > > Subject: RE: Hibernate 2.1.X and Struts 1.2 > > > > > > Unfortunately, not a bit :( > > > > It's not getting to the point of storing the SessionFactory in the > > JNDI tree or Servlet Context. It dies on construction of the > > SessionFactory. > > > > Ted's Plugin from the Struts-Hibernate example (still there as it > > turns > > out) avoids JNDI anyway. > > > > The current plugin listed on Hibernate.org *can* avoid it too, so I > > grabbed it and tweaked it to provide some of the same Session > > obtaining/releasing methods Ted's had. > > > > Both PlugIns behave identically for me. It will complain > about hbm.xml > > errors if I have them, but once all solved, boom, > NoClassDefFoundError > > > > It be nice if someone on the Hibernate.org forum chimed in. > I'm going > > a bit nuts -- I'm getting closer to start questioning the > contents of > > the Hibernate Distribution I downloaded since this was > supposed to be > > a 2.1.1 issue. > > > > > -----Original Message----- > > > From: John McGrath [mailto:[EMAIL PROTECTED] > > > Sent: Thursday, April 22, 2004 4:46 PM > > > To: 'Struts Users Mailing List' > > > Subject: RE: Hibernate 2.1.X and Struts 1.2 > > > > > > > > > we wrote our own. we might be doing this back-assward, but > > basically > > > our first step is to put the factory we want into the JNDI > > tree. with > > > tomcat or resin, this is done in server.xml or web.xml; > in weblogic > > > it's done with a startup class (ours is > > ContentServiceFactoryStartup, > > > it puts an instance of our > edu.whoi.cms.ContentServiceFactory into > > > JNDI). > > > > > > then we have a class called > > edu.whoi.cms.ContentServiceFactoryPlugIn, > > > which implements org.apache.struts.action.PlugIn. it's most > > important > > > job is to put the Factory into the servlet context, where > it can be > > > accessed by action classes. here's an excerpt: > > > > > > public void init( ActionServlet servlet, ModuleConfig > config ) { ... > > > Context ctx = (Context) new InitialContext(); > > > ContentServiceFactory theFactory = > > > (ContentServiceFactory)ctx.lookup( > > > "ContentServiceFactory" ); > > > this.theServlet = servlet; > > > servletCxt.setAttribute("CONTENT_SERVICE_FACTORY", > > > theFactory); ... } > > > > > > > > > ContentServiceFactory has a method called getContentService, this > > > returns our content service interface (IContentService). > > it's a little > > > indirect, but if we ever decide to bail on hibernate and > use, say, > > > iBatis, we would have to write an iBatis implementation of > > > IContentService, but none of our other code would change. > > > > > > this all gets triggered at startup by this line in struts-config: > > > > > > <plug-in className="edu.whoi.cms.ContentServiceFactoryPlugIn" /> > > > > > > then with our action classes, we have a BaseAction class that all > > > other action classes inherit. BaseAction has a getContentService > > > method: > > > > > > public IContentService getContentService() { > > > return ( ( ContentServiceFactory ) > > > getServlet().getServletContext().getAttribute( > > > CONTENT_SERVICE_FACTORY )).getContentService(); } > > > > > > so any action class can get a contentService instance, and > > call stuff > > > like getArticlesForUser (User theUser), etc, and these methods > > > actually execute the hibernate calls. > > > > > > hope that helps, > > > john > > > > > > -----Original Message----- > > > From: Joe Hertz [mailto:[EMAIL PROTECTED] > > > Sent: Thursday, April 22, 2004 2:43 PM > > > To: 'Struts Users Mailing List' > > > Subject: RE: Hibernate 2.1.X and Struts 1.2 > > > > > > > > > What Plugin are you using? > > > > > > Specifically, how do you go about generating your SessionFactory? > > > > > > > -----Original Message----- > > > > From: John McGrath [mailto:[EMAIL PROTECTED] > > > > Sent: Thursday, April 22, 2004 2:13 PM > > > > To: 'Struts Users Mailing List' > > > > Subject: RE: Hibernate 2.1.X and Struts 1.2 > > > > > > > > > > > > we're using Struts 1.2 and Hibernate 2.1, works great, > > > though it took > > > > a little fiddling with the jars and classpath to get it > > > going. also, > > > > we had some problems with the version of cglib2 that came with > > > > hibernate (i think it was RC2), so we downloaded the final > > > version of > > > > 2, that worked. > > > > > > > > we also had to make some other adjustments when we > > upgraded struts; > > > > for example, we use WebLogic 6.1, which needed to be > > > patched to sp3 to > > > > work. > > > > > > > > this is what's in our classpath: > > > > > > > > classes12.jar > > > > weblogic.jar > > > > mysql.jar > > > > > > > > connector.jar > > > > odmg-3.0.jar > > > > struts.jar > > > > hibernate2.jar > > > > hibernate-tools.jar > > > > dom4j-1.4.jar > > > > jdom.jar > > > > jdbc2_0-stdext.jar > > > > jcs-1.0-dev.jar > > > > cglib2.jar > > > > ehcache-0.6.jar > > > > log4j-1.2.8.jar > > > > c3p0-0.8.3.jar.jar > > > > proxool-0.8.3.jar > > > > xalan-2.4.0.jar > > > > xerces-2.4.0.jar > > > > xml-apis.jar > > > > > > > > # Commons jars > > > > commons-collections-2.1.jar > > > > commons-dbcp-1.1.jar > > > > commons-digester.jar > > > > commons-pool-1.1.jar > > > > commons-lang-1.0.1.jar > > > > commons-fileupload.jar > > > > commons-logging-1.0.3.jar > > > > commons-beanutils.jar > > > > commons-validator.jar > > > > > > > > john > > > > > > > > > > > > -----Original Message----- > > > > From: Joe Hertz [mailto:[EMAIL PROTECTED] > > > > Sent: Thursday, April 22, 2004 10:16 AM > > > > To: 'Struts Users Mailing List' > > > > Subject: Hibernate 2.1.X and Struts 1.2 > > > > > > > > > > > > I'm trying to upgrade from Hibernate 2.0.3 to 2.1.2, and my > > > > pre-existing Hibernate Plugin hates it. (It's based on the > > > > Struts-Hibernate example Ted wrote, which doesn't > appear to be on > > > > sourceforge. anymore). > > > > > > > > I'm getting this exception, which implies I'm loading old > > jar files > > > > from 2.0.3, but I don't see them. > > > > > > > > java.lang.NoClassDefFoundError > > > > at > net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configu > > > > ration.jav > > > > a:750) > > > > > > > > I am concerned that there may be a conflict with some of > > > the commons > > > > libraries Hibernate wants vs with what Struts wants (note > > > > commons-collections and commons-logging below). > > > > > > > > Anyone else go through this? > > > > > > > > Here's the jars my IDE says it is deploying: > > > > > > > > FormDef.jar > > > > activation.jar > > > > antlr.jar > > > > cglib-2.0.jar > > > > commons-beanutils.jar > > > > commons-collections-2.1.jar > > > > commons-collections.jar > > > > commons-dbcp-1.1.jar > > > > commons-digester.jar > > > > commons-fileupload.jar > > > > commons-lang-1.0.1.jar > > > > commons-logging-1.0.3.jar > > > > commons-logging.jar > > > > commons-pool-1.1.jar > > > > commons-validator.jar > > > > dom4j-1.4.jar > > > > ehcache-0.6.jar > > > > hibernate2.jar > > > > jaas.jar > > > > jakarta-oro.jar > > > > jakarta-regexp-1.3.jar > > > > jcs-1.0-dev.jar > > > > jdbc2_0-stdext.jar > > > > jgroups-2.2.jar > > > > jstl.jar > > > > jta.jar > > > > junit-3.8.1.jar > > > > log4j-1.2.8.jar > > > > mail.jar > > > > odmg-3.0.jar > > > > oscache-2.0.jar > > > > proxool-0.8.3.jar > > > > standard.jar > > > > struts-el.jar > > > > struts.jar > > > > swarmcache-1.0rc2.jar > > > > xalan-2.4.0.jar > > > > xerces-2.4.0.jar > > > > > > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]