Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Java Open Source > BOOK: Professional Hibernate
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional Hibernate
This is the forum to discuss the Wrox book Professional Hibernate by Eric Pugh, Joseph D. Gradecki; ISBN: 9780764576775
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Hibernate section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 28th, 2005, 08:46 PM
Registered User
 
Join Date: Mar 2005
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default java.lang.NoClassDefFoundError: javax/transaction/

Dear Friends,

  I am using the standalone SWING application code provided by the authors but its not working. Here is the output from the console along with the error.

INFO: Not binding factory to JNDI, no JNDI name configured
java.lang.NoClassDefFoundError: javax/transaction/Synchronization
        at net.sf.hibernate.impl.SessionFactoryImpl.openSessi on(SessionFactoryImpl.java:314)

Why is this error happening? I have j2ee.jar in my classpath (see bottom for classpath).

I am using Windows XP Professional with SQL Server 2000 Developer along with Hibernate 2 (as recommended by the book) as well as JDK 1.4. My goal is to use Hibernate with Websphere.



Mar 27, 2005 7:18:36 PM net.sf.hibernate.transaction.TransactionManagerLoo kupFac
tory getTransactionManagerLookup
INFO: No TransactionManagerLookup configured (in JTA environment, use of process
 level read-write cache is not recommended)
