|
| Apache Geronimo > Discussion Forums | User List | Dev List | Wiki | Issue Tracker |
|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
Accessing a server-wide JDBC data source through JNDI from a web moduleDear list!
My problem is this: I have followed this tutorial: http://cwiki.apache.org/GMOxDOC21/web-application-for-jdbc-access.html Interesting enough, I can even successfully look up my datasource without having a geronimo-web.xml at all when I deploy the web module standalone. But as soon as I make that web module part of an enterprise application (wrap it into an EAR file) the JNDI lookup doesn't work any more, even with the geronimo-web.xml file. Any thoughts how to find the problem? Regards, Torsten |
|
|
Re: Accessing a server-wide JDBC data source through JNDI from a web moduleYou might want to paste your deployment plans and the code that locate the datasource here, to give more context...
-Jack On Wed, Aug 26, 2009 at 6:35 PM, Torsten Schlabach <tschlabach@...> wrote: Dear list! |
|
|
Re: Accessing a server-wide JDBC data source through JNDI from a web moduleHallo,
I have the same problem with my EJB-Project. Standalone EJB: Code: public class LogBean implements LogInterfaceLocal, LogInterfaceRemote { @Resource(name = "jdbc/jlog4ssisDS") private DataSource _dbsource; private Connection _dbconnect; @PostConstruct public void initialize() { try { _dbconnect = _dbsource.getConnection(); } catch (Exception e) { e.printStackTrace(); } } openejb-jar.xml: <?xml version="1.0" encoding="UTF-8" standalone="no"?> <openejb-jar xmlns="http://www.openejb.org/xml/ns/openejb-jar-2.2" xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.2" xmlns:pkgen="http://www.openejb.org/xml/ns/pkgen-2.0" xmlns:sec="http://geronimo.apache.org/xml/ns/security-1.2" xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.2"> <sys:environment> <sys:moduleId> <sys:groupId>de.ssis.log4ssis.webservice</sys:groupId> <sys:artifactId>log4ssis.webservice</sys:artifactId> <sys:version>1.0</sys:version> <sys:type>car</sys:type> </sys:moduleId> <sys:dependencies> <sys:dependency> <sys:groupId>console.dbpool</sys:groupId> <sys:artifactId>jdbc_jlog4ssisDS</sys:artifactId> <sys:version>1.0</sys:version> <sys:type>rar</sys:type> </sys:dependency> </sys:dependencies> </sys:environment> </openejb-jar> EJB in Enterprise Application Project code: public class TimerSettings { @Resource(name = "jdbc/forceDS") private DataSource _dbsource; private Connection _dbconnect; public void getSettings() { _dbconnect = _dbsource.getConnection(); } openejb-jar.xml: <?xml version="1.0" encoding="UTF-8" standalone="no"?> <ejb:openejb-jar xmlns:app="http://geronimo.apache.org/xml/ns/j2ee/application-2.0" xmlns:client="http://geronimo.apache.org/xml/ns/j2ee/application-client-2.0" xmlns:conn="http://geronimo.apache.org/xml/ns/j2ee/connector-1.2" xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2" xmlns:ejb="http://openejb.apache.org/xml/ns/openejb-jar-2.2" xmlns:name="http://geronimo.apache.org/xml/ns/naming-1.2" xmlns:pers="http://java.sun.com/xml/ns/persistence" xmlns:pkgen="http://openejb.apache.org/xml/ns/pkgen-2.1" xmlns:sec="http://geronimo.apache.org/xml/ns/security-2.0" xmlns:web="http://geronimo.apache.org/xml/ns/j2ee/web-2.0.1"> <dep:environment> <dep:moduleId> <dep:groupId>de.ssis.force.timer</dep:groupId> <dep:artifactId>force.timer</dep:artifactId> <dep:version>1.0</dep:version> <dep:type>car</dep:type> </dep:moduleId> <dep:dependencies> <dep:dependency> <dep:groupId>console.dbpool</dep:groupId> <dep:artifactId>jdbc_forceDS</dep:artifactId> <dep:version>1.0</dep:version> <dep:type>rar</dep:type> </dep:dependency> <dep:dependency> <dep:groupId>quartz</dep:groupId> <dep:artifactId>quartz-all</dep:artifactId> <dep:version>1.6.5</dep:version> <dep:type>jar</dep:type> </dep:dependency> <dep:dependency> <dep:groupId>de.ssis.log4ssis.webservice</dep:groupId> <dep:artifactId>log4ssis.webservice</dep:artifactId> <dep:version>1.0</dep:version> <dep:type>car</dep:type> </dep:dependency> </dep:dependencies> </dep:environment> </ejb:openejb-jar> geronimo-application.xml <?xml version="1.0" encoding="UTF-8" standalone="no"?> <app:application xmlns:app="http://geronimo.apache.org/xml/ns/j2ee/application-2.0" xmlns:client="http://geronimo.apache.org/xml/ns/j2ee/application-client-2.0" xmlns:conn="http://geronimo.apache.org/xml/ns/j2ee/connector-1.2" xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2" xmlns:ejb="http://openejb.apache.org/xml/ns/openejb-jar-2.2" xmlns:name="http://geronimo.apache.org/xml/ns/naming-1.2" xmlns:pers="http://java.sun.com/xml/ns/persistence" xmlns:pkgen="http://openejb.apache.org/xml/ns/pkgen-2.1" xmlns:sec="http://geronimo.apache.org/xml/ns/security-2.0" xmlns:web="http://geronimo.apache.org/xml/ns/j2ee/web-2.0.1" application-name="force"> <dep:environment> <dep:moduleId> <dep:groupId>de.ssis.force</dep:groupId> <dep:artifactId>force</dep:artifactId> <dep:version>1.0</dep:version> <dep:type>car</dep:type> </dep:moduleId> </dep:environment> </app:application> stacktrace: java.lang.NullPointerException at de.ssis.force.timer.quartz.settings.TimerSettings.getSettings(TimerSettings.java:35)
--
MikeSt |
| Free embeddable forum powered by Nabble | Forum Help |
