You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by "alan.stroop" <al...@gmail.com> on 2011/10/18 23:54:48 UTC

Hibernate on TomEE 1.0.0 beta-1

Just like to share my setup to get Hibernate (3.6) to work on the TomEE 1.0.0
Beta (plus variation) in hopes that others may find this useful or those
with the know-how can explain where I went wrong.  

I started with an application that was fully working with Tomcat 6 + OpenEJB
3.1.4. The application was packaged as a WAR with jars containing my
hibernate layer, EJB layer, etc. in the WEB-INF/lib directory. All Hibernate
jars were located in $CATALINA_HOME/lib.

Downloads
  apache-tomee-1.0.0-beta-1-plus.zip
  hibernate-distribution-3.6.7.Final-dist.zip
  hibernate-entitymanager-3.4.0.GA.zip
  hibernate-validator-4.2.0.Final-dist.zip
  commons-logging-1.1.1-bin.zip

$CATALINA_HOME/endorsed
  antlr-2.7.6.jar
  commons-collections-3.1.jar
  dom4j-1.6.1.jar
  hibernate3.jar
  hibernate-jpa-2.0-api-1.0.1.Final.jar
  javassist-3.12.0.GA.jar
  mysql-connector-java-5.1.16-bin.jar
  slf4j-api-1.6.1.jar
  validation-api-1.0.0.GA.jar

$CATALINA_HOME/webapps/MyApp/WEB-INF/lib
  c3p0-0.9.1.jar
  cglib-nodep-2.2.2.jar
  commons-logging-1.1.1.jar
  hibernate-entitymanager.jar
  infinispan-core-4.2.1.CR1.jar
  jbosscache-core-3.2.1.GA.jar
  jta-1.1.jar
  oscache-2.1.jar
  proxool-0.8.3.jar
  swarmcache-1.0RC2.jar

Created empty "hibernate.properties" file in
$CATALINA_HOME/webapps/MyApp/WEB-INF/classes.  This fixes a
NullPointerException in
org.hibernate.util.ConfigHelper.getResourceAsStream(String) when Tomcat is
initially loading.

Changed hibernate DOCTYPEs from PUBLIC to SYSTEM. This fixes
"org.hibernate.HibernateException: Could not parse configuration:
/com/myapp/integration/hibernate/mysql/hibernate.cfg.xml".  The following
steps worked, however, I'm not happy with it. I tried changing the DOCTYPEs
in the hibernate.cfg.xml and *.hbm.xml to match what the DTDs contained in
the hibernate3.jar, but still no luck. (will revisit later).
    1. Explode $CATALINA_HOME/webapps/MyApp/WEB-INF/lib/MyAppIntegration.jar
to $CATALINA_HOME/webapps/MyApp/WEB-INF/classes (to adjust hibernate.cfg.xml
and *.hbm.xml).
    2. Delete MyAppIntegration.jar
    3. hibernate.cfg.xml - change the DOCTYPE to: <!DOCTYPE
hibernate-configuration SYSTEM &quot;hibernate-configuration-3.0.dtd&quot;>
    4. *.hbm.xml - change the DOCTYPE to: <!DOCTYPE hibernate-mapping SYSTEM
&quot;hibernate-mapping-3.0.dtd&quot;>
    5. Moved DTDs from hibernate3.jar to $CATALINA_HOME/bin

With the Hibernate changes above, it appears that the persistence.xml in no
longer required in $CATALINA_HOME/webapps/MyApp/META-INF directory, although
maybe it wasn't required with the original setup.

--
View this message in context: http://openejb.979440.n4.nabble.com/Hibernate-on-TomEE-1-0-0-beta-1-tp3916942p3916942.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: Hibernate on TomEE 1.0.0 beta-1

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi,

i'm not sure i understood your issue but FYI tomee is buildable with
hibernate. When somebody does it it is here
http://code.google.com/a/apache-extras.org/p/openejb-extra/downloads/list but
it is not automatically done so if you want to build it from sources simply
checkout source and compile it with maven:

