2 Replies Latest reply on Apr 1, 2002 5:29 PM by hleblanc

    jndi newbie question

    hleblanc

      I'm responsible for developing and deploying a jboss application on linux/apache/tomcat/oracle. The application code is done, but I have some questions about how to configure the server in the various xml files.
      I know what goes into the ejb-jar.xml to tell the server about my enterprise beans, but where (specifically, which xml files) do I tell jboss about the DataSource I wish to use, or the mail server so I can use javamail? I've been scouring both the jboss documentation and the sun j2ee sites without making much progress. Any help would be most welcome.
      For instance, on p 128 of the manual, it talks about using the resource-ref tag to identify DataSource and mail Session objects:
      ...
      <!-- JDBC DataSources (java:comp/env/jdbc) -->
      <resource-ref>
      The default DS
      <res-ref-name>jdbc/DefaultDS</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
      </resource-ref>
      <!-- JavaMail Connection Factories (java:comp/env/mail) -->
      <resource-ref>
      Default Mail
      <res-ref-name>mail/DefaultMail</res-ref-name>
      <res-type>javax.mail.Session</res-type>
      <res-auth>Container</res-auth>
      </resource-ref>
      ...
      These go into web.xml (in the WAR file?), but how does jboss know how to find the actual Oracle jdbc driver, or the actual linux sendmail facility? Where does *that* go?
      I know these are excruciating newbie questions, and I appreciate your patience. I have RTFM'd several times, to no avail. I think it's the sort of thing that's so obvious to the seasoned j2ee developer that it's never mentioned, or else the sort of thing that the tools do for you. (I'm doing everything by hand, no nifty EAR or WAR building files, because the project is on a tight budget.)
      Thanks,
      Harry

        • 1. Re: jndi newbie question

          You haven't mentioned your version?

          For jboss2.4 look for jboss.jcml, running with
          tomcat embedded this is in conf/catalina/

          For jboss3.0 the configuration is hot-deployed in the
          deploy directory.

          Regards,
          Adrian

          • 2. Re: jndi newbie question
            hleblanc

            It's jboss 2.4, running Oracle 8.17 on Redhat 7.1.
            I've tried using the web-based mbean interface, which looks pretty straightforward. I set it up like so:
            MBean Name: DefaultDomain:service=XADataSource,name=TestDB
            MBean Java Class: org.jboss.jdbc.XADataSourceLoader
            DataSourceClass: org.jboss.pool.jdbc.xa.wrapper.XADataSourceImpl
            jdbc user: DEKWEB
            password: <<the password>>
            PoolName: TestDB
            url: jdbc:oracle:thin:@localhost:1521:TestDB

            All the rest are set to whatever they defaulted to (except transaction isolation, which choked unless I blanked it out).
            But when I start the mbean, I get this error in the server log:
            java.lang.NullPointerException
            at org.jboss.pool.jdbc.xa.XAPoolDataSource.getConnection(Unknown Source)
            at org.jboss.jdbc.XADataSourceLoader.startService(XADataSourceLoader.java:412)
            at org.jboss.util.ServiceMBeanSupport.start(ServiceMBeanSupport.java:103)
            at java.lang.reflect.Method.invoke(Native Method)
            at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
            at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
            at com.sun.jdmk.comm.HtmlInvokePage.buildPage(HtmlInvokePage.java:240)
            at com.sun.jdmk.comm.HtmlRequestHandler.processGetRequest(HtmlRequestHandler.java:325)
            at com.sun.jdmk.comm.HtmlRequestHandler.processRequest(HtmlRequestHandler.java:152)
            at com.sun.jdmk.comm.HtmlRequestHandler.doRun(HtmlRequestHandler.java:79)
            at com.sun.jdmk.comm.ClientHandler.run(ClientHandler.java:84)
            at java.lang.Thread.run(Thread.java:484)

            Any idea what's going on here? The Oracle SID is TestDB, but jboss doesn't seem to be finding it.