4 Replies Latest reply on Nov 9, 2011 2:07 PM by darthgamer

    NullPointerException when adding ejb-jar.xml

    darthgamer Newbie

      Greetings,

       

      I'm starting to get familiar with JBoss 5.1 and I'm currently having an issue setting up a DB connection.

       

      After setting up the datasource, I can see it shown in the jmx-console, but when I tried to use it in the application I got a jdbc not bound exception.

       

      Researching found that I needed to create a reference to it to the EJB using ejb-jar.xml, but when I try to do that, the bean won't start with a nullPointerException.

       

      Is there anything wrong with this EJB file? I tried to look for templates, but turns out it doesn't seem that easily to find.

       

      Below the ejb-jar.xml contents.

       

      <?xml version="1.0" encoding="UTF-8"?>
      <ejb-jar xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" metadata-complete="false" version="3.0"
      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd">
        <enterprise-beans>
                          <session>
                                    <ejb-name>MyEJB</ejb-name>
                                     <resource-ref>
                                              <res-ref-name>jdbc/MyDB</res-ref-name>
                                              <res-type>javax.sql.DataSource</res-type>
                                              <res-auth>Container</res-auth>
                                    </resource-ref> 
                          </session>
                </enterprise-beans>
      </ejb-jar>
      

       

      sybase-ds.xml

       

      <datasources>
        <local-tx-datasource>
          <jndi-name>jdbc/MyDB</jndi-name>
          <connection-url>jdbc:sybase:Tds:192.168.5.130:2638?JCONNECT_VERSION=6&amp;ServiceName=Mydb</connection-url>
          <driver-class>com.sybase.jdbc3.jdbc.SybDataSource</driver-class>
          <user-name>xxx</user-name>
          <password>xxx</password>
          <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.SybaseExceptionSorter</exception-sorter-class-name>
            <metadata>
               <type-mapping>Sybase</type-mapping>
            </metadata>
            <min-pool-size>5</min-pool-size>
            <max-pool-size>20</max-pool-size>   
            <blocking-timeout-millis>10000</blocking-timeout-millis> 
            <idle-timeout-minutes>10</idle-timeout-minutes>
            <CleanupIntervalMinutes>15</CleanupIntervalMinutes>   
        </local-tx-datasource>
      </datasources>
      

       

       

      Thank you in advance for any help that might be provided.

       

      EDIT: Edited to add the log file.

      EDIT: Added Datasource XML