geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paolo Denti <paolo.de...@gmail.com>
Subject Re: Problem at geronimo boot
Date Tue, 28 Aug 2007 13:07:14 GMT
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
thanks kevan, (about jpa ... too late, and too "lazy", me, not
hibernate :-)<br>
yes, i of course i modified the <font class="Apple-style-span"
 face="Arial" size="3"><span class="Apple-style-span"
 style="font-size: 12.8px;">hibernate.transaction.manager_lookup_class,
pointing </span></font>to the class found on the wiki (which is not
really perfect in the getMethod calls ...)<br>
so, i can work on it, trying to set up a correct lookup class for
geronimo if you confirm me the the jndi name for the UserTransaction in
geronimo is the usual "java:comp/UserTransaction"<br>
<br>
the hibernate configuration is this<br>
<br>
spring config<br>
========================<br>
&lt;!-- datasource --&gt;<br>
&lt;jee:jndi-lookup id="dataSource" jndi-name="jdbc/myappDS"
resource-ref="true" /&gt;<br>
<br>
&lt;!-- Hibernate configuration --&gt;<br>
&lt;bean id="hibernateTemplate"
class="org.springframework.orm.hibernate3.HibernateTemplate"&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;property name="sessionFactory" ref="sessionFactory"/&gt;<br>
&lt;/bean&gt;<br>
<br>
&lt;bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;property name="dataSource" ref="dataSource"/&gt;<br>
&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; &lt;property name="hibernateProperties"&gt;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;bean
class="org.springframework.beans.factory.config.PropertiesFactoryBean"&gt;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&lt;property name="location"
value="classpath:com/myapp/data/hibernate.properties"/&gt;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;/bean&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;/property&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;property name="mappingDirectoryLocations"&gt;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;list&gt;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&lt;value&gt;classpath:com/myapp/data/dao/hibernate&lt;/value&gt;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;/list&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;/property&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;property name="eventListeners"&gt;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;map&gt;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&lt;entry key="merge"&gt;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; &lt;bean
class="org.springframework.orm.hibernate3.support.IdTransferringMergeEventListener"/&gt;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
&lt;/entry&gt;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;/map&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;/property&gt;<br>
&lt;/bean&gt;<br>
<br>
hibernate.properties<br>
================================<br>
hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect<br>
hibernate.current_session_context_class=jta<br>
hibernate.transaction.factory_class=org.hibernate.transaction.JTATransactionFactory<br>
hibernate.transaction.manager_lookup_class=org.hibernate.transaction.GeronimoTransactionManagerLookup<br>
hibernate.cache.use_second_level_cache=false<br>
hibernate.cache.use_query_cache=false<br>
hibernate.show_sql=true<br>
hibernate.hbm2ddl.auto=update<br>
<br>
<br>
as you can see, the datasource is looked up in jndi (it has been
imported from jboss and it looks ok)<br>
and configured in geronimo-web-xml together with javamail<br>
===================<br>
&lt;dep:dependencies&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;dependency&gt;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;groupId&gt;console.dbpool&lt;/groupId&gt;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;artifactId&gt;myappDS&lt;/artifactId&gt;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;version&gt;1.0&lt;/version&gt;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;type&gt;rar&lt;/type&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;/dependency&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;dependency&gt;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;groupId&gt;org.apache.geronimo.configs&lt;/groupId&gt;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;artifactId&gt;javamail&lt;/artifactId&gt;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;version&gt;2.0.1&lt;/version&gt;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &lt;type&gt;car&lt;/type&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;/dependency&gt;<br>
&lt;/dep:dependencies&gt;<br>
....<br>
&lt;resource-ref&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;ref-name&gt;jdbc/myappDS&lt;/ref-name&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;resource-link&gt;myappDS&lt;/resource-link&gt;<br>
&lt;/resource-ref&gt;<br>
&lt;resource-ref&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;ref-name&gt;mail/DefaultMail&lt;/ref-name&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;resource-link&gt;mail/MailSession&lt;/resource-link&gt;<br>
&lt;/resource-ref&gt;<br>
<br>
and this is the updated version of the GeronimoTransactionManagerLookup
class (with some modifications ...)<br>
===========================<br>
package org.hibernate.transaction;<br>
<br>
import java.util.Properties;<br>
import javax.management.ObjectName;<br>
import javax.transaction.TransactionManager;<br>
import org.hibernate.HibernateException;<br>
import org.hibernate.transaction.TransactionManagerLookup;<br>
<br>
public class GeronimoTransactionManagerLookup<br>
&nbsp;&nbsp;&nbsp; implements TransactionManagerLookup<br>
{<br>
&nbsp;&nbsp; public static final String
TransactionMgrGBeanName="geronimo.server:J2EEApplication=null,J2EEModule=geronimo/j2ee-server/2.0.1/car,J2EEServer=geronimo,j2eeType=TransactionManager,name=TransactionManager";<br>
&nbsp;&nbsp; public static final String UserTransactionName =
"java:comp/UserTransaction";<br>
<br>
&nbsp;&nbsp; public TransactionManager getTransactionManager(Properties props)
throws HibernateException {<br>
&nbsp;&nbsp; try {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Class kernelClass
=
Class.forName("org.apache.geronimo.kernel.Kernel");<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Class kernelRegistryClass
=
Class.forName("org.apache.geronimo.kernel.KernelRegistry");<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Class proxyManagerClass
=
Class.forName("org.apache.geronimo.kernel.proxy.ProxyManager");<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ObjectName
TransactionManagerName = new
ObjectName(TransactionMgrGBeanName);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Object kernel
=
kernelRegistryClass.getMethod("getSingleKernel", new Class[]
{}).invoke(null, new Object[] {});<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Object proxyManager
=
kernelClass.getMethod("getProxyManager",new Class[]
{}).invoke(kernel,new Object[] {});<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Class[] clzArray
= {ObjectName.class,Class.class};<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Object[]
objArray = {TransactionManagerName,
TransactionManager.class};<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return
(TransactionManager)proxyManagerClass.getMethod("createProxy",clzArray).<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
invoke(proxyManager, objArray);<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }catch (Exception e) {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
throw new HibernateException("Geronimo Transaction Manager
Lookup Failed", e);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
}<br>
<br>
&nbsp;&nbsp; public String getUserTransactionName() {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return UserTransactionName;<br>
&nbsp;&nbsp; }<br>
}<br>
<br>
<br>
Kevan Miller wrote:
<blockquote cite="mid:806D5618-397C-4EAF-967D-85CE1F01CFE2@gmail.com"
 type="cite"><br>
  <div>
  <div>On Aug 28, 2007, at 6:04 AM, Paolo Denti wrote:</div>
  <br class="Apple-interchange-newline">
  <blockquote type="cite">
    <div style="margin: 0px;">Hi Kevan,</div>
    <div style="margin: 0px;">i was using spring 2.0.6</div>
    <div style="margin: 0px; min-height: 14px;"><br>
    </div>
    <div style="margin: 0px;">following your suggestions and david's,</div>
    <div style="margin: 0px;">I downloaded the tomcat version and added</div>
    <div style="margin: 0px;">&lt;dep:hidden-classes&gt;</div>
    <div style="margin: 0px;"><span class="Apple-converted-space">&nbsp;</span>&lt;dep:filter&gt;org.springframework.&lt;/dep:filter&gt;</div>
    <div style="margin: 0px;"><span class="Apple-converted-space">&nbsp;</span>&lt;dep:filter&gt;META-INF/spring&lt;/dep:filter&gt;</div>
    <div style="margin: 0px;">&lt;/dep:hidden-classes&gt;</div>
    <div style="margin: 0px;">to geronimo-web.xml</div>
  </blockquote>
  <blockquote type="cite">
    <div style="margin: 0px; min-height: 14px;"><br>
    </div>
    <div style="margin: 0px;">but still the deploy does not work. now i
stucked just a little bit forward. I saw that no
org.hibernate.transaction.TransactionManagerLookup implementations
exists for geronimo.</div>
    <div style="margin: 0px;">I found here (<a moz-do-not-send="true"
 href="http://cwiki.apache.org/GMOxDOC10/jboss-to-geronimo-hibernate-migration.html">http://cwiki.apache.org/GMOxDOC10/jboss-to-geronimo-hibernate-migration.html</a>)
an implementation (GeronimoTransactionManagerLookup) that i included in
the package but it looks that it does not work.</div>
    <div style="margin: 0px; min-height: 14px;"><br>
    </div>
    <div style="margin: 0px;">10:32:23,124 ERROR [JTATransaction] Could
not find UserTransaction in JNDI</div>
    <div style="margin: 0px;">javax.naming.NameNotFoundException:
UserTransaction</div>
    <div style="margin: 0px;"><span class="Apple-converted-space">&nbsp;&nbsp;
&nbsp;
&nbsp; </span>at
org.apache.xbean.naming.context.AbstractContext.lookup(AbstractContext.java:163)</div>
    <div style="margin: 0px;"><span class="Apple-converted-space">&nbsp;&nbsp;
&nbsp;
&nbsp; </span>at
org.apache.xbean.naming.context.AbstractContext.lookup(AbstractContext.java:597)</div>
    <div style="margin: 0px;"><span class="Apple-converted-space">&nbsp;&nbsp;
&nbsp;
&nbsp; </span>at javax.naming.InitialContext.lookup(InitialContext.java:351)</div>
    <div style="margin: 0px;"><span class="Apple-converted-space">&nbsp;&nbsp;
&nbsp;
&nbsp; </span>at
org.hibernate.transaction.JTATransaction.&lt;init&gt;(JTATransaction.java:60)</div>
    <div style="margin: 0px;"><span class="Apple-converted-space">&nbsp;&nbsp;
&nbsp;
&nbsp; </span>at
org.hibernate.transaction.JTATransactionFactory.createTransaction(JTATransactionFactory.java:57)</div>
    <div style="margin: 0px;"><span class="Apple-converted-space">&nbsp;&nbsp;
&nbsp;
&nbsp; </span>at
org.hibernate.jdbc.JDBCContext.getTransaction(JDBCContext.java:193)</div>
    <div style="margin: 0px;"><span class="Apple-converted-space">&nbsp;&nbsp;
&nbsp;
&nbsp; </span>at
org.hibernate.impl.SessionImpl.getTransaction(SessionImpl.java:1315)</div>
    <div style="margin: 0px;"><span class="Apple-converted-space">&nbsp;&nbsp;
&nbsp;
&nbsp; </span>at
org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1325)</div>
    <div style="margin: 0px;">...</div>
  </blockquote>
  <div><br class="khtml-block-placeholder">
  </div>
  <div>Nice work, Paolo. One note: the &lt;hidden-classes&gt; should
not be strictly necessary running on Tomcat, but one can never be too
careful... ;-)</div>
  <br>
  <div>Looks like we need to update that example for 2.0... I'm not
much of a hibernate expert. Give me a bit and will get UserTransaction
lookup working for you...</div>
  <div><br class="khtml-block-placeholder">
  </div>
  <div>FYI, there is a J2G (JBoss to Geronimo) migration tool under
development in Geronimo. IIUC, it wouldn't help in this case, but I
could be wrong...</div>
  <div><br class="khtml-block-placeholder">
  </div>
  <div>BTW, did you configure the&nbsp;<font class="Apple-style-span"
 face="Arial" size="3"><span class="Apple-style-span"
 style="font-size: 12.8px;">hibernate.transaction.manager_lookup_class</span></font>
in your hibernate configuration?&nbsp;</div>
  <div><br class="khtml-block-placeholder">
  </div>
  <div>In the meantime, ask Hibernate to add an Apache Geronimo lookup
class... :-) Heh. Or better yet, start using JPA! ;-)</div>
  <div><br class="khtml-block-placeholder">
  </div>
  <div>Back soon...</div>
  <div><br class="khtml-block-placeholder">
  </div>
  <div>--kevan</div>
  </div>
  <br>
</blockquote>
</body>
</html>

Mime
View raw message