geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevan Miller <kevan.mil...@gmail.com>
Subject Re: Problem at geronimo boot
Date Wed, 29 Aug 2007 19:04:04 GMT

On Aug 29, 2007, at 7:02 AM, Paolo Denti wrote:

> Ok Kevan, found. browsing through the sources i see the the  
> ProxyManager interface has changed. the signature of the  
> createProxy methods is the following
> public Object createProxy(AbstractName target, ClassLoader loader);
> public Object createProxy(AbstractName target, Class type);
> now i do not know exactly how to modify the  
> GeronimoTransactionManagerLookup in order to use new ProxyManager.

Doh... Sorry. Was right in front of my face... Perhaps we should  
start meeting for a second cup of coffee? ;-)

What a pain all this reflection, is... The following compiles. I  
haven't tested. Dario or Viet, could you give it a spin?

Note that the this doesn't contain a package name. You'll need to add  
one... I'd rather the example not use the org.hibernate namespace...

javac CLASSPATH setup:
export CLASSPATH=geronimo-tomcat6-jee5-2.0.1/lib/geronimo- 
kernel-2.0.1.jar:geronimo-tomcat6-jee5-2.0.1/repository/org/apache/ 
geronimo/specs/geronimo-jta_1.1_spec/1.1/geronimo- 
jta_1.1_spec-1.1.jar:hibernate-3.2/build/hibernate3.jar

New source:

import org.apache.geronimo.kernel.Kernel;
import org.apache.geronimo.kernel.KernelRegistry;
import org.apache.geronimo.gbean.AbstractName;
import org.apache.geronimo.gbean.AbstractNameQuery;

import org.hibernate.HibernateException;
import org.hibernate.transaction.TransactionManagerLookup;

import java.util.Properties;
import java.util.Set;
import javax.transaction.TransactionManager;

public class GeronimoTransactionManagerLookup
     implements TransactionManagerLookup
{

     public static final String UserTransactionName = "java:comp/ 
UserTransaction";

     public TransactionManager getTransactionManager(Properties  
props) throws HibernateException {
             Kernel kernel = KernelRegistry.getSingleKernel();
             AbstractNameQuery tmQuery = new AbstractNameQuery(null,  
null, TransactionManager.class.getName());
             Set tmSet = kernel.listGBeans(tmQuery);
             if (tmSet.size() != 1) {
                 throw new HibernateException("Geronimo  
TransactionManager Lookup Failed. Too many GBean instances");
             }
             return (TransactionManager)tmSet.toArray()[0];
     }

     public String getUserTransactionName() {
         return UserTransactionName;
     }
}


--kevan


>
> Paolo Denti wrote:
>> the problem is
>>
>> java.lang.NoSuchMethodException:  
>> org.apache.geronimo.kernel.proxy.ProxyManager.createProxy 
>> (javax.management.ObjectName, java.lang.Class)
>>
>> ?? are the online javadocs correct for the 2.0.1 version ?
>>
>> Paolo Denti wrote:
>>> no, never mind ... too many tries and i wrote this "nonsense"  
>>> stuff ... the clzArray is the parameter list of the  
>>> createProxyMethod ... it is correct.
>>> anyway it fails on the proxyManagerClass.getMethod("createProxy",  
>>> clzArray) call.
>>>
>>> Paolo Denti wrote:
>>>> Kevan, i tried and following the execution, the problem is in  
>>>> the proxyManagerClass.getMethod("createProxy", clzArray);
>>>> the getMethod call fails.
>>>>
>>>> But looking at the javadoc i see that the signature of the  
>>>> ProxyManager createProxy method is
>>>>  Object createProxy(javax.management.ObjectName, Class)
>>>> but we are inovoking proxyManagerClass.getMethod("createProxy",  
>>>> clzArray) where clzArray is a Class[] as if the signature were
>>>>  Object createProxy(javax.management.ObjectName, Class[])
>>>>
>>>>
>>>>
>>>>
>>>> Kevan Miller wrote:
>>>>>
>>>>> On Aug 28, 2007, at 11:34 AM, Paolo Denti wrote:
>>>>>
>>>>>> ok, thanks. therefore the problem "should" lie in how the  
>>>>>> transactionManager is looked up, that is the method  
>>>>>> getTransactionManager of the GeronimoTransactionManagerLookup  
>>>>>> class.
>>>>>
>>>>> Right. Paolo, at a minimum, I think you need to update your  
>>>>> GeronimoTransactionManagerLookup class to contain the following  
>>>>> setting of TransactionMgrGBeanName:
>>>>>
>>>>> public static final String  
>>>>> TransactionMgrGBeanName="geronimo:J2EEServer=geronimo,ServiceModul 
>>>>> e=org.apache.geronimo.configs/transaction/2.0.1/ 
>>>>> car,j2eeType=TransactionManager,name=TransactionManager";
>>>>>
>>>>> I don't have a working hibernate environment, at the moment. If  
>>>>> you could try this new setting, it would be great...
>>>>>
>>>>> --kevan
>>>>>


Mime
View raw message