Hallo,

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)



Jack Cai wrote:
> 
> You might want to paste your deployment plans and the code that locate the
> datasource here, to give more context...
> 
> -Jack
> 
> 


--
MikeSt
-- 
View this message in context: 
http://www.nabble.com/Accessing-a-server-wide-JDBC-data-source-through-JNDI-from-a-web-module-tp25150342s134p25696913.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.

Reply via email to