facebook

Configuring a Datasource on Jboss

  1. MyEclipse Archived
  2.  > 
  3. Application Servers and Deployment
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #223594 Reply

    imm102
    Member

    Hi,

    Having followed all the tutorials online i tried to create a simple test bean to access the database. I set up the Xdoclet configuration and added the same config entries as the tutorials with the addition of a DATASOURCE MAPPING of jdbc/DefaultDS and DATASOURCE: java:/DefaultDS

    This seems to have create the correct jboss.xml file

    <?xml version=”1.0″ encoding=”UTF-8″ ?>
    <!DOCTYPE jboss (View Source for full doctype…)>
    – <jboss>
    – <enterprise-beans>
    – <!– To add beans that you have deployment descriptor info for, add
    a file to your XDoclet merge directory called jboss-beans.xml that contains
    the <session></session>, <entity></entity> and <message-driven></message-driven>
    markup for those beans.

    –>
    – <session>
    <ejb-name>Test</ejb-name>
    <jndi-name>ejb/Test</jndi-name>
    – <resource-ref>
    <res-ref-name>jdbc/DefaultDS</res-ref-name>
    <jndi-name>java:/DefaultDS</jndi-name>
    <res-url>jdbc:hsqldb:hsql://localhost:1701</res-url>
    </resource-ref>
    <method-attributes />
    </session>
    </enterprise-beans>
    <resource-managers />
    – <!– | for container settings, you can merge in jboss-container.xml
    | this can contain <invoker-proxy-bindings/> and <container-configurations/>

    –>
    </jboss>

    I haven’t changed anything with the database im referencing the default database that comes with Jboss. When i deploy i get this console error

    WARN [StatelessSessionContainer] No resource manager found for jdbc/DefaultDS

    Does anyone have any idea what im missing??

    Ian

    #223615 Reply

    Riyad Kalla
    Member

    Anything helpful here? http://www.google.com/search?hl=en&q=%5BStatelessSessionContainer%5D+No+resource+manager+found&btnG=Google+Search

    Try the 2nd one, then the first one… they seemed helpful but I don’t have EJB experience so I don’t know how applicable they are.

    #223697 Reply

    imm102
    Member

    hi,

    I tried the tow links but they didn’t help. I did find a mistake id made which was i hadn’t defined the Xdoclet jboss>dest-dir to src/META-INF like in the tutorials. I did this and ran xdoclet again and now i get a long list of errors on deployment.

    There is a problem with the ME generated jboss.xml which is listed on the problems tab as

    The content of element type “resource-ref” must match “(res-ref-name,(resource-name|jndi-name|res-url))”

    The generated jboss.xml is as follows:

    <?xml version=”1.0″ encoding=”UTF-8″?>
    <!DOCTYPE jboss PUBLIC “-//JBoss//DTD JBOSS 4.0//EN” “http://www.jboss.org/j2ee/dtd/jboss_4_0.dtd”&gt;

    <jboss>
    <enterprise-beans>
    <session>
    <ejb-name>Test</ejb-name>
    <jndi-name>ejb/Test</jndi-name>
    <resource-ref>
    <res-ref-name>DefaultDS</res-ref-name>
    <jndi-name>java:/DefaultDS</jndi-name>
    <res-url>jdbc:hsqldb:hsql://localhost:1701</res-url>
    </resource-ref>

    <method-attributes>
    </method-attributes>
    </session>

    </enterprise-beans>

    <resource-managers>
    </resource-managers>
    </jboss>

    Im getting really confused. I know the url and jndi name are correct. I reference them from the hsqldb-ds.xml config file.

    <!– The jndi name of the DataSource, it is prefixed with java:/ –>
    <jndi-name>DefaultDS</jndi-name>
    <connection-url>jdbc:hsqldb:hsql://localhost:1701</connection-url>

    I have defined the jboss Xdoclet config element for the ejb as follows
    –version :4
    –datasource: java:/DefaultDS
    –datasourceMapping: jdbc/DefaultDS
    –destDir: src/META-INF

    And my xdoclet annotation is as follows

    * @ejb.bean name=”Test”
    * display-name=”Test”
    * description=”My first bean”
    * jndi-name=”ejb/Test”
    * type=”Stateless”
    * view-type=”remote”
    * @jonas.bean ejb-name = “Test”
    * jndi-name = “ejb/Test”
    * @oc4j.bean ejb-name = “Test”
    * jndi-name = “ejb/Test”
    * @ejb.resource-ref res-ref-name = “jdbc/DefaultDS”
    * res-type = “javax.sql.Datasource”
    * res-auth = “Container”
    * res-sharing-scope = “Shareable”
    * jndi-name = “java:/DefaultDS”
    * @jboss.resource-ref res-ref-name = “jdbc/DefaultDS”
    * jndi-name = “java:/DefaultDS”
    * res-url = “jdbc:hsqldb:hsql://localhost:1701”

    Im sorry for all the text but im totally lost as to what im doing wrong. Is the res-ref-name needed to be registered anywhere else before it can be used. If anyone else has ME and an EJB deployed on Jboss 4 please can you give me the config settings im missing.

    Cheers

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: Configuring a Datasource on Jboss

You must be logged in to post in the forum log in