svn co https://svn.apache.org/repos/asf/openejb/trunk/openejb/ openejb
cd openejb
mvn clean install -P hibernate -Dmaven.test.skip=true

- Romain


2011/10/18 alan.stroop <al...@gmail.com>

> Just like to share my setup to get Hibernate (3.6) to work on the TomEE
> 1.0.0
> Beta (plus variation) in hopes that others may find this useful or those
> with the know-how can explain where I went wrong.
>
> I started with an application that was fully working with Tomcat 6 +
> OpenEJB
> 3.1.4. The application was packaged as a WAR with jars containing my
> hibernate layer, EJB layer, etc. in the WEB-INF/lib directory. All
> Hibernate
> jars were located in $CATALINA_HOME/lib.
>
> Downloads
>  apache-tomee-1.0.0-beta-1-plus.zip
>  hibernate-distribution-3.6.7.Final-dist.zip
>  hibernate-entitymanager-3.4.0.GA.zip
>  hibernate-validator-4.2.0.Final-dist.zip
>  commons-logging-1.1.1-bin.zip
>
> $CATALINA_HOME/endorsed
>  antlr-2.7.6.jar
>  commons-collections-3.1.jar
>  dom4j-1.6.1.jar
>  hibernate3.jar
>  hibernate-jpa-2.0-api-1.0.1.Final.jar
>  javassist-3.12.0.GA.jar
>  mysql-connector-java-5.1.16-bin.jar
>  slf4j-api-1.6.1.jar
>  validation-api-1.0.0.GA.jar
>
> $CATALINA_HOME/webapps/MyApp/WEB-INF/lib
>  c3p0-0.9.1.jar
>  cglib-nodep-2.2.2.jar
>  commons-logging-1.1.1.jar
>  hibernate-entitymanager.jar
>  infinispan-core-4.2.1.CR1.jar
>  jbosscache-core-3.2.1.GA.jar
>  jta-1.1.jar
>  oscache-2.1.jar
>  proxool-0.8.3.jar
>  swarmcache-1.0RC2.jar
>
> Created empty "hibernate.properties" file in
> $CATALINA_HOME/webapps/MyApp/WEB-INF/classes.  This fixes a
> NullPointerException in
> org.hibernate.util.ConfigHelper.getResourceAsStream(String) when Tomcat is
> initially loading.
>
> Changed hibernate DOCTYPEs from PUBLIC to SYSTEM. This fixes
> "org.hibernate.HibernateException: Could not parse configuration:
> /com/myapp/integration/hibernate/mysql/hibernate.cfg.xml".  The following
> steps worked, however, I'm not happy with it. I tried changing the DOCTYPEs
> in the hibernate.cfg.xml and *.hbm.xml to match what the DTDs contained in
> the hibernate3.jar, but still no luck. (will revisit later).
>    1. Explode $CATALINA_HOME/webapps/MyApp/WEB-INF/lib/MyAppIntegration.jar
> to $CATALINA_HOME/webapps/MyApp/WEB-INF/classes (to adjust
> hibernate.cfg.xml
> and *.hbm.xml).
>    2. Delete MyAppIntegration.jar
>    3. hibernate.cfg.xml - change the DOCTYPE to: <!DOCTYPE
> hibernate-configuration SYSTEM &quot;hibernate-configuration-3.0.dtd&quot;>
>    4. *.hbm.xml - change the DOCTYPE to: <!DOCTYPE hibernate-mapping SYSTEM
> &quot;hibernate-mapping-3.0.dtd&quot;>
>    5. Moved DTDs from hibernate3.jar to $CATALINA_HOME/bin
>
> With the Hibernate changes above, it appears that the persistence.xml in no
> longer required in $CATALINA_HOME/webapps/MyApp/META-INF directory,
> although
> maybe it wasn't required with the original setup.
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/Hibernate-on-TomEE-1-0-0-beta-1-tp3916942p3916942.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>