Hello,
I'd like to know if anyone is using J2EE defined
datasources in Cocoon?
I'm trying unsucessfully to connect to a MySQL
database using the Orion J2EE server. I've defined a
datasource in Orion:
<data-source
name="Mysql"
class="com.evermind.sql.DriverManagerDataSource"
schema="database-schemas/mysql.xml"
location="jdbc/MysqlDS"
xa-location="jdbc/xa/MysqlXADS"
ejb-location="jdbc/MysqlDS"
connection-driver="org.gjt.mm.mysql.Driver"
username="root"
password=""
url="jdbc:mysql://localhost/myhms"
inactivity-timeout="30"
/>
I can get a javax.sql.DataSource using the following
code from within a custom class called by a custom
Transformer:
DataSource ds = (DataSource) new
InitialContext().lookup("jdbc/MysqlDS");
I then defined this datasource in cocoon.xconf:
<j2ee name="myhms-datasource">
<dbname>MysqlDS</dbname>
</j2ee>
When Cocoon starts, this occurs in the error.log:
ERROR (2002-06-27) 11:58.24:441
[core.datasources.myhms-datasource] (Unknown-URI)
Unknown-thread/LogKitLogger: Problem with JNDI lookup
of datasource
javax.naming.NameNotFoundException: jdbc/MysqlDS not
found in Cocoon2 Demo
at com.evermind._lj.lookup(.:49)
at com.evermind._bm._es(.:121)
at com.evermind._bm.lookup(.:63)
at
javax.naming.InitialContext.lookup(InitialContext.java:345)
at
org.apache.avalon.excalibur.datasource.J2eeDataSource.configure(J2eeDataSource.java:63)
at
org.apache.avalon.excalibur.component.DefaultComponentFactory.newInstance(DefaultComponentFactory.java:172)
at
org.apache.avalon.excalibur.component.ThreadSafeComponentHandler.initialize(ThreadSafeComponentHandler.java:84)
at
org.apache.avalon.excalibur.component.ExcaliburComponentSelector.addComponent(ExcaliburComponentSelector.java:467)
at
org.apache.avalon.excalibur.component.ExcaliburComponentSelector.configure(ExcaliburComponentSelector.java:354)
at
org.apache.avalon.excalibur.component.DefaultComponentFactory.newInstance(DefaultComponentFactory.java:172)
at
org.apache.avalon.excalibur.component.ThreadSafeComponentHandler.initialize(ThreadSafeComponentHandler.java:84)
at
org.apache.avalon.excalibur.component.ExcaliburComponentManager.initialize(ExcaliburComponentManager.java:167)
at
org.apache.cocoon.Cocoon.initialize(Cocoon.java:269)
at
org.apache.cocoon.servlet.CocoonServlet.createCocoon(CocoonServlet.java:1212)
at
org.apache.cocoon.servlet.CocoonServlet.init(CocoonServlet.java:407)
I haven't worked with JNDI before. What am I missing?
I looked at J2eeDataSource.java and found it was
calling InitialContext.lookup( "java:comp/env/jdbc/" +
"MysqlDS")
I tried changing the datasource location attribute to
"java:comp/env/jdbc/MysqlDS" which didn't do anything,
not that I was really expecting it to...
__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html>
To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>