Mar 27, 2005 7:18:36 PM net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Use scrollable result sets: true
Mar 27, 2005 7:18:36 PM net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Use JDBC3 getGeneratedKeys(): false
Mar 27, 2005 7:18:36 PM net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Optimize cache for minimal puts: false
Mar 27, 2005 7:18:36 PM net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: echoing all SQL to stdout
Mar 27, 2005 7:18:36 PM net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Query language substitutions: {}
Mar 27, 2005 7:18:36 PM net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: cache provider: net.sf.hibernate.cache.EhCacheProvider
Mar 27, 2005 7:18:36 PM net.sf.hibernate.cfg.Configuration configureCaches
INFO: instantiating and configuring caches
Mar 27, 2005 7:18:36 PM net.sf.ehcache.config.Configurator configure
WARNING: No configuration found. Configuring ehcache from ehcache-failsafe.xml f
ound in the classpath: jar:file:/C:/Hibernate/lib/ehcache-0.9.jar!/ehcache-fails
afe.xml
Mar 27, 2005 7:18:36 PM net.sf.hibernate.impl.SessionFactoryImpl <init>
INFO: building session factory
Mar 27, 2005 7:18:36 PM net.sf.hibernate.impl.SessionFactoryObjectFactory addIns
tance
INFO: Not binding factory to JNDI, no JNDI name configured
java.lang.NoClassDefFoundError: javax/transaction/Synchronization
        at net.sf.hibernate.impl.SessionFactoryImpl.openSessi on(SessionFactoryIm
pl.java:314)
        at net.sf.hibernate.impl.SessionFactoryImpl.openSessi on(SessionFactoryIm
pl.java:327)
        at net.sf.hibernate.impl.SessionFactoryImpl.openSessi on(SessionFactoryIm
pl.java:335)
        at CDTest$3.actionPerformed(CDTest.java:111)
        at javax.swing.AbstractButton.fireActionPerformed(Unk nown Source)
        at javax.swing.AbstractButton$ForwardActionEvents.act ionPerformed(Unknow
n Source)
        at javax.swing.DefaultButtonModel.fireActionPerformed (Unknown Source)
        at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
        at javax.swing.plaf.basic.BasicButtonListener.mouseRe leased(Unknown Sour
ce)
        at java.awt.Component.processMouseEvent(Unknown Source)
        at java.awt.Component.processEvent(Unknown Source)
        at java.awt.Container.processEvent(Unknown Source)
        at java.awt.Component.dispatchEventImpl(Unknown Source)
        at java.awt.Container.dispatchEventImpl(Unknown Source)
        at java.awt.Component.dispatchEvent(Unknown Source)
        at java.awt.LightweightDispatcher.retargetMouseEvent( Unknown Source)
        at java.awt.LightweightDispatcher.processMouseEvent(U nknown Source)
        at java.awt.LightweightDispatcher.dispatchEvent(Unkno wn Source)
        at java.awt.Container.dispatchEventImpl(Unknown Source)
        at java.awt.Window.dispatchEventImpl(Unknown Source)
        at java.awt.Component.dispatchEvent(Unknown Source)
        at java.awt.EventQueue.dispatchEvent(Unknown Source)
        at java.awt.EventDispatchThread.pumpOneEventForHierar chy(Unknown Source)

        at java.awt.EventDispatchThread.pumpEventsForHierarch y(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.run(Unknown Source)
java.lang.NoClassDefFoundError: javax/transaction/Synchronization
        at net.sf.hibernate.impl.SessionFactoryImpl.openSessi on(SessionFactoryIm
pl.java:314)
        at net.sf.hibernate.impl.SessionFactoryImpl.openSessi on(SessionFactoryIm
pl.java:327)
        at net.sf.hibernate.impl.SessionFactoryImpl.openSessi on(SessionFactoryIm
pl.java:335)
        at CDTest$5.actionPerformed(CDTest.java:148)
        at javax.swing.AbstractButton.fireActionPerformed(Unk nown Source)
        at javax.swing.AbstractButton$ForwardActionEvents.act ionPerformed(Unknow
n Source)
        at javax.swing.DefaultButtonModel.fireActionPerformed (Unknown Source)
        at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
        at javax.swing.plaf.basic.BasicButtonListener.mouseRe leased(Unknown Sour
ce)
        at java.awt.Component.processMouseEvent(Unknown Source)
        at java.awt.Component.processEvent(Unknown Source)
        at java.awt.Container.processEvent(Unknown Source)
        at java.awt.Component.dispatchEventImpl(Unknown Source)
        at java.awt.Container.dispatchEventImpl(Unknown Source)
        at java.awt.Component.dispatchEvent(Unknown Source)
        at java.awt.LightweightDispatcher.retargetMouseEvent( Unknown Source)
        at java.awt.LightweightDispatcher.processMouseEvent(U nknown Source)
        at java.awt.LightweightDispatcher.dispatchEvent(Unkno wn Source)
        at java.awt.Container.dispatchEventImpl(Unknown Source)
        at java.awt.Window.dispatchEventImpl(Unknown Source)
        at java.awt.Component.dispatchEvent(Unknown Source)
        at java.awt.EventQueue.dispatchEvent(Unknown Source)
        at java.awt.EventDispatchThread.pumpOneEventForHierar chy(Unknown Source)

        at java.awt.EventDispatchThread.pumpEventsForHierarch y(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.run(Unknown Source)
java.lang.NoClassDefFoundError: javax/transaction/Synchronization
        at net.sf.hibernate.impl.SessionFactoryImpl.openSessi on(SessionFactoryIm
pl.java:314)
        at net.sf.hibernate.impl.SessionFactoryImpl.openSessi on(SessionFactoryIm
pl.java:327)
        at net.sf.hibernate.impl.SessionFactoryImpl.openSessi on(SessionFactoryIm
pl.java:335)
        at CDTest$5.actionPerformed(CDTest.java:148)
        at javax.swing.AbstractButton.fireActionPerformed(Unk nown Source)
        at javax.swing.AbstractButton$ForwardActionEvents.act ionPerformed(Unknow
n Source)
        at javax.swing.DefaultButtonModel.fireActionPerformed (Unknown Source)
        at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
        at javax.swing.plaf.basic.BasicButtonListener.mouseRe leased(Unknown Sour
ce)
        at java.awt.Component.processMouseEvent(Unknown Source)
        at java.awt.Component.processEvent(Unknown Source)
        at java.awt.Container.processEvent(Unknown Source)
        at java.awt.Component.dispatchEventImpl(Unknown Source)
        at java.awt.Container.dispatchEventImpl(Unknown Source)
        at java.awt.Component.dispatchEvent(Unknown Source)
        at java.awt.LightweightDispatcher.retargetMouseEvent( Unknown Source)
        at java.awt.LightweightDispatcher.processMouseEvent(U nknown Source)
        at java.awt.LightweightDispatcher.dispatchEvent(Unkno wn Source)
        at java.awt.Container.dispatchEventImpl(Unknown Source)
        at java.awt.Window.dispatchEventImpl(Unknown Source)
        at java.awt.Component.dispatchEvent(Unknown Source)
        at java.awt.EventQueue.dispatchEvent(Unknown Source)
        at java.awt.EventDispatchThread.pumpOneEventForHierar chy(Unknown Source)

        at java.awt.EventDispatchThread.pumpEventsForHierarch y(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.run(Unknown Source)
java.lang.NoClassDefFoundError: javax/transaction/Synchronization
        at net.sf.hibernate.impl.SessionFactoryImpl.openSessi on(SessionFactoryIm
pl.java:314)
        at net.sf.hibernate.impl.SessionFactoryImpl.openSessi on(SessionFactoryIm
pl.java:327)
        at net.sf.hibernate.impl.SessionFactoryImpl.openSessi on(SessionFactoryIm
pl.java:335)
        at CDTest$5.actionPerformed(CDTest.java:148)
        at javax.swing.AbstractButton.fireActionPerformed(Unk nown Source)
        at javax.swing.AbstractButton$ForwardActionEvents.act ionPerformed(Unknow
n Source)
        at javax.swing.DefaultButtonModel.fireActionPerformed (Unknown Source)
        at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
        at javax.swing.plaf.basic.BasicButtonListener.mouseRe leased(Unknown Sour
ce)
        at java.awt.Component.processMouseEvent(Unknown Source)
        at java.awt.Component.processEvent(Unknown Source)
        at java.awt.Container.processEvent(Unknown Source)
        at java.awt.Component.dispatchEventImpl(Unknown Source)
        at java.awt.Container.dispatchEventImpl(Unknown Source)
        at java.awt.Component.dispatchEvent(Unknown Source)
        at java.awt.LightweightDispatcher.retargetMouseEvent( Unknown Source)
        at java.awt.LightweightDispatcher.processMouseEvent(U nknown Source)
        at java.awt.LightweightDispatcher.dispatchEvent(Unkno wn Source)
        at java.awt.Container.dispatchEventImpl(Unknown Source)


CLASSPATH WOES (separate post) :

C:\Java\Swing\standalone>echo %CLASSPATH%
C:\Sun\AppServer\lib\j2ee.jar;C:\jakarta-struts-1.2.4\lib\struts.jar;%HIBERNATE_
HOME%\hibernate2.jar;C:\SQLServerJDBC\lib\msbase.j ar;C:\SQLServerJDBC\lib\msutil
.jar;C:\SQLServerJDBC\lib\mssqlserver.jar;C:\j2sdk 1.4.2_06\bin;C:\Hibernate\hibe
rnate2.jar;C:\Hibernate\lib\dom4j-1.4.jar;C:\Hibernate\lib\commons-logging-1.0.4
.jar;C:\Hibernate\lib\commons-collections-2.1.1.jar;C:\Hibernate\lib\ehcache-0.9
.jar;C:\Hibernate\lib\cglib-full-2.0.2.jar

Asyou can see all imaginable jars are in this classpath!

and yet when I do the following :


C:\Java\Swing\standalone>java CDTest
Exception in thread "main" java.lang.NoClassDefFoundError: CDTest

That is the error I get!


Until I have to use the following command line "command":

C:\Java\Swing\standalone>java -classpath .;C:\Hibernate\hibernate2.jar;C:\Hibern
ate\lib\dom4j-1.4.jar;C:\Hibernate\lib\commons-logging-1.0.4.jar;C:\Hibernate\li
b\commons-collections-2.1.1.jar;C:\SQLServerJDBC\lib\msbase.jar;C:\SQLSe rverJDBC
\lib\mssqlserver.jar;C:\SQLServerJDBC\lib\msutil.j ar;C:\Hibernate\lib\ehcache-0.
9.jar;C:\Hibernate\lib\cglib-full-2.0.2.jar CDTest

I have to include the path in the command line, why is that?





Reply With Quote
  #2 (permalink)  
Old April 7th, 2005, 12:25 PM
Registered User
 
Join Date: Feb 2005
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hey Orange boy, why don't you use an IDE like eclipse and forget all "classpaths problems"...
Reply With Quote
  #3 (permalink)  
Old August 7th, 2007, 03:09 AM
Registered User
 
Join Date: Aug 2007
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am again gettting this problem.
i am working on eclipse IDE.
plz help me on this Error:

java.lang.NoClassDefFoundError: javax/transaction/Synchronization

Reply With Quote
  #4 (permalink)  
Old August 8th, 2007, 02:17 PM
Registered User
 
Join Date: Aug 2004
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am having the same trouble as orange_jhon. If anyone has the solution can you post on forum.

Thanks!

Reply With Quote
  #5 (permalink)  
Old August 15th, 2007, 11:27 AM
Registered User
 
Join Date: Aug 2007
Location: , , Argentina.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello. Imports 'jta.jar' at your project

Reply With Quote
  #6 (permalink)  
Old February 25th, 2008, 11:07 PM
Registered User
 
Join Date: Feb 2008
Location: hyderabad, ap, India.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanx mr it was solved a big problem for me

Reply With Quote
  #7 (permalink)  
Old March 18th, 2013, 10:38 PM
Registered User
Points: 3, Level: 1
Points: 3, Level: 1 Points: 3, Level: 1 Points: 3, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2013
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

you can include the “javaee.jar“, which can be found under J2EE SDK’s folder. The “javaee.jar” contains “javax/transaction/Synchronization” class as well.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
java.lang.NoClassDefFoundError when trying to crea Nimeshkd EJB 2 July 12th, 2012 01:30 AM
Hibernate Error :javax/transaction/Synchronization orange_jhon Hibernate 0 August 7th, 2007 03:46 AM
Exception : java.lang.NoClassDefFoundError haifriends J2EE 1 July 26th, 2006 07:22 PM
NoClassDefFoundError: javax/mail/MessagingExceptio rida BOOK: Beginning Cryptography with Java 7 May 28th, 2006 08:07 PM
java.lang.NoClassDefFoundError: org/xml/sax/XMLRea kcheung XSLT 0 August 8th, 2003 08:03 AM



All times are GMT -4. The time now is 12:28 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.