Problem getting MySQL DataSource in JBoss


EJB programming & troubleshooting: Problem getting MySQL DataSource in JBoss

  1. Problem getting MySQL DataSource in JBoss (2 messages)

    I am trying to connect to MySQL in JBoss and have problems in getting the DataSource from the JNDI. I can connect to MySQL from the command line (mysql) though.

    The MySQL JDBC driver jar file is copied to server/default/lib directory.

    I have a mysql-ds.xml copied over to server/default/deploy directory of JBoss with the following entry:


    The JBoss Console at http://localhost:8080/jmx-console/index.jsp does show jdbc/MySQLDB:


    My Java code snippet (which is in an EJB implementation) has:
    Properties env = new Properties();

    env.put(Context.PROVIDER_URL, "localhost:1099");
            Context ctx = new InitialContext(env);
            DataSource ds = (DataSource)ctx.lookup("jdbc/MySQLDS");

    I get the following exception.

    javax.naming.NameNotFoundException: jdbc not bound
            at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown Source)
            at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
  2. The JBoss site has a Datasource configuration forum.
    This has been discussed several times there.

    - vineet
  3. That doesn't help...[ Go to top ]

    I have the same question. I looked in the JBoss forums, and somebody posted a smart @ss remark, "look it up with google." I did a search with google, which took me to this page. If you know the answer or have a link to the JBoss thread, please post it.