I have two different jndi resources I'm trying to setup in tomcat 4. The 
first is a javax.sql.Datasource, the second is a 
com.sun.forte4j.persistence.PersistenceManagerFactoryImpl.

1. The datasource works, but doesn't seem to be pooling. Any clues? what's 
with this tyrex i keep reading about. :)

2. The PersistenceManagerFactoryImpl doesn't work. I get this error:
------
javax.naming.NamingException: Cannot create resource instance
        at 
org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:167)
        at 
javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:311)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:835)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
        at org.apache.naming.NamingContext.lookup(NamingContext.java:194)
        at 
org.apache.naming.SelectorContext.lookup(SelectorContext.java:183)
        at javax.naming.InitialContext.lookup(InitialContext.java:354)
------

I don't know if I really need to set this up in jndi, or not, but I was 
also having problems just creating it from the datasource, so I thought 
I'd give it a try. My server.xml, web.xml, and code bits are below.

Thanks,

Daryn



Server.xml
----------
<Resource name="jdbc/sadb" auth="Container" type="javax.sql.DataSource"/>
        <ResourceParams name="jdbc/sadb">
                <parameter>
                        <name>driverClassName</name>
                        <value>org.gjt.mm.mysql.Driver</value>
                </parameter>
                <parameter>
                        <name>driverName</name>
                        <value>jdbc:mysql://127.0.0.1/dbmail</value>
                </parameter>
                <parameter>
                        <name>user</name>
                        <value>foo</value>
                </parameter>
                <parameter>
                        <name>password</name>
                        <value>bar</value>
                </parameter>
        </ResourceParams>

<Resource name="jdo/sajdo" auth="Container" 
type="com.sun.forte4j.persistence.PersistenceM
anagerFactoryImpl"/>
        <ResourceParams name="jdo/sajdo">
                <parameter>
                        <name>ConnectionFactoryName</name>
                        <value>jdbc/sadb</value>
                </parameter>
        </ResourceParams>

-----------------------
web.xml
  <resource-ref>
    <res-ref-name>
      jdbc/sadb
    </res-ref-name>
    <res-type>
      javax.sql.DataSource
    </res-type>
    <res-auth>
      Container
    </res-auth>
  </resource-ref>
  <resource-ref>
    <res-ref-name>
      jdo/sajdo
    </res-ref-name>
    <res-type>
      com.sun.forte4j.persistence.PersistenceManagerFactoryImpl
    </res-type>
    <res-auth>
      Container
    </res-auth>
  </resource-ref>

---------------------

code (servlet that is loaded on startup, this is in init() )
---------

InitialContext initialContext = new InitialContext();

ds = (DataSource) initialContext.lookup("java:comp/env/jdbc/sadb");

pmf = (PersistenceManagerFactoryImpl) initialContext.lookup("java:comp/env/jdo/saj
do");


it chokes on the second line. 


I've also tried 

pmf = new PersistenceManagerFactoryImpl();
pmf.setConnectionFactoryName("java:comp/env/jdbc/sadb");

to no avail..




--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

Reply via email to