users@glassfish.java.net

How to retrieve Connection object from the COnnectionFacotory

From: Rama Sundari <sundari.drs_at_gmail.com>
Date: Thu, 4 Sep 2008 14:46:52 +0530

hi...,

I have deployed the ResourceAdapter implementaion (rar) using glassfish..

and i am able to lookup using initialconetext().
now if i am trying to get the connection object from the ConectionFactory
object obtained through lookup..its showing some exceptions..
The code inside getConnection() is

Object con = *null*;

con = *new* ConnectionImpl();

*return* (Connection)con;

i returing a connection object of type javax.resource.cci.Connection and
also trying to retrieve the same.....but i dont know why it is raising
classcastexception..

what does this line mean...

RAR7099: The mcf being used to allocate the connection and the MCF in the
pool are not equal.



the server logs are:

LDR5010: All ejb(s) of [RAExample] loaded successfully!
RAR7099: The mcf being used to allocate the connection and the MCF in the
pool are not equal.
exception naming
java.lang.ClassCastException: com.tedia.ra.cci.ConnectionImpl cannot be cast
to com.sun.corba.se.pept.transport.Connection
        at
com.tedia.ra.spi.ManagedConnectionImpl.getConnection(ManagedConnectionImpl.java:45)
        at
com.sun.enterprise.resource.NoTxConnectorAllocator.fillInResourceObjects(NoTxConnectorAllocator.java:139)
        at
com.sun.enterprise.resource.AbstractResourcePool.getResource(AbstractResourcePool.java:502)
        at
com.sun.enterprise.resource.PoolManagerImpl.getResourceFromPool(PoolManagerImpl.java:248)
        at
com.sun.enterprise.resource.PoolManagerImpl.getResource(PoolManagerImpl.java:176)
        at
com.sun.enterprise.connectors.ConnectionManagerImpl.internalGetConnection(ConnectionManagerImpl.java:313)
        at
com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:235)
        at
com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:165)
        at
com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:158)
        at
com.tedia.ra.cci.ConnectionFactoryImpl.getConnection(ConnectionFactoryImpl.java:45)
        at
com.tedia.ra.cci.ConnectionFactoryImpl.getConnection(ConnectionFactoryImpl.java:36)
        at com.ra.ServletRA.doGet(ServletRA.java:70)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:718)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
        at
org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:317)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
        at
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
        at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:288)
        at
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271)
        at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202)
        at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
        at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
        at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206)
        at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
        at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
        at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150)
        at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
        at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
        at
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:272)
        at
com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637)
        at
com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568)
        at
com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813)
        at
com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341)
        at
com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263)
        at
com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214)
        at
com.sun.enterprise.web.portunif.PortUnificationPipeline$PUTask.doTask(PortUnificationPipeline.java:380)
        at
com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
        at
com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)


please help me...wat to do..

thanks in advance...

-- 
Thanks,
Rama Sundari.