geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Siraj Mohamed" <Si...@virtusa.com>
Subject RE: KernelRegistry does not return a reference to Kernel + class loader issue
Date Wed, 22 Mar 2006 11:12:58 GMT
Thank you very much Aaron and David for your reply.

As David suggested, I moved ojb related jars into repository and I added
them as dependency in my deployment plan then the class loader issue was
resolved. Now my class (WebSphereCETransactionManagerFactory) returns a
reference to TransactionManager.

Moving forward, the ojb could not find the data source when it trying to
look up it and I am getting errors like looking up DataSource
(java:comp/env/xmeta_defaultDS
javax.naming.NameNotFoundException: comp/env/xmeta_defaultDS). I am also
attaching my openejb.jar.xml, ejb-jar.xml and the database deployment
plan below.

This is the full stack trace of the errors.

16:03:26,554 INFO  [RepositoryPersistor] OJB Descriptor Repository:
jar:file:/C:/IBM/WebSphere/AppServerCommunityEdition/lib/endorsed/ojb-co
nf.jar!/repository.xml
16:03:26,554 INFO  [RepositoryPersistor] Building repository from
:jar:file:/C:/IBM/WebSphere/AppServerCommunityEdition/lib/endorsed/ojb-c
onf.jar!/repository.xml
16:03:27,132 INFO  [RepositoryPersistor] Read class descriptors took 578
ms
16:03:27,132 INFO  [RepositoryPersistor] OJB Descriptor Repository:
jar:file:/C:/IBM/WebSphere/AppServerCommunityEdition/lib/endorsed/ojb-co
nf.jar!/repository.xml
16:03:27,132 INFO  [RepositoryPersistor] Building repository from
:jar:file:/C:/IBM/WebSphere/AppServerCommunityEdition/lib/endorsed/ojb-c
onf.jar!/repository.xml
16:03:27,242 INFO  [RepositoryPersistor] Read connection repository took
110 ms
16:03:27,320 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}
16:03:27,351 INFO  [WebSphereCETransactionManagerFactory]
WebSphereCETransactionManagerFactory +++++++++ 1
16:03:27,351 INFO  [WebSphereCETransactionManagerFactory]
WebSphereCETransactionManagerFactory +++++++++ 2  :
geronimo.server:J2EEApplication=null,J2EEModule=geronimo/j2ee-server/1.0
/car,J2EEServer=geronimo,j2eeType=TransactionManager,name=TransactionMan
ager
16:03:27,351 INFO  [WebSphereCETransactionManagerFactory]
WebSphereCETransactionManagerFactory +++++++++ 3  :
org.apache.geronimo.kernel.basic.BasicKernel@490c8bdb
16:03:27,367 INFO  [WebSphereCETransactionManagerFactory]
WebSphereCETransactionManagerFactory +++++++++ 4  :
[$javax.transaction.TransactionManager$$EnhancerByCGLIB$$8eb26303:
geronimo.server:J2EEApplication=null,J2EEModule=geronimo/j2ee-server/1.0
/car,J2EEServer=geronimo,j2eeType=TransactionManager,name=TransactionMan
ager]
16:03:27,382 INFO  [PersistenceBrokerFactoryBaseImpl] Create new PB
instance for PBKey org.apache.ojb.broker.PBKey: jcdAlias=default,
user=null, password=null, already created persistence broker instances:
0
16:03:27,445 INFO  [ObjectCacheFactory] Start creating new ObjectCache
instance
16:03:27,445 INFO  [ObjectCacheFactory] Default ObjectCache class was
org.apache.ojb.broker.cache.ObjectCachePerBrokerImpl
16:03:27,445 INFO  [CacheDistributor] Use property
'descriptorBasedCaches' is set 'false'
16:03:27,445 INFO  [ObjectCacheFactory] Instantiate new
org.apache.ojb.broker.cache.CacheDistributor class object
16:03:27,460 INFO  [ObjectCacheFactory] New ObjectCache instance was
created
16:03:27,617 ERROR [ConnectionFactoryAbstractImpl] Naming Exception
while looking up DataSource (java:comp/env/xmeta_defaultDS)
javax.naming.NameNotFoundException: comp/env/xmeta_defaultDS
	at
org.apache.geronimo.naming.java.RootContext.lookup(RootContext.java:45)
	at javax.naming.InitialContext.lookup(InitialContext.java:361)
	at
org.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl.newConne
ctionFromDataSource(Unknown Source)
	at
org.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl.lookupCo
nnection(Unknown Source)
	at
org.apache.ojb.broker.accesslayer.ConnectionFactoryManagedImpl.lookupCon
nection(Unknown Source)
	at
org.apache.ojb.broker.accesslayer.ConnectionManagerImpl.getConnection(Un
known Source)
	at
org.apache.ojb.broker.accesslayer.StatementManager.getPreparedStatement(
Unknown Source)
	at
org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeQuery(Unknown
Source)
	at
org.apache.ojb.broker.accesslayer.RsQueryObject.performQuery(Unknown
Source)
	at org.apache.ojb.broker.accesslayer.RsIterator.<init>(Unknown
Source)
	at
org.apache.ojb.broker.core.RsIteratorFactoryImpl.createRsIterator(Unknow
n Source)
	at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getRsIteratorFromQuery(
Unknown Source)
	at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getIteratorFromQuery(Un
known Source)
	at
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unk
nown Source)
	at
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unk
nown Source)
	at
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unk
nown Source)
	at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Un
known Source)
	at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQu
ery(Unknown Source)
	at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQu
ery(Unknown Source)
	at
com.xmeta.persistence.orm.impl.ojb.OjbPersistentEObjectPersistenceRegist
ry.loadPackageCache(OjbPersistentEObjectPersistenceRegistry.java:352)
	at
com.xmeta.persistence.orm.impl.ojb.OjbPersistentEObjectPersistenceRegist
ry.initialize(OjbPersistentEObjectPersistenceRegistry.java:131)
	at
com.xmeta.persistence.orm.impl.ojb.OjbPersistentEObjectPersistence.initi
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.<init>(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.<init>(Sandbox
AdminServiceBean.java:115)
	at
com.xmeta.service.repository.core.SandboxAdminServiceBean$$FastClassByCG
LIB$$d9825d07.newInstance(<generated>)
	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(<ge
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$$2875fc9d.service(<gene
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)
16:03:27,617 ERROR [JdbcAccessImpl] PersistenceBrokerException during
the execution of the query: Used ConnectionManager instance could not
obtain a connection
org.apache.ojb.broker.PersistenceBrokerException: Used ConnectionManager
instance could not obtain a connection
	at
org.apache.ojb.broker.accesslayer.StatementManager.getPreparedStatement(
Unknown Source)
	at
org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeQuery(Unknown
Source)
	at
org.apache.ojb.broker.accesslayer.RsQueryObject.performQuery(Unknown
Source)
	at org.apache.ojb.broker.accesslayer.RsIterator.<init>(Unknown
Source)
	at
org.apache.ojb.broker.core.RsIteratorFactoryImpl.createRsIterator(Unknow
n Source)
	at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getRsIteratorFromQuery(
Unknown Source)
	at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getIteratorFromQuery(Un
known Source)
	at
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unk
nown Source)
	at
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unk
nown Source)
	at
org.apache.ojb.broker.core.QueryReferenceBroker.getCollectionByQuery(Unk
nown Source)
	at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Un
known Source)
	at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQu
ery(Unknown Source)
	at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getCollectionByQu
ery(Unknown Source)
	at
com.xmeta.persistence.orm.impl.ojb.OjbPersistentEObjectPersistenceRegist
ry.loadPackageCache(OjbPersistentEObjectPersistenceRegistry.java:352)
	at
com.xmeta.persistence.orm.impl.ojb.OjbPersistentEObjectPersistenceRegist
ry.initialize(OjbPersistentEObjectPersistenceRegistry.java:131)
	at
