-->
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: Integrating Hibernate with EJB
PostPosted: Thu Jan 22, 2009 7:09 am 
Newbie

Joined: Tue Nov 11, 2008 8:19 am
Posts: 11
Hi all,
I am new to EJB and hibernae.

I am using Hibernate 3.0, Jboss 4.0.2, EJB 2.1.Can you please spend your valualbe time and tell me how to integrate EJB and Hibernate. we plan to use stateless session beans which will call the DAO.

I searched in google and i cant find any answer relavant to me.

1. What are the configurations need to be done in JBOSS.
2. How to access the hibernate session in EJB.

Please explain the steps clearly, So that this thread will be useful to me and others. And i have to solve this issue, As soon as possible.

thanks,
Vinoth

_________________
Vinoth


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 22, 2009 7:11 am 
Newbie

Joined: Tue Nov 11, 2008 8:19 am
Posts: 11
I added the DAO in a utility project. And i tried to use the DAO from the EJB directly and i got tghe following error. I didnt do any configurations. Can you please tell me, what are the steps i have to follow.

Code:
java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
   java.rmi.ServerError: Unexpected Error; nested exception is:
   java.lang.NoClassDefFoundError: org/apache/commons/collections/SequencedHashMap
   at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:325)
   at sun.rmi.transport.Transport$1.run(Transport.java:153)
   at java.security.AccessController.doPrivileged(Native Method)
   at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
   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:595)
   at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
   at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
   at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:126)
   at org.jboss.invocation.jrmp.server.JRMPInvoker_Stub.invoke(Unknown Source)
   at org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(JRMPInvokerProxy.java:118)
   at org.jboss.invocation.InvokerInterceptor.invokeInvoker(InvokerInterceptor.java:227)
   at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:167)
   at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:46)
   at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:55)
   at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:97)
   at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:86)
   at $Proxy2.foo(Unknown Source)
   at com.tcs.nulamda.proxy.EJBMyRemoteFactory.getMyRemote(EJBMyRemoteFactory.java:46)
   at com.tcs.nulamda.proxy.TestProxy.dotest(TestProxy.java:19)
   at com.tcs.nulamda.proxy.TestProxy.main(TestProxy.java:11)
Caused by: java.rmi.ServerError: Unexpected Error; nested exception is:
   java.lang.NoClassDefFoundError: org/apache/commons/collections/SequencedHashMap
   at org.jboss.ejb.plugins.LogInterceptor.handleException(LogInterceptor.java:399)
   at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:196)
   at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
   at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:624)
   at org.jboss.ejb.Container.invoke(Container.java:873)
   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:585)
   at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
   at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
   at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
   at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
   at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
   at org.jboss.invocation.jrmp.server.JRMPInvoker$MBeanServerAction.invoke(JRMPInvoker.java:805)
   at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:406)
   at sun.reflect.GeneratedMethodAccessor150.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
   at sun.rmi.transport.Transport$1.run(Transport.java:153)
   at java.security.AccessController.doPrivileged(Native Method)
   at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
   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:595)
Caused by: java.lang.NoClassDefFoundError: org/apache/commons/collections/SequencedHashMap
   at org.hibernate.mapping.Table.<init>(Table.java:33)
   at org.hibernate.cfg.Mappings.addTable(Mappings.java:116)
   at org.hibernate.cfg.HbmBinder.bindRootPersistentClassCommonValues(HbmBinder.java:250)
   at org.hibernate.cfg.HbmBinder.bindRootClass(HbmBinder.java:235)
   at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:151)
   at org.hibernate.cfg.Configuration.add(Configuration.java:360)
   at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:397)
   at org.hibernate.cfg.Configuration.addResource(Configuration.java:446)
   at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1313)
   at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1285)
   at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1267)
   at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1234)
   at org.hibernate.cfg.Configuration.configure(Configuration.java:1162)
   at com.tcs.nulamda.DAO.HibernateSessionFactory.currentSession(HibernateSessionFactory.java:55)
   at com.tcs.nulamda.DAO.HibernateSuspensDAO.testSuspens(HibernateSuspensDAO.java:238)
   at com.tcs.Nulamda.EJBPackage.MyBean.foo(MyBean.java:51)
   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:585)
   at org.jboss.invocation.Invocation.performCall(Invocation.java:345)
   at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:214)
   at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:185)
   at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:130)
   at org.jboss.webservice.server.ServiceEndpointInterceptor.invoke(ServiceEndpointInterceptor.java:51)
   at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:48)
   at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:105)
   at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:335)
   at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:166)
   at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:139)
   at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:192)
   ... 24 more

_________________
Vinoth


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 22, 2009 8:26 am 
Newbie

Joined: Tue Jan 13, 2009 11:49 am
Posts: 11
well, you're missing the commons-collections.jar . Go download it from apache.

Dirk


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 22, 2009 8:58 am 
Newbie

Joined: Tue Nov 11, 2008 8:19 am
Posts: 11
I already added the Commons-collections.jar file in the library. Please tell me what are the configurations need to be done to use Hibernate in the EJB ?

_________________
Vinoth


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.