users@glassfish.java.net

Re: Hibernate persistence integration in Glassfish

From: Hadraba Petr <hadrabap_at_bluetone.cz>
Date: Mon, 4 Feb 2008 11:31:12 +0100

Hi,

I'm successfuly using Hibernate under Glassfish; but without Sailfin
-- I'm using "standard" Java EE modules.

I'm copying Hibernate libraries (all required except connector.jar,
ejb3-persistance.jar, jaas.jar, jacc-1_0fr.jar, jdbc2_0-stdext.jar,
jta.jar and versioncheck.jar) into ${GLASSFISH_HOME}/lib directory.
I'm using Hibernate 3.2 and Hibernate EntityManager 3.3.1.GA with no
problems. I can provide to you simple UNIX shell script that installs
hibernate into GlassFish and also creates uninstall script.

Good luck!

PETR


On Mon, Feb 4, 2008 at 11:07 AM, Persa Zaloshnja <arushi58_at_hotmail.com> wrote:
>
> Hi once again,
>
> Here I got some logs to clear the problem state I am having:
>
>
> [#|2008-02-04T10:52:12.143+0100|SEVERE|sun-comms-appserver1.0|javax.enterprise.system.container.sip|_ThreadID=16;_ThreadName=SipContainer-serversWorkerThread-5060-8;javax.persistence.PersistenceException:
> No Persistence provider for EntityManager named hibernatetest: The following
> providers:
> oracle.toplink.essentials.PersistenceProvider
> oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider
> Returned null to createEntityManagerFactory.
> ;_RequestID=849cdb23-926d-4ca8-be61-e65bf89fe83a;|Exception allocating
> servlet |#]
>
> [#|2008-02-04T10:52:12.146+0100|WARNING|sun-comms-appserver1.0|javax.enterprise.system.stream.err|_ThreadID=16;_ThreadName=SipContainer-serversWorkerThread-5060-8;_RequestID=849cdb23-926d-4ca8-be61-e65bf89fe83a;|javax.persistence.PersistenceException:
> No Persistence provider for EntityManager named hibernatetest: The following
> providers:
> oracle.toplink.essentials.PersistenceProvider
> oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider
> Returned null to createEntityManagerFactory.
>
> at
> javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:154)
> at
> javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:83)
> at com.research.hibernatetest.data.TestDao.<init>(TestDao.java:13)
> at com.server.as.doInvite(Unknown Source)
> at javax.servlet.sip.SipServlet.doRequest(SipServlet.java:54)
>
>
>
> Thanks,
> /Persa
>
>
>
> > Date: Sun, 3 Feb 2008 19:00:21 +0530
> > From: Sahoo_at_Sun.COM
> > To: users_at_glassfish.dev.java.net
> > Subject: Re: Hibernate persistence integration in Glassfish
> >
>
> > Hi Persa,
> >
> > I don't understand why you are directly changing files under
> > $sailfin_home/domain/domain1/applications/j2ee-modules/My_SipServlet/.
> > You should be modifying the sar file before deploying. Can you please
> > try the following steps and let us know what you see?
> >
> > 1. copy Hibernate and related jars to $sailfin_home/lib (You can skip
> > this if you have already done so). Restart Sailfin.
> > 2. change your persistence.xml to specify the correct data-source name
> > and provider name, rebuild the sar file.
> > 3. deploy the sar file into Sailfin.
> >
> > Now access your application.
> >
> > Thanks,
> > Sahoo
> >
> > Persa Zaloshnja wrote:
> > >
> > > Hi,
> > >
> > >
> > > I have started working with sailfin, and currently I am trying to
> > > integrate Hibernate EntityManager with Glassfish. As I am slightly in
> > > trouble I'd appreciate any hints on the matter.
> > >
> > > Here goes slightly an explanation of what I am actually trying to
> > > achieve, and may be you can read any mistake through the steps:
> > >
> > > First I have implemented a SipServlet,
> > >
> > > Secondly a seperate Java Application handling the data persistence,
> > > (business logic, data layer implementation) using JPA, Hibernate
> > > EntityManger, this is packed as .jar file referenced/used in the
> > > SipServlet project, which is using the data layer. Then I deploy
> > > My_SipServlet.sar using sailfin web console.
> > >
> > >
> > > Third, copied all the required hibernate (and the third party libs)
> > > into $sailfin_home/lib,
> > >
> > > as well as,
> > >
> $sailfin_home/domain/domain1/applications/j2ee-modules/My_SipServlet/WEB-INF/lib/hibernate.jar*
> > >
> > >
> > >
> > > Fourth, I did go to sailfin admin web console and added a jdbc
> > > connection pool to the database I'd like to access. (did ping the
> > > connection and it is successful).
> > >
> > >
> > >
> > > Fifth, did place the persistence.xml (which specifies as a provider -
> > > Hibernate, and jta-data-source as jdbc/name_of_connection_pool created
> > > above) under
> > >
> '$sailfin_home/domain/domain1/applications/j2ee-modules/My_SipServlet/WEB-INF/classes/persistence.xml'
> > >
> > >
> > >
> > > Restarted sailfin and started testing - I have enabled logging and as
> > > I can see sailfin when it creates the EntityManager factory it fails,
> > > since it's trying to use the default oracle.toplink persistence. As I
> > > can see it's not even reading my persistence.xml file where I specify
> > > the provider. Where does it actually read oracle.toplink.Persistence -
> > > I wonder ?
> > >
> > >
> > >
> > > Have you experienced anything of the sort?
> > >
> > >
> > >
> > > I have read through blogs and forums and it seems a straight forward
> > > procedure of just copying the libs and providing persistence.xml with
> > > the right provider - but it's just not working for me. Any hints
> > > greatly appreciated,
> > >
> > > Many Thanks in advance,
> > >
> > >
> > >
> > > Persa
> > >
> > >
> > > ------------------------------------------------------------------------
> > > Express yourself instantly with MSN Messenger! MSN Messenger
> > > <http://clk.atdmt.com/AVE/go/onm00200471ave/direct/01/>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> > For additional commands, e-mail: users-help_at_glassfish.dev.java.net
> >
>
>
> ________________________________
>
> Express yourself instantly with MSN Messenger! MSN Messenger