dev@glassfish.java.net

Re: InvocationException thrown when access JavaDB via JNDI

From: Jim Jiang <jim.jiang_at_sun.com>
Date: Mon, 26 Feb 2007 15:18:00 +0800

Hi Binod,

Binod wrote:

> Hi Jim,
>
>> I tried to accesss Glassfish Java DB use JNDI, as below code:
>>
>> / InitialContext ic = new InitialContext();
>> DataSource ds = (DataSource)ic.lookup("jdbc/demo_ds");
>> connection = ds.getConnection();
>> /
>> The JDBC Resource "/jdbc/demo_ds/" was created in advance, and
>> binding with default pool 'DerbyPool'.
>> I deployed my app as custom mbean by admin console, and invoked its
>> method for setup connection via *jconsole*, I got following error
>> message:
>>
>> /[#|2007-02-24T18:27:44.422+0800|WARNING|sun-appserver-pe9.0|javax.enterprise.system.stream.err|_ThreadID=21;_ThreadName=RMI
>> TCP
>> Connection(29)-192.168.0.100;_RequestID=e21fa16f-592c-4e82-abf7-a5fc28003602;|
>>
>> com.sun.enterprise.InvocationException
>> at
>> com.sun.enterprise.resource.ResourceManagerImpl.getTransaction(ResourceManagerImpl.java:59)
>>
>> at
>> com.sun.enterprise.resource.PoolManagerImpl.getResource(PoolManagerImpl.java:171)
>>
>> at
>> com.sun.enterprise.connectors.ConnectionManagerImpl.internalGetConnection(ConnectionManagerImpl.java:312)
>>
>> at
>> com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:176)
>>
>> at
>> com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:152)
>>
>> at
>> com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:145)
>>
>> at com.sun.gjc.spi.DataSource.getConnection(DataSource.java:93)
>> at demo.glassfish.SampleDB.setupConnection(SampleDB.java:85)
>> at demo.glassfish.SampleDB.getUsers(SampleDB.java:112)
>> at demo.glassfish.SampleDB.getLatestUserInfo(SampleDB.java:49)
>> .....
>> /
>> Any hint or idea?
>
> Since you are trying to access the resource from a non-javaee
> component like custom mbean,
> you are hitting this issue. Please use Allow-NonComponent-Callers flag
> (modify the pool from admin GUI)
> to solve this issue.
>
I added the property Allow-NonComponent-Callers = true for DerbyPool,
but it doesn't work.
The related part in domain.xml look as below after modification:
/ <jdbc-connection-pool allow-non-component-callers="false"
connection-validation-method="auto-commit"
datasource-classname="org.apache.derby.jdbc.ClientDataSource"
fail-all-connections="false" idle-timeout-in-seconds="800"
is-connection-validation-required="false"
is-isolation-level-guaranteed="false" max-pool-size="14"
max-wait-time-in-millis="60000" name="DerbyPool"
non-transactional-connections="false" pool-resize-quantity="2"
res-type="javax.sql.DataSource" steady-pool-size="8">
      <property name="PortNumber" value="1527"/>
      <property name="Password" value="APP"/>
      <property name="User" value="APP"/>
      <property name="serverName" value="localhost"/>
      <property name="DatabaseName" value="sampledb"/>
      <property name="connectionAttributes" value=";create=true"/>
      <property name="Allow-NonComponent-Callers" value="true"/>
    </jdbc-connection-pool>/

Thanks,
Jim

> http://www.glassfishwiki.org/gfwiki/Wiki.jsp?page=NonComponentCallers
>
> thanks,
> Binod.
>
>>
>> Thanks,
>> jim
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net For
>> additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>