GlassFishV3 Hibernate Library Problem

I am trying to deploy a JAR file on a GlassFishv3 server. This results in an error:

com.sun.enterprise.admin.cli.CommandException: 
remote failure: 
Exception while preparing the app : 
java.lang.RuntimeException:
java.lang.ClassNotFoundException: 
org.hibernate.ejb.HibernatePersistence

I thought that the class "org.hibernate.ejb.HibernatePersistence" was missing and tried to add libraries containing it to the folder "glassfish \ domains \ domain1 \ lib". I took them from the NetBeans folder "NetBeans 6.9 \ java \ modules \ ext \ hibernate". As a result, glass fish no longer begins. It goes into timeout. Last log entry

INFO|glassfish3.0.1|javax.enterprise.system.std.com.sun.enterprise.v3.services.impl|_ThreadID=21;_ThreadName=Thread-1;|{felix.fileinstall.poll (ms) = 5000, felix.fileinstall.dir = C:\glassfishv301\glassfish\domains\domain1\autodeploy\bundles, felix.fileinstall.debug = 1, felix.fileinstall.bundles.new.start = true, felix.fileinstall.tmpdir = C:\DOKUME~1\me\LOKALE~1\Temp\fileinstall-8074722487477598658, felix.fileinstall.filter = null}|#]

The autodeploy \ bundles folder specified in this entry is empty.

Any idea how to move the formard?

+5
source share
3 answers

Hibernate JPA, Hibernate JPA GlassFish v3:

alt text http://a.yfrog.com/img80/5218/screenshot009z.png

Hibernate EntityManager . , .

+4

Hibernate:

bin/pkg install hibernate
+2

Hibernate-JTA-JPA-EJB-GlassFish-MySQL: 1- Hibernate-JPA-EJB-GlassFish-MySql: .4.3.5 EJB GlassFish.4.0 NetBeans.8.0. - beans jarernate jar , , MySql Glassfish, , , persistence.xml :

<persistence-unit name="omidashouriPU" transaction-type="Resource_Local">
    <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
    <exclude-unlisted-classes>false</exclude-unlisted-classes>
    <properties>
            <property name="hibernate.archive.autodetection" value="class"/>
            <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
            <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
            <property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/YourSchemaName"/>
            <property name="hibernate.connection.username" value="root"/>
            <property name="hibernate.connection.password" value="yourpassword"/>
            <property name="hibernate.show_sql" value="true"/>
    </properties>
</persistence-unit>

EJB (, @Stateless) EntityManager :

EntityManagerFactory emf = Persistence.createEntityManagerFactory( "omidashouriPU" );       EntityManager em = emf.createEntityManager();   em = emf.createEntityManager();   em.getTransaction() ().   em.persist(YourEntityObject);   em.getTransaction() ();.

, "transaction-type =" Resource_Local ", , , - .

2- Hibernate-JPA-JTA-EJB-GlassFish-MySql: hibernate.4.3.5 EJB JTA GlassFish.4.0 IDE NetBeans.8.0. - beans ( : - maven, Netbeans.8.0 IDE) jibernate jar , , MySql Glassfish, ( JDBC > JDBC: JDBC JDBC, , ) (: JNDI , JNDI , JPA , , Glassfish , , ping MySQl , ), , persistence.xml :

<persistence-unit name="omidashouriPU" transaction-type="JTA">
    <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<jta-data-source>jdbc/yourJNDI (which you defined in glassfish) </jta-data-source>
    <exclude-unlisted-classes>false</exclude-unlisted-classes>
    <properties>
            <property name="hibernate.archive.autodetection" value="class"/>
            <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
<property name="hibernate.transaction.jta.platform" value="org.hibernate.service.jta.platform.internal.SunOneJtaPlatform"/>
            <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
            <property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/YourSchemaName"/>
            <property name="hibernate.connection.username" value="root"/>
            <property name="hibernate.connection.password" value="yourpassword"/>
            <property name="hibernate.show_sql" value="true"/>
    </properties>
  </persistence-unit>

EJB (, @Stateless) EntityManager :

@PersistenceContext(unitName = " omidashouriPU ")
EntityManager em;
em.persist(YourEntityObject);

, "transaction-type =" JTA ", , , ( GlassFish). , persistence.xml , , .

, 3 , , , omidashouri@gmail.com.

0

All Articles