On Apr 2, 2008, at 3:40 PM, Peter L. Berghold wrote:

Hi folks,

I asked a similar question last week and I'm still scratching my head here.

In order to track down what I'm missing I created a very simple
application using Hibernate (if such exists) against a local database
defining only one table.

I've created my geronimo-web.xml file that looks like:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-1.2";>
   <environment>
       <moduleId>
           <groupId>net.berghold.testgeronimo.website</groupId>
           <artifactId>Geronimo_Test_Hibernate_App</artifactId>
           <version>2.0</version>
           <type>war</type>
       </moduleId>
   </environment>
   <context-root>/testgapp</context-root>

</web-app>

Simple... simple...

The only JSP page does this:

<%
        Mytest mt = new Mytest(new Date().toString(),"A Field");
        MytestDAO dao = new MytestDAO();
        
        dao.save(mt);

%>

Simple... simple...

What I'm seeing happen is the data never gets saved.  Looking at the
logs I see a variety of errors that pique my interest.

%%%% Error Creating SessionFactory %%%%
java.lang.ClassCastException: java.util.HashSet
       at
org .hibernate .util.PropertiesHelper.resolvePlaceHolders(PropertiesHelper.java:88)

being one and

%%%% Error Creating SessionFactory %%%%
org.hibernate.MappingException: Could not read mappings from resource:
net/berghold/tg/persistance/Mytest.hbm.xml

being another and even more interesting is

Caused by: org.hibernate.DuplicateMappingException: Duplicate
class/entity mapping net.berghold.tg.persistance.Mytest

What the...?


What is special about deploying Hibernate based apps under Geronimo that web searches haven't revealed, or will Hibernate even work under Geronimo?

The HibernateSessionFactory that I'm using is pretty stock stuff that
you find on the Hibernate.org website.  Looking at the book
"Professional Apache Geronimo" yields no mention of Hibernate at all
which is really making me begin to wonder.

Anybody got any ideas out there?

One of the components used by Geronimo is setting a system property to a value that is not a String and Hibernate is expecting only String values in system properties.

You should be able to avoid this by setting the following:

export GERONIMO_OPTS=- Dorg.apache.activeio.journal.active.DisableLocking=true

and restarting your server. This is supposed to be fixed in later versions of Hibernate (and also will be fixed in later versions of ActiveMQ, once we're able to move to a later version).

Googling 'hashset geronimo classcastexception' seems to work... ;-) We should have a hibernate section in our doc... but then OpenJPA works pretty well... ;-)

--kevan 

Reply via email to