|
NameNotFoundException when trying to get MySQL DataSource: msg#00018text.xml.resin.user
Hello all, I'm in the process of setting up a Cocoon web app. Initially i was planning to use PostgreSQL and had that running fine, but recently decided to consolidate everything on MySQL. Unfortunately, i haven't been able to get Resin to talk to the database. i've tried all the instructions in the Resin 3.0.3 docs, and looked over the MySQL and MySQL Connector/J docs, but nothing seems to work. Your help would be much appreciated!! :) - Setup is as follows: - Red Hat Linux 9.0 - MySQL 3.2.58 (binary install) - MySQL Connector/J (mysql-connector-java-3.0.11-stable-bin.jar) - Resin 3.0.3 - Cocoon 2.1.2 - The resin directory and its contents are owned by the user 'resin'. - The cocoon webapp directory and its contents are owned by the user 'resin'. - The MySQL database 'test' exists and has tables with records in them. - MySQL user records have been created for resin@localhost, resin@xxxxxxxxx, and resin@[dev mechine's IP addr], and access has been granted to the database 'test'. Password is not used (though i tried this and couldnt get it to work). - It is possible to log in to the MySQL database from the command line as the user 'resin' (not using password). All tables and sample data are visible. $ whoami resin $ mysql -u resin test Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 78 to server version: 4.0.18-standard-log Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> - It is possible to see all the tables and data in MySQL Command Center (logged in across the network as mysql root). - MySQL Connector/J jarfile (mysql-connector-java-3.0.11-stable-bin.jar) is installed in resin/lib. - The relevant parts of resin.conf are: <host id=''> <web-app id='/' document-directory='/usr/local/cocoon/build/webapp'> <database> <jndi-name>jdbc/mysql</jndi-name> <driver type="com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource"> <url>jdbc:mysql://localhost:3306/test</url> <user>resin</user> <password></password> </driver> </database> </web-app> </host> - The connection pool is sought using the following code. For context, this is an application class that is called by a Cocoon webapp (i.e. i'm not using Cocoon's database access for this part). private final static String DATASOURCE_NAME = "jdbc/mysql"; private static DataSource pool = null; public static DataSource getPool() { Tools.log("DirectoryManager.getPool("+DATASOURCE_NAME+")"); if (pool == null) { try { Context env = (Context) new InitialContext().lookup("java:comp/env"); Tools.log("DirectoryManager.getPool("+DATASOURCE_NAME+"): context env:"+env.toString()); pool = (DataSource) env.lookup(DATASOURCE_NAME); Tools.log("DirectoryManager.getPool("+DATASOURCE_NAME+"): got pool: "+pool); Tools.log("DirectoryManager.getPool("+DATASOURCE_NAME+"): OK"); } catch (Exception e) { Tools.err(e, "DirectoryManager.getPool("+DATASOURCE_NAME+")"); } } return pool; } - Resin is start as the user 'resin'. [root@redhatdev root]# su resin bash-2.05b$ /usr/local/resin/bin/httpd.sh start & [1] 17222 bash-2.05b$ Resin httpd start at Tue Mar 2 10:58:45 PST 2004 - Resin and MySQL are both running. :) $ ps -ef | grep resin root 16608 16101 0 10:02 pts/3 00:00:00 su resin resin 16609 16608 0 10:02 pts/3 00:00:00 bash resin 16838 1 0 10:11 pts/3 00:00:00 perl bin/wrapper.pl -chdir -name httpd -class com.caucho.server.resin.Resin start resin 16840 16838 0 10:11 pts/3 00:00:00 sh -c /usr/local/j2sdk/bin/java -Dresin.home=/usr/local/resin -Djava.util.logging.manager=com.caucho.log.LogManagerImpl com.caucho.server.resin.Resin -socketwait 39239 -stdout /usr/local/resin/log/stdout.log -stderr /usr/local/resin/log/stderr.log 1>> /usr/local/resin resin 16841 16840 1 10:11 pts/3 00:00:10 /usr/local/j2sdk/bin/java -Dresin.home=/usr/local/resin -Djava.util.logging.manager=com.caucho.log.LogManagerImpl com.caucho.server.resin.Resin -socketwait 39239 -stdout /usr/local/resin/log/stdout.log -stderr /usr/local/resin/log/stderr.log jefurii 16884 16019 0 10:26 pts/5 00:00:00 grep resin $ ps -ef | grep mysql mysql 26263 1 0 Feb27 ? 00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --user=mysql mysql 26284 26263 0 Feb27 ? 00:00:50 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --pid-file=/usr/local/mysql/data/redhatdev.pid --skip-locking --port=3306 --socket=/tmp/mysql.sock jefurii 16886 16019 0 10:27 pts/5 00:00:00 grep mysql - Here's the output of stdout.log and stderr.log: ==> stdout.log <== Resin 3.0.3 (built Mon Sep 22 15:54:15 PDT 2003) Copyright(c) 1998-2003 Caucho Technology. All rights reserved. Starting Resin on Tue, 02 Mar 2004 10:38:27 -0800 (PST) [10:38:28.466] Loaded Socket JNI library. [10:38:28.466] http listening to *:8080 [10:38:28.466] ServletServer[] starting [10:38:28.682] hmux listening to redhatdev:6802 [10:38:28.903] Host[] starting [10:38:29.272] Application[http://localhost:8080/resin-doc] starting [10:38:29.448] In-place class reloading is not available. In-place class reloading during development requires -Xdebug. server.properties not found, using command line or default properties Opening database: /usr/local/cocoon-2.1.2/build/webapp/WEB-INF/db/cocoondb HSQLDB server 1.7.1 is running Use SHUTDOWN to close normally. Use [Ctrl]+[C] to abort abruptly Tue Mar 02 10:38:34 PST 2004 Listening for connections ... INFO [main] (DirectSchedulerFactory.java:295) - Quartz scheduler 'Cocoon INFO [main] (DirectSchedulerFactory.java:298) - Quartz scheduler version: 1.2.3 INFO [main] (QuartzScheduler.java:327) - Scheduler Cocoon_$_Tue_Mar_02_10:38:34_PST_2004 started. DirectoryManager.getPool(jdbc/mysql) DirectoryManager.getPool(jdbc/mysql): context env:[ContextImpl java:comp/env] ==> stderr.log <== DirectoryManager.getPool(jdbc/mysql) javax.naming.NameNotFoundException: java:comp/env/jdbc/mysql at com.caucho.naming.ContextImpl.lookupImpl(ContextImpl.java:214) at com.caucho.naming.ContextImpl.lookup(ContextImpl.java:172) at nlp.DirectoryManager.getPool(DirectoryManager.java:36) at nlp.DirectoryManager.getKeyValues(DirectoryManager.java:152) at nlp.DirectoryManager.getSubjects(DirectoryManager.java:79) at org.apache.cocoon.www.mount.discover_nikkei_org.xsp.directory.index_xsp.generate(org.apache.cocoon.www.mount.discover_nikkei_org.xsp.directory.index_xsp:283) at org.apache.cocoon.generation.ServerPagesGenerator.generate(ServerPagesGenerator.java:260) at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.processXMLPipeline(AbstractProcessingPipeline.java:548) at org.apache.cocoon.components.pipeline.impl.AbstractCachingProcessingPipeline.processXMLPipeline(AbstractCachingProcessingPipeline.java:196) at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.process(AbstractProcessingPipeline.java:492) at org.apache.cocoon.components.treeprocessor.sitemap.SerializeNode.invoke(SerializeNode.java:147) at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:84) at org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invoke(PreparableMatchNode.java:164) at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:108) at org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:163) at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:108) at org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:161) at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:351) at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:304) at org.apache.cocoon.components.treeprocessor.sitemap.MountNode.invoke(MountNode.java:130) at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:84) at org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invoke(PreparableMatchNode.java:164) at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:108) at org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:163) at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:108) at org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:161) at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:351) at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:304) at org.apache.cocoon.Cocoon.process(Cocoon.java:640) at org.apache.cocoon.servlet.CocoonServlet.service(CocoonServlet.java:1104) at javax.servlet.http.HttpServlet.service(HttpServlet.java:103) at org.apache.cocoon.servlet.ParanoidCocoonServlet.service(ParanoidCocoonServlet.java:267) at com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java:105) at com.caucho.server.cache.CacheFilterChain.doFilter(CacheFilterChain.java:211) at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:165) at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:221) at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:253) at com.caucho.server.port.WorkerThread.run(WorkerThread.java:129) at java.lang.Thread.run(Thread.java:536) DirectoryManager.getKeyValues():1 java.lang.NullPointerException at nlp.DirectoryManager.getKeyValues(DirectoryManager.java:172) at nlp.DirectoryManager.getSubjects(DirectoryManager.java:79) at org.apache.cocoon.www.mount.discover_nikkei_org.xsp.directory.index_xsp.generate(org.apache.cocoon.www.mount.discover_nikkei_org.xsp.directory.index_xsp:283) at org.apache.cocoon.generation.ServerPagesGenerator.generate(ServerPagesGenerator.java:260) at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.processXMLPipeline(AbstractProcessingPipeline.java:548) at org.apache.cocoon.components.pipeline.impl.AbstractCachingProcessingPipeline.processXMLPipeline(AbstractCachingProcessingPipeline.java:196) at org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.process(AbstractProcessingPipeline.java:492) at org.apache.cocoon.components.treeprocessor.sitemap.SerializeNode.invoke(SerializeNode.java:147) at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:84) at org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invoke(PreparableMatchNode.java:164) at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:108) at org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:163) at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:108) at org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:161) at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:351) at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:304) at org.apache.cocoon.components.treeprocessor.sitemap.MountNode.invoke(MountNode.java:130) at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:84) at org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.invoke(PreparableMatchNode.java:164) at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:108) at org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(PipelineNode.java:163) at org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.invokeNodes(AbstractParentProcessingNode.java:108) at org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(PipelinesNode.java:161) at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:351) at org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:304) at org.apache.cocoon.Cocoon.process(Cocoon.java:640) at org.apache.cocoon.servlet.CocoonServlet.service(CocoonServlet.java:1104) at javax.servlet.http.HttpServlet.service(HttpServlet.java:103) at org.apache.cocoon.servlet.ParanoidCocoonServlet.service(ParanoidCocoonServlet.java:267) at com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java:105) at com.caucho.server.cache.CacheFilterChain.doFilter(CacheFilterChain.java:211) at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:165) at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:221) at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:253) at com.caucho.server.port.WorkerThread.run(WorkerThread.java:129) at java.lang.Thread.run(Thread.java:536) Many, many thanks for your help!! -- Geoffrey Jost MIS Supervisor, Japanese American National Museum gjost@xxxxxxxx - 213-830-5654 |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: 3.0.7 release: 00018, Scott Ferguson |
|---|---|
| Next by Date: | RE: 3.0.7 release: 00018, Jason Chaffee |
| Previous by Thread: | Resin 2.1.x and IIS 6.0i: 00018, Claus Nedergaard Jacobsen |
| Next by Thread: | Resin 3.0.6 TCP Sessions Problem Please Advise: 00018, Chris Wilson |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |