Return-Path: Delivered-To: apmail-geronimo-user-archive@www.apache.org Received: (qmail 77516 invoked from network); 2 Apr 2008 21:13:41 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 2 Apr 2008 21:13:41 -0000 Received: (qmail 66748 invoked by uid 500); 2 Apr 2008 21:13:39 -0000 Delivered-To: apmail-geronimo-user-archive@geronimo.apache.org Received: (qmail 66717 invoked by uid 500); 2 Apr 2008 21:13:39 -0000 Mailing-List: contact user-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: user@geronimo.apache.org List-Id: Delivered-To: mailing list user@geronimo.apache.org Received: (qmail 66675 invoked by uid 99); 2 Apr 2008 21:13:39 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Apr 2008 14:13:39 -0700 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of kevan.miller@gmail.com designates 64.233.184.239 as permitted sender) Received: from [64.233.184.239] (HELO wr-out-0506.google.com) (64.233.184.239) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Apr 2008 21:12:54 +0000 Received: by wr-out-0506.google.com with SMTP id 50so1935039wra.13 for ; Wed, 02 Apr 2008 14:13:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:from:to:in-reply-to:content-type:mime-version:subject:date:references:x-mailer; bh=7WZRGhge3TfSgm+ztdbcM7l20RNgnapgdL0+zF1xgg4=; b=fZofgwEy+dNv454bz/imeUvt9VH8ngj2eLfWtwCBxrWE+S1OQbQMqHFeI4Xcf0X6tr7wld2HuNQvM/BkOMhcu5BYQFcdfB/sdxRw6pHJtiEYpY2qwpfZ5dc5BtH3duvmC1rjKwlN4wAT40JXEQW3nU6MhA8NkwHMkmJvbPoJRj0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=message-id:from:to:in-reply-to:content-type:mime-version:subject:date:references:x-mailer; b=tHj4eKnpR3grgAZNyAvdqspZLLNKjWe6fAGHuk/unwX2zSiuqL2NloQqDxbctmoB1ryohIPtXJaE5OlPVBTIMiyK38eqSHDCWJS25cpRxETFDOlfDlEOqx8oxyPvMLZCVPcYp++rVnM90HtoN9yll+fZSWmIusV+UsOIUmP1pIg= Received: by 10.140.208.14 with SMTP id f14mr5337194rvg.204.1207170785709; Wed, 02 Apr 2008 14:13:05 -0700 (PDT) Received: from ?10.0.1.193? ( [76.182.118.42]) by mx.google.com with ESMTPS id 9sm1944474ywf.2.2008.04.02.14.13.04 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 02 Apr 2008 14:13:05 -0700 (PDT) Message-Id: <10A59C5D-1296-4888-AC15-0C27D41BFFB8@gmail.com> From: Kevan Miller To: user@geronimo.apache.org In-Reply-To: <47F3E11D.7020002@berghold.net> Content-Type: multipart/alternative; boundary=Apple-Mail-32--917166414 Mime-Version: 1.0 (Apple Message framework v919.2) Subject: Re: Geronimo learning woes: Hibernate. Date: Wed, 2 Apr 2008 17:13:03 -0400 References: <47F3E11D.7020002@berghold.net> X-Mailer: Apple Mail (2.919.2) X-Virus-Checked: Checked by ClamAV on apache.org --Apple-Mail-32--917166414 Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit 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: > > > > > > net.berghold.testgeronimo.website > Geronimo_Test_Hibernate_App > 2.0 > war > > > /testgapp > > > > 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 --Apple-Mail-32--917166414 Content-Type: text/html; charset=US-ASCII Content-Transfer-Encoding: quoted-printable
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=3D"1.0" = encoding=3D"UTF-8"?>
<web-app xmlns=3D"http://geronimo.ap= ache.org/xml/ns/j2ee/web-1.2">
=    <environment>
=        <moduleId>
=            <grou= pId>net.berghold.testgeronimo.website</groupId>
=            <arti= factId>Geronimo_Test_Hibernate_App</artifactId>
=            <vers= ion>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 =3D new Mytest(new = Date().toString(),"A Field");
MytestDAO dao =3D 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.Propert= iesHelper.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=3D-Dorg.apache.activeio.journal.active.DisableLocking=3Dtrue
<= div>
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... ;-)