Return-Path: Delivered-To: apmail-geronimo-user-archive@www.apache.org Received: (qmail 47091 invoked from network); 21 Mar 2006 17:24:59 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 21 Mar 2006 17:24:59 -0000 Received: (qmail 25619 invoked by uid 500); 21 Mar 2006 17:24:55 -0000 Delivered-To: apmail-geronimo-user-archive@geronimo.apache.org Received: (qmail 25585 invoked by uid 500); 21 Mar 2006 17:24:55 -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 25563 invoked by uid 99); 21 Mar 2006 17:24:55 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 21 Mar 2006 09:24:55 -0800 X-ASF-Spam-Status: No, hits=1.4 required=10.0 tests=DNS_FROM_RFC_ABUSE,DNS_FROM_RFC_WHOIS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [66.163.169.225] (HELO smtp105.mail.sc5.yahoo.com) (66.163.169.225) by apache.org (qpsmtpd/0.29) with SMTP; Tue, 21 Mar 2006 09:24:53 -0800 Received: (qmail 1563 invoked from network); 21 Mar 2006 17:24:33 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Received:Mime-Version:In-Reply-To:References:Content-Type:Message-Id:Content-Transfer-Encoding:From:Subject:Date:To:X-Mailer; b=PGNeOY6NdsICcLe0m2ojjtzEdvc9CRWX1hHNzuJrOCgC234bX0rit1e/2F23DGTrp6j2fd1qH6RDLTvbAMYRPSvTCvhiwXFr3M499g4mIwpBve6JIEguVJb0S0c23Hm3yVgSi4jmXGGIVQfzUvrBmDablpz6xV72FtsEPU3gOkI= ; Received: from unknown (HELO ?192.168.1.5?) (david?jencks@66.93.38.137 with plain) by smtp105.mail.sc5.yahoo.com with SMTP; 21 Mar 2006 17:24:31 -0000 Mime-Version: 1.0 (Apple Message framework v746.2) In-Reply-To: <74e15baa0603210824r28a26bd9l2295dcc9331c358f@mail.gmail.com> References: <785A212E11918F449D1318C61B7A9B0E2B9567@cs-mailsvr.Virtusa.com> <74e15baa0603210824r28a26bd9l2295dcc9331c358f@mail.gmail.com> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <74F31494-B7C0-44FD-8011-174FB1013EA6@yahoo.com> Content-Transfer-Encoding: 7bit From: David Jencks Subject: Re: KernelRegistry does not return a reference to Kernel + class loader issue Date: Tue, 21 Mar 2006 09:24:29 -0800 To: user@geronimo.apache.org X-Mailer: Apple Mail (2.746.2) X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N A couple of possibly helpful or misleading hints :-) -- I dont' think that putting anything in lib/endorsed will lead to joy :-) I think you need to put all the ojb related stuff in the repository and get it into the same classloader by putting dependencies to it in the same plan. -- I don't see that you are using web apps, but if you are you probably want to take all the jars out of WEB-INF/lib and put them in the repository and use plan dependencies instead: this won't be necessary in 1.1. -- you might look in the spring module in trunk to see a similar way of fishing out the transaction manager to integrate in another framework. I'm not sure this code actually works at the moment. -- be aware that jndi only works on threads that have gone through a j2ee component. If you are trying to e.g. look up the datasource in ojb from some startup thread such as a gbean constructor or doStart method, jndi won't work. If you look up a datasource in jndi during a call from an ejb, and the datasource is declared as a resource-ref in your dd and plan, that should work. If you need the datasource in a gbean you should use a gbean reference to the ManagedConnectionFactoryWrapper gbean and get the datasource by calling $getResource: see the system-datasource plan and the jdbc timers for an example. --Something like what you are doing ought to work: jetspeed 2 which uses ojb seems to work fine in geronimo (after sufficient porting :-) Hope this helps, david jencks On Mar 21, 2006, at 8:24 AM, Aaron Mulder wrote: > For the kernel problem, what kind of code is calling > Kernel.getSingleKernel? When you say it returns null and you don't > get any exception on the server side, it makes it sound like a client > is calling Kernel.getSingleKernel, which we would not expect to work. > That method will probably only work within the server VM. There is a > way to get a remote Kernel, but it's more complex (you can look at how > it's done in the deploy tool, for example). > > So here's what looks like the key part of the class loading problem: > > java.lang.NoClassDefFoundError: javax/management/ObjectName > at > com..ojb.transaction.WebSphereCETransactionManagerFactory.getTransacti > on > Manager(WebSphereCETransactionManagerFactory.java:48) > at > org.apache.ojb.broker.core.PersistenceBrokerFactorySyncImpl. > (Unkno > wn Source) > > Did you abbreviate that 2nd line? I think that's an important one. > Something related to OJB cannot find the JMX classes... But it > doesn't look like that's actually an OJB class since it starts with > "com." -- we need to figure out who's providing that class. Maybe > com.xmeta? Is that actually your code? > > As far as classloaders go, it looks like CoreRepositoryFactory is > creating a new class, and then PersistenceBrokerFactoryFactory is > trying to create a class, and then PersistenceBrokerFactorySyncImpl is > trying to call > WebSphereCETransactionManagerFactory.getTransactionManager > and that's got the wrong class loader. So they key will be idenfiying > what CL is used at each step and where it goes wrong. > > Also, how are OJB and xmeta packaged in your application? Are they > included in WEB-INF/lib, for example, or in a JAR in the Geronimo > repository, or what? > > Thanks, > Aaron > > On 3/21/06, Siraj Mohamed wrote: >> Thanks Aaron for a reply. >> >> Let me explain what I am really doing. We have an EJB application >> (EAR) >> which is running on WebSphere and I am currently migrating this into >> WASCE. >> >> This is the back end service called 'xmeta' which let user perform >> any >> database activities through Apache OJB and EMF (Eclipse Modeling >> Framework). The xmeta EAR contains many EJBs with public interface >> methods so that end user could use it to perform 'insert', 'delete', >> 'update' operations on the target database through ORM. The OJB >> configuration is provided with a jar named ojb-conf.jar which has >> information about data source reference, ORM mappings and a java >> class >> which is used to get a TransactionManager of the application >> server. For >> example, Apache provides >> org.apache.ojb.broker.transaction.tm.JBossTransactionManagerFactory f >> or >> Jboss and >> org.apache.ojb.broker.transaction.tm.WebSphereTransactionManagerFacto >> ry >> for Websphere. My intention is to write a java class >> (WebSphereCETransactionManagerFactory) same as websphere and jboss to >> get a reference of the TransactionManager so that I can specify this >> class name in the OJB.properties (it is bundled in the ojb- >> conf.jar) and >> the class name is specified with a key JTATransactionManagerClass= in >> same the property file. My original mail refers this java class and I >> just wanted to test my code. I ran this class through eclipse but >> following code returns null. >> >> kernel = KernelRegistry.getSingleKernel(); >> >> I do not get any exception in the server side and it just returns >> me a >> null. That was my first problem and I am not sure why am I getting >> null. >> Do I need any additional code to get a connection to the WASCE before >> getting Kernel? My class path has the jndi.properties for WASCE. >> >> This is my 2nd problem and it seems to be a class loader problem. I >> could able to deploy my xmeta application (EAR) successfully on WASCE >> and I also successfully created a data source with MySQL as back >> end. My >> next step is to see whether I could talk to database through OJB by >> invoking a method of a service of xmeta application (say >> SandboxAdminService). I bundled my written java class in a jar and >> copied it to the WASCE_HOME\lib\endorsed folder and also copied >> ojb-conf.jar to the same folder. The ojb-conf.jar will be read by >> SandboxAdminService EJB to get information such as data source >> name and >> the java class name which is used to get a reference of the >> TransactionManager and other ORM mappings. >> >> At end, when I invoke client, I am getting following >> NoClassDefFoundError: >> >> 17:00:17,861 INFO [RepositoryPersistor] OJB Descriptor Repository: >> jar:file:/C:/IBM/WebSphere/AppServerCommunityEdition/lib/endorsed/ >> ojb-co >> nf.jar!/repository.xml >> 17:00:17,861 INFO [RepositoryPersistor] Building repository from >> :jar:file:/C:/IBM/WebSphere/AppServerCommunityEdition/lib/endorsed/ >> ojb-c >> onf.jar!/repository.xml >> 17:00:18,268 INFO [RepositoryPersistor] Read class descriptors >> took 407 >> ms >> 17:00:18,268 INFO [RepositoryPersistor] OJB Descriptor Repository: >> jar:file:/C:/IBM/WebSphere/AppServerCommunityEdition/lib/endorsed/ >> ojb-co >> nf.jar!/repository.xml >> 17:00:18,268 INFO [RepositoryPersistor] Building repository from >> :jar:file:/C:/IBM/WebSphere/AppServerCommunityEdition/lib/endorsed/ >> ojb-c >> onf.jar!/repository.xml >> 17:00:18,377 INFO [RepositoryPersistor] Read connection >> repository took >> 109 ms >> 17:00:18,424 INFO [PersistenceBrokerFactoryDefaultImpl] Create >> PersistenceBroker instance pool, pool configuration was >> {whenExhaustedAction=2, maxIdle=-1, maxActive=100, maxWait=2000, >> removeAbandoned=false, numTestsPerEvictionRun=10, >> testWhileIdle=false, >> minEvictableIdleTimeMillis=1000000, testOnReturn=false, >> logAbandoned=false, removeAbandonedTimeout=300, >> timeBetweenEvictionRunsMillis=-1, testOnBorrow=false} >> 17:00:18,424 INFO [WebSphereCETransactionManagerFactory] >> WebSphereCETransactionManagerFactory +++++++++ 1 >> 17:00:18,424 WARN [SystemExceptionInterceptor] SandboxAdminService >> java.lang.NoClassDefFoundError: javax/management/ObjectName >> at >> com..ojb.transaction.WebSphereCETransactionManagerFactory.getTransact >> ion >> Manager(WebSphereCETransactionManagerFactory.java:48) >> at >> org.apache.ojb.broker.core.PersistenceBrokerFactorySyncImpl. >> (Unkno >> wn Source) >> at sun.reflect.NativeConstructorAccessorImpl.newInstance0 >> (Native >> Method) >> at >> sun.reflect.NativeConstructorAccessorImpl.newInstance >> (NativeConstructorA >> ccessorImpl.java(Compiled Code)) >> at >> sun.reflect.DelegatingConstructorAccessorImpl.newInstance >> (DelegatingCons >> tructorAccessorImpl.java(Compiled Code)) >> at >> java.lang.reflect.Constructor.newInstance(Constructor.java(Compiled >> Code)) >> at java.lang.Class.newInstance3(Class.java(Compiled Code)) >> at java.lang.Class.newInstance(Class.java(Compiled Code)) >> at org.apache.ojb.broker.util.ClassHelper.newInstance(Unknown >> Source) >> at >> org.apache.ojb.broker.core.PersistenceBrokerFactoryFactory.init >> (Unknown >> Source) >> at >> org.apache.ojb.broker.core.PersistenceBrokerFactoryFactory. >> (Unkn >> own Source) >> at >> com.xmeta.persistence.orm.impl.ojb.JBossOjbPersistenceBrokerFactory.c >> rea >> tePersistenceBroker(JBossOjbPersistenceBrokerFactory.java:47) >> at >> com.xmeta.persistence.orm.impl.ojb.AbstractOjbPersistenceBrokerFactor >> y.c >> reateBroker(AbstractOjbPersistenceBrokerFactory.java:50) >> at >> com.xmeta.persistence.orm.impl.ojb.OjbObjectPersistence.getBroker >> (OjbObj >> ectPersistence.java:72) >> at >> com.xmeta.persistence.orm.impl.ojb.OjbPersistentEObjectPersistence.ge >> tBr >> oker(OjbPersistentEObjectPersistence.java:162) >> at >> com.xmeta.persistence.orm.impl.ojb.OjbPersistentEObjectPersistenceReg >> ist >> ry.getBroker(OjbPersistentEObjectPersistenceRegistry.java:301) >> at >> com.xmeta.persistence.orm.impl.ojb.OjbPersistentEObjectPersistenceReg >> ist >> ry.loadPackageCache(OjbPersistentEObjectPersistenceRegistry.java:350) >> at >> com.xmeta.persistence.orm.impl.ojb.OjbPersistentEObjectPersistenceReg >> ist >> ry.initialize(OjbPersistentEObjectPersistenceRegistry.java:131) >> at >> com.xmeta.persistence.orm.impl.ojb.OjbPersistentEObjectPersistence.in >> iti >> alize(OjbPersistentEObjectPersistence.java:318) >> at >> com.xmeta.persistence.impl.basic.BasicPersistence.initialize >> (BasicPersis >> tence.java:369) >> at >> com.xmeta.persistence.impl.basic.BasicPersistenceManager.initialize >> (Basi >> cPersistenceManager.java:75) >> at >> com.xmeta.repository.core.impl.DefaultSandboxAdmin. >> (DefaultSandbox >> Admin.java:124) >> at sun.reflect.NativeConstructorAccessorImpl.newInstance0 >> (Native >> Method) >> at >> sun.reflect.NativeConstructorAccessorImpl.newInstance >> (NativeConstructorA >> ccessorImpl.java(Compiled Code)) >> at >> sun.reflect.DelegatingConstructorAccessorImpl.newInstance >> (DelegatingCons >> tructorAccessorImpl.java(Compiled Code)) >> at >> java.lang.reflect.Constructor.newInstance(Constructor.java(Compiled >> Code)) >> at java.lang.Class.newInstance3(Class.java(Compiled Code)) >> at java.lang.Class.newInstance(Class.java(Compiled Code)) >> at >> com.xmeta.repository.core.CoreRepositoryFactory.createSandboxAdmin >> (CoreR >> epositoryFactory.java:153) >> at >> com.xmeta.service.repository.core.SandboxAdminServiceBean. >> (Sandbox >> AdminServiceBean.java:115) >> at >> com.xmeta.service.repository.core.SandboxAdminServiceBean$ >> $FastClassByCG >> LIB$$d9825d07.newInstance() >> at net.sf.cglib.reflect.FastClass.newInstance >> (FastClass.java:91) >> at >> org.openejb.EJBInstanceFactoryImpl.newInstance >> (EJBInstanceFactoryImpl.ja >> va:76) >> at >> org.openejb.sfsb.StatefulInstanceContextFactory.newInstance >> (StatefulInst >> anceContextFactory.java:119) >> at >> org.openejb.sfsb.StatefulInstanceFactory.createInstance >> (StatefulInstance >> Factory.java:86) >> at >> org.openejb.sfsb.StatefulInstanceInterceptor.getInstanceContext >> (Stateful >> InstanceInterceptor.java:144) >> at >> org.openejb.sfsb.StatefulInstanceInterceptor.invoke >> (StatefulInstanceInte >> rceptor.java:92) >> at >> org.openejb.transaction.ContainerPolicy$TxNotSupported.invoke >> (ContainerP >> olicy.java:89) >> at >> org.openejb.transaction.TransactionContextInterceptor.invoke >> (Transaction >> ContextInterceptor.java:80) >> at >> org.openejb.SystemExceptionInterceptor.invoke >> (SystemExceptionInterceptor >> .java:82) >> at >> org.openejb.GenericEJBContainer.invoke(GenericEJBContainer.java:238) >> at >> org.openejb.server.ejbd.EjbRequestHandler.invoke >> (EjbRequestHandler.java: >> 297) >> at >> org.openejb.server.ejbd.EjbRequestHandler.doEjbHome_CREATE >> (EjbRequestHan >> dler.java:342) >> at >> org.openejb.server.ejbd.EjbRequestHandler.processRequest >> (EjbRequestHandl >> er.java:205) >> at org.openejb.server.ejbd.EjbDaemon.service >> (EjbDaemon.java:150) >> at org.openejb.server.ejbd.EjbServer.service >> (EjbServer.java:87) >> at >> org.openejb.server.ejbd.EjbServer$$FastClassByCGLIB$ >> $d379d2ff.invoke(> nerated>) >> at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53) >> at >> org.apache.geronimo.gbean.runtime.FastMethodInvoker.invoke >> (FastMethodInv >> oker.java:38) >> at >> org.apache.geronimo.gbean.runtime.GBeanOperation.invoke >> (GBeanOperation.j >> ava:118) >> at >> org.apache.geronimo.gbean.runtime.GBeanInstance.invoke >> (GBeanInstance.jav >> a:800) >> at >> org.apache.geronimo.gbean.runtime.RawInvoker.invoke >> (RawInvoker.java:57) >> at >> org.apache.geronimo.kernel.basic.RawOperationInvoker.invoke >> (RawOperation >> Invoker.java:36) >> at >> org.apache.geronimo.kernel.basic.ProxyMethodInterceptor.intercept >> (ProxyM >> ethodInterceptor.java:96) >> at >> org.activeio.xnet.ServerService$$EnhancerByCGLIB$$81781c7d.service >> (> rated>) >> at org.activeio.xnet.ServicePool$2.run(ServicePool.java:67) >> at org.activeio.xnet.ServicePool$3.run(ServicePool.java:90) >> at >> org.apache.geronimo.pool.ThreadPool$ContextClassLoaderRunnable.run >> (Threa >> dPool.java:138) >> at >> EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(Unknown >> Source) >> at java.lang.Thread.run(Thread.java:570) >> >> >> The exception is occurred at my newly written java class but the >> class >> javax/management/ObjectName is bundled with mx4j-3.0.1.jar which is >> available at WASCE_HOME\lib. It seems that WASCE class loader is not >> visible to either to EJB or 'endrosed' folder? I am not sure I was >> right >> that LIB folder is parent class loader and the endorsed is a child of >> lib? >> >> Please appreciate your help to resolve this problem. >> >> FYI: I have bundled all dependency Jars into EAR and this is my >> deployment plan >> >> >> >> > xmlns="http://geronimo.apache.org/xml/ns/j2ee/application" >> configId="RXMeta" >> parentId="geronimo/j2ee-server/1.0/car" >>> >> >> >> This is my openejb-jar.xml >> >> >> >> > configId="ejb-RXMeta" >> parentId="geronimo/j2ee-server/1.0/car"> >> >> >> >> ImportService >> ImportService >> >> >> >> >> SandboxService >> SandboxService >> >> >> xmeta_defaultDS >> ASB >> >> >> >> >> >> ObjectDifferencingService >> ObjectDifferencingService >> >> >> >> >> >> GlobalSessionService >> GlobalSessionService >> >> >> >> >> DSImpactAnalysisService >> DSImpactAnalysisService >> >> >> >> OperationalRepositoryService >> OperationalRepositoryService >> >> >> xmeta_defaultDS >> ASB >> >> >> >> >> ExportService >> ExportService >> >> >> >> ImpactAnalysisService >> ImpactAnalysisService >> >> >> >> MetabrokerAdminService >> MetabrokerAdminService >> >> >> >> ObjectMergeService >> ObjectMergeService >> >> >> >> ImportDecodeService >> ImportDecodeService >> >> >> >> OperationalRepositoryAdminService >> OperationalRepositoryAdminService >> >> >> xmeta_defaultDS >> ASB >> >> >> >> >> StaticDataLineageService >> StaticDataLineageService >> >> >> >> SandboxAdminService >> SandboxAdminService >> >> >> xmeta_defaultDS >> ASB >> >> >> >> >> >> >> >> >> >> >> Thanks & Regards, >> Siraj >> >> >> >> >> >> >> >> >> >> >> >> >> >> -----Original Message----- >> From: ammulder@gmail.com [mailto:ammulder@gmail.com] On Behalf Of >> Aaron >> Mulder >> Sent: Monday, March 20, 2006 10:10 PM >> To: user@geronimo.apache.org >> Subject: Re: KernelRegistry does not return a reference to Kernel >> >> If you're working on application code, is there a reason you're >> trying >> to use a TransactionManager instead of getting a UserTransaction from >> JNDI? If you're writing a GBean you should have the >> TransactionManager injected (configured as a reference) instead of >> looking it up. >> >> In any case, it would generally help if you post the stack trace and >> double-check to be absolutely sure that it's definitely the >> getSingleKernel method that's returning null and not some surrounding >> code. In this particular case I'm not sure how much a stack trace >> will help since I'm not sure what SVN revision of Geronimo the WASCE >> code is based on and what IBM might have changed, but it's certainly >> the case that you don't have much of a chance of a better diagnosis >> *without* the stack trace. :) >> >> Thanks, >> Aaron >> >> On 3/20/06, Siraj Mohamed wrote: >>> >>> >>> >>> Hi All, >>> >>> >>> >>> I am using WASCE 1.0.0.1 version and I am trying to get a >>> reference to >> the >>> TransactionManger from a Java class. This is the segment of my java >> class. >>> >>> >>> >>> TransactionManager tm = null; >>> >>> try >>> >>> { >>> >>> ObjectName TM_NAME = new >>> >>> >>> >> ObjectName >> ("geronimo.server:J2EEApplication=null,J2EEModule=geronimo/j2e >> e-server/1.0/ >> car,J2EEServer=geronimo,j2eeType=TransactionManager,name=Tr >> ansactionManager"); >>> >>> >>> >>> >>> >>> Kernel kernel = KernelRegistry.getSingleKernel(); >>> >>> tm = >>> (TransactionManager)kernel.getProxyManager().createProxy(TM_NAME, >>> >>> TransactionManager.class); >>> >>> >>> >>> }catch (Exception e) >>> >>> { >>> >>> throw new >>> TransactionManagerFactoryException(e.getMessage()); >>> >>> } >>> >>> >>> >>> This code does not work for me and I get a null return value when >> trying to >>> get the Kernel (KernelRegistry.getSingleKernel()). >>> >>> >>> >>> Am I missing some thing else? My WASCE application server is running >> up and >>> down. >>> >>> >>> >>> Please help me if any one knows the solution. >>> >>> >>> >>> Thanks and Regards, >>> >>> Siraj >>