You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Will Sargent <ws...@tersesystems.com> on 2002/09/13 23:08:34 UTC

Cannot create resource instance / Tomcat hacking

I'm getting an error in Tomcat 4.1.10 when I start up Roller
(http://rollerweblogger.org).

2002-09-12 21:45:08 ROLLER> PersistenceException getting database connection
[org.exolab.castor.jdo.DatabaseNotFoundException: Nested error:
javax.naming.NamingException: Cannot create resource instance]
javax.naming.NamingException: Cannot create resource instance
	at
org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.
java:189)
	at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:301)
	at org.apache.naming.NamingContext.lookup(NamingContext.java:834)
	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:347)
	at org.exolab.castor.jdo.engine.DatabaseRegistry.loadDatabase(Unknown
Source)
	at org.exolab.castor.jdo.JDO.getDatabase(Unknown Source)
	at org.roller.business.castor.ManagerBase.getDatabase(ManagerBase.java:63)
	at
org.roller.business.castor.UserManagerImpl.getUsers(UserManagerImpl.java:569
)


Well, from the stack trace I have, I can trace it back down to the Tomcat
4.1.10 source code, line 189.  These lines are responsible:

            if (factory != null) {
                return factory.getObjectInstance
                    (obj, name, nameCtx, environment);
            } else {
                throw new NamingException
                    ("Cannot create resource instance");
            }

So the factory is null.  Looking at the source code, I'm not very happy with
how Tomcat eats exceptions.  The idea seems to be that a ObjectFactory is
generated out of somewhere, but I don't know where the generative class
would be set up.

I think the factory's supposed to come from here:

                if (ref.getClassName().equals("javax.sql.DataSource")) {
                    String javaxSqlDataSourceFactoryClassName =
                        System.getProperty("javax.sql.DataSource.Factory",

Constants.DBCP_DATASOURCE_FACTORY);
                    try {
                        factory = (ObjectFactory)

Class.forName(javaxSqlDataSourceFactoryClassName)
                            .newInstance();
                    } catch(Throwable t) {

                    }

but I don't know what's going wrong with that.

Someone tell me how I'm supposed to set up javax.sql.DataSource.Factory?

Will.





--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>