Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » OSGI + Hibernate = javax.transaction problem(java.lang.NoClassDefFoundError: javax/transaction/Synchronization)
OSGI + Hibernate = javax.transaction problem [message #689372] Mon, 27 June 2011 14:24 Go to next message
Christian A is currently offline Christian A
Messages: 13
Registered: March 2011
Junior Member
Hi,

i am trying to set up an OSGi application with Spring-Hibernate support.
After a couple of days, i'm able to deploy the bundles completely.

But when i try to run the application and perform an action which attempts to create
an hibernate transaction, i get the following exception:

java.lang.NoClassDefFoundError: javax/transaction/Synchronization
	at org.hibernate.impl.SessionImpl.<init>(SessionImpl.java:256)
	at org.hibernate.impl.SessionFactoryImpl.openSession(SessionFactoryImpl.java:616)
	at org.hibernate.impl.SessionFactoryImpl.openSession(SessionFactoryImpl.java:640)
	at org.hibernate.impl.SessionFactoryImpl.openSession(SessionFactoryImpl.java:648)
	at org.springframework.orm.hibernate3.SessionFactoryUtils.getNewSession(SessionFactoryUtils.java:522)
	at org.springframework.orm.hibernate3.SessionFactoryUtils.getNewSession(SessionFactoryUtils.java:490)
	at de.idarewest.backend.service.transaction.TransactionManager.<init>(TransactionManager.java:64)
	at de.idarewest.backend.service.UserSession.<init>(UserSession.java:44)
	at de.idarewest.backend.service.transaction.UserSessionLifecycle.getUserSession(UserSessionLifecycle.java:36)
	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:597)
	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
	at org.springframework.osgi.service.importer.support.internal.aop.ServiceInvoker.doInvoke(ServiceInvoker.java:58)
	at org.springframework.osgi.service.importer.support.internal.aop.ServiceInvoker.invoke(ServiceInvoker.java:62)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
	at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
	at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
	at org.springframework.osgi.service.util.internal.aop.ServiceTCCLInterceptor.invokeUnprivileged(ServiceTCCLInterceptor.java:56)
	at org.springframework.osgi.service.util.internal.aop.ServiceTCCLInterceptor.invoke(ServiceTCCLInterceptor.java:39)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
	at org.springframework.osgi.service.importer.support.LocalBundleContextAdvice.invoke(LocalBundleContextAdvice.java:59)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
	at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
	at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
	at $Proxy18.getUserSession(Unknown Source)
	at de.pascada.idarewest.ServiceConnector.getValidUserSession(ServiceConnector.java:32)
	at de.pascada.idarewest.rap.LoginHandler.createUserSession(LoginHandler.java:43)
	at de.pascada.idarewest.rap.LoginDialog.login(LoginDialog.java:143)
	at de.pascada.idarewest.rap.LoginDialog.access$0(LoginDialog.java:134)
	at de.pascada.idarewest.rap.LoginDialog$1.handleEvent(LoginDialog.java:95)
	at org.eclipse.swt.internal.widgets.UntypedEventAdapter.dispatchEvent(UntypedEventAdapter.java:651)
	at org.eclipse.swt.internal.widgets.UntypedEventAdapter.widgetSelected(UntypedEventAdapter.java:88)
	at org.eclipse.swt.events.SelectionEvent.dispatchToObserver(SelectionEvent.java:194)
	at org.eclipse.rwt.internal.events.Event.processEvent(Event.java:44)
	at org.eclipse.swt.events.TypedEvent.processEvent(TypedEvent.java:161)
	at org.eclipse.swt.events.TypedEvent.executeNext(TypedEvent.java:201)
	at org.eclipse.swt.widgets.Display.runPendingMessages(Display.java:1100)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1090)
	at de.pascada.idarewest.rap.LoginDialog.open(LoginDialog.java:64)
	at de.pascada.idarewest.rap.EntryPoint.createUI(EntryPoint.java:111)
	at org.eclipse.rwt.internal.lifecycle.EntryPointManager.createUI(EntryPointManager.java:92)
	at org.eclipse.rwt.internal.lifecycle.RWTLifeCycle.createUI(RWTLifeCycle.java:245)
	at org.eclipse.rwt.internal.lifecycle.RWTLifeCycle$UIThreadController.run(RWTLifeCycle.java:114)
	at java.lang.Thread.run(Thread.java:662)
	at org.eclipse.rwt.internal.lifecycle.UIThread.run(UIThread.java:102)
Caused by: java.lang.ClassNotFoundException: javax.transaction.Synchronization
	at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:506)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:422)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)
	at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
	... 50 more


I tried to import the package 'javax.transaction' from an OSGI bundled version of
jta.jar, but i did not work. It seems, that the incomplete stuff from RT is used,
instead of the packages from jta. If i import 'javax.transaction' with version
restrictions, i get the same error and 'javax.transaction' is still taken from RT.
An attempt to add jta as bundle dependency is also not successful. In this case the
deployment fails due to a package use conflict with one of the spring bundles.

After some reading i recognized, that it is a common problem with no common solution.

Is there anything i missed?

Best regards,
Chris


[Updated on: Mon, 27 June 2011 14:25]

Report message to a moderator

Re: OSGI + Hibernate = javax.transaction problem [message #689770 is a reply to message #689372] Tue, 28 June 2011 10:24 Go to previous messageGo to next message
Christoph Keimel is currently offline Christoph Keimel
Messages: 367
Registered: December 2010
Location: Germany
Senior Member
hi christian,

i had similar issues when setting up an OSGI application using a jboss application server. the "problem" is, that each plugin uses it's own classloader but the server-libs (hiberante) need to know the client classes. the solution is to use "buddy classloading".

in my case i have a lib-plugin with the jboss libs: org.jboss.client.as5
(just a plugin with all the jboss-libs inlcuded)
and a client-plugin with my ejb3 interfaces: de.emsw.gosa.ejb3.client
(de.idarewest.backend.service in your case?)

the client-plugin registers itself as a buddy with the lib-plugin. the manifest.mf of de.emsw.gosa.ejb3.client as the following entry:
Eclipse-RegisterBuddy: org.jboss.client.as5


be sure, that the lib-plugin "opens" itself for buddy-registering. the manifest.mf of org.jboss.client.as5 has the following entry:
Eclipse-BuddyPolicy: registered


hope this helps,
christoph
Re: OSGI + Hibernate = javax.transaction problem [message #690000 is a reply to message #689770] Tue, 28 June 2011 18:09 Go to previous messageGo to next message
Christian A is currently offline Christian A
Messages: 13
Registered: March 2011
Junior Member
hi christoph

Thanks for your advice.

I solved the issue.
An configuration error in my hibernate bundle caused the problem.

christian
Re: OSGI + Hibernate = javax.transaction problem [message #758993 is a reply to message #690000] Fri, 25 November 2011 14:29 Go to previous message
Baena  is currently offline Baena
Messages: 1
Registered: November 2011
Junior Member
Hi cristian,

I'm having a similar problem.
How do you solved it?

tks.
Previous Topic:adding bundles dynamically
Next Topic: Eclipse 3.7 RCP Update with p2
Goto Forum:
  


Current Time: Thu Oct 23 04:47:44 GMT 2014

Powered by FUDForum. Page generated in 0.01643 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software