com.xmeta.persistence.orm.impl.ojb.OjbPersistentEObjectPersistence.initi
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.<init>(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.<init>(Sandbox
AdminServiceBean.java:115)
	at
com.xmeta.service.repository.core.SandboxAdminServiceBean$$FastClassByCG
LIB$$d9825d07.newInstance(<generated>)
	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(<ge
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$$2875fc9d.service(<gene
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)

This is my database deployment plan for MySQL:

<?xml version="1.0"?>

<connector xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector" 
           configId="ASBJDBCProvider" 
           parentId="geronimo/j2ee-server/1.0/car">
<dependency>	 	
    <groupId>mysql</groupId>
    <artifactId>mysql</artifactId>
    <version>3.0</version>    	
</dependency>
<resourceadapter>
  <outbound-resourceadapter>
    <connection-definition>
      <connectionfactory-interface> 
        javax.sql.DataSource 
      </connectionfactory-interface>
      <connectiondefinition-instance>
        <name>ASBJDBCProvider</name>
        <config-property-setting name="UserName"> 
          xmeta 
        </config-property-setting>
        <config-property-setting name="Password"> 
          xmeta
        </config-property-setting>
        <config-property-setting name="Driver"> 
          com.mysql.jdbc.Driver 
        </config-property-setting>
        <config-property-setting name="ConnectionURL">
          jdbc:mysql://localhost:3306/xmeta
        </config-property-setting>
        <config-property-setting name="CommitBeforeAutocommit"> 
           false 
        </config-property-setting>
        <config-property-setting name="ExceptionSorterClass"> 
           org.tranql.connector.NoExceptionsAreFatalSorter
        </config-property-setting>

        <connectionmanager>
          <local-transaction/>
          <single-pool>
             <max-size>10</max-size>
             <min-size>1</min-size>
             <blocking-timeout-milliseconds> 
                5000 
              </blocking-timeout-milliseconds>
              <idle-timeout-minutes>
                30
              </idle-timeout-minutes>
              <match-one/>
          </single-pool>
        </connectionmanager>
      </connectiondefinition-instance>
    </connection-definition>
  </outbound-resourceadapter>
</resourceadapter>
</connector>

This is the segment of openejb-jar.xml

<?xml version="1.0"?>

<openejb-jar xmlns="http://www.openejb.org/xml/ns/openejb-jar" 
configId="ejb-RXMeta" 
parentId="ASBJDBCProvider">

<enterprise-beans> 
      <session>
         <ejb-name>ImportService</ejb-name>
         <jndi-name>ImportService</jndi-name>

      </session>

      <session>
         <ejb-name>SandboxService</ejb-name>
         <jndi-name>SandboxService</jndi-name>

         <resource-ref>
            <ref-name>xmeta_defaultDS</ref-name>
            <resource-link>ASBJDBCProvider</resource-link>
         </resource-ref>

      </session>

      <session>
         <ejb-name>SandboxAdminService</ejb-name>
         <jndi-name>SandboxAdminService</jndi-name>

         <resource-ref>
            <ref-name>xmeta_defaultDS</ref-name>
            <resource-link>ASBJDBCProvider</resource-link>
         </resource-ref>


      </session>

      ...............

</enterprise-beans> 
</openejb-jar>

This is the segment of the ejb-jar.xml 

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise
JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">

<ejb-jar id="ejb-jar_1">

   <description><![CDATA[No Description.]]></description>
   <display-name>Generated by XDoclet</display-name>

   <enterprise-beans>

      <!-- Session Beans -->
      <session id="Session_ImportService">
         <description><![CDATA[The bean implementation class for the
Import service EJB, which supports persisting decoded instances into the
XMeta repository for imports.]]></description>

         <ejb-name>ImportService</ejb-name>

 
<home>com.xmeta.shared.analysis.importexport.IImportServiceHome</home>
 
<remote>com.xmeta.shared.analysis.importexport.IImportService</remote>
 
<ejb-class>com.xmeta.service.analysis.importexport.ImportServiceBean</ej
b-class>
         <session-type>Stateless</session-type>
         <transaction-type>Container</transaction-type>

      </session>

      <session id="Session_SandboxService">
         <description><![CDATA[The bean implementation class for the
Sandbox Service EJB.]]></description>

         <ejb-name>SandboxService</ejb-name>

 
<home>com.xmeta.shared.repository.core.ISandboxServiceHome</home>
 
<remote>com.xmeta.shared.repository.core.ISandboxService</remote>
 
<ejb-class>com.xmeta.service.repository.core.SandboxServiceBean</ejb-cla
ss>
         <session-type>Stateful</session-type>
         <transaction-type>Bean</transaction-type>

         <resource-ref id="ResRef_1">
            <res-ref-name>xmeta_defaultDS</res-ref-name>
            <res-type>javax.sql.DataSource</res-type>
            <res-auth>Container</res-auth>
            <res-sharing-scope>Shareable</res-sharing-scope>
         </resource-ref>

      </session>

<session id="Session_SandboxAdminService">
         <description><![CDATA[The bean implementation class for the
Sandbox Admin Service EJB.]]></description>

         <ejb-name>SandboxAdminService</ejb-name>

 
<home>com.xmeta.shared.repository.core.ISandboxAdminServiceHome</home>
 
<remote>com.xmeta.shared.repository.core.ISandboxAdminService</remote>
 
<ejb-class>com.xmeta.service.repository.core.SandboxAdminServiceBean</ej
b-class>
         <session-type>Stateful</session-type>
         <transaction-type>Bean</transaction-type>

         <resource-ref id="ResRef_4">
            <res-ref-name>xmeta_defaultDS</res-ref-name>
            <res-type>javax.sql.DataSource</res-type>
            <res-auth>Container</res-auth>
            <res-sharing-scope>Shareable</res-sharing-scope>
         </resource-ref>

      </session>

      ................
</ejb-jar>

Am I missing any configuration for the data source? Appreciate your help

Thanks & Regards,
Siraj



-----Original Message-----
From: David Jencks [mailto:david_jencks@yahoo.com] 
Sent: Tuesday, March 21, 2006 11:24 PM
To: user@geronimo.apache.org
Subject: Re: KernelRegistry does not return a reference to Kernel +
class loader issue

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.<init> 
> (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 <Siraj@virtusa.com> 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.<init> 
>> (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.<clinit> 
>> (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.<init> 
>> (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.<init> 
>> (Sandbox
>> AdminServiceBean.java:115)
>>         at
>> com.xmeta.service.repository.core.SandboxAdminServiceBean$ 
>> $FastClassByCG
>> LIB$$d9825d07.newInstance(<generated>)
>>         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(<ge
>> 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 
>> (<gene
>> 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
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>>
>> <application
>>      xmlns="http://geronimo.apache.org/xml/ns/j2ee/application"
>>      configId="RXMeta"
>>    parentId="geronimo/j2ee-server/1.0/car"
>>>
>> </application>
>>
>> This is my openejb-jar.xml
>>
>> <?xml version="1.0"?>
>>
>> <openejb-jar xmlns="http://www.openejb.org/xml/ns/openejb-jar"
>> configId="ejb-RXMeta"
>> parentId="geronimo/j2ee-server/1.0/car">
>>
>> <enterprise-beans>
>>       <session>
>>          <ejb-name>ImportService</ejb-name>
>>          <jndi-name>ImportService</jndi-name>
>>
>>       </session>
>>
>>       <session>
>>          <ejb-name>SandboxService</ejb-name>
>>          <jndi-name>SandboxService</jndi-name>
>>
>>          <resource-ref>
>>             <ref-name>xmeta_defaultDS</ref-name>
>>             <resource-link>ASB</resource-link>
>>          </resource-ref>
>>
>>       </session>
>>
>>       <session>
>>          <ejb-name>ObjectDifferencingService</ejb-name>
>>          <jndi-name>ObjectDifferencingService</jndi-name>
>>
>>
>>       </session>
>>
>>       <session>
>>          <ejb-name>GlobalSessionService</ejb-name>
>>          <jndi-name>GlobalSessionService</jndi-name>
>>
>>       </session>
>>
>>       <session>
>>          <ejb-name>DSImpactAnalysisService</ejb-name>
>>          <jndi-name>DSImpactAnalysisService</jndi-name>
>>       </session>
>>
>>       <session>
>>          <ejb-name>OperationalRepositoryService</ejb-name>
>>          <jndi-name>OperationalRepositoryService</jndi-name>
>>
>>          <resource-ref>
>>             <ref-name>xmeta_defaultDS</ref-name>
>>             <resource-link>ASB</resource-link>
>>          </resource-ref>
>>
>>       </session>
>>       <session>
>>          <ejb-name>ExportService</ejb-name>
>>          <jndi-name>ExportService</jndi-name>
>>
>>       </session>
>>       <session>
>>          <ejb-name>ImpactAnalysisService</ejb-name>
>>          <jndi-name>ImpactAnalysisService</jndi-name>
>>
>>       </session>
>>       <session>
>>          <ejb-name>MetabrokerAdminService</ejb-name>
>>          <jndi-name>MetabrokerAdminService</jndi-name>
>>
>>       </session>
>>       <session>
>>          <ejb-name>ObjectMergeService</ejb-name>
>>          <jndi-name>ObjectMergeService</jndi-name>
>>
>>       </session>
>>       <session>
>>          <ejb-name>ImportDecodeService</ejb-name>
>>          <jndi-name>ImportDecodeService</jndi-name>
>>
>>       </session>
>>       <session>
>>          <ejb-name>OperationalRepositoryAdminService</ejb-name>
>>          <jndi-name>OperationalRepositoryAdminService</jndi-name>
>>
>>          <resource-ref>
>>             <ref-name>xmeta_defaultDS</ref-name>
>>             <resource-link>ASB</resource-link>
>>          </resource-ref>
>>
>>       </session>
>>       <session>
>>          <ejb-name>StaticDataLineageService</ejb-name>
>>          <jndi-name>StaticDataLineageService</jndi-name>
>>
>>       </session>
>>       <session>
>>          <ejb-name>SandboxAdminService</ejb-name>
>>          <jndi-name>SandboxAdminService</jndi-name>
>>
>>          <resource-ref>
>>             <ref-name>xmeta_defaultDS</ref-name>
>>             <resource-link>ASB</resource-link>
>>          </resource-ref>
>>
>>
>>       </session>
>>
>> </enterprise-beans>
>>
>> </openejb-jar>
>>
>>
>> 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 <Siraj@virtusa.com> 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
>>


Mime
View raw message