JBOSS jndi Datasource: jdbc not bound

Im adding an jndi Datasource to JBOSS 4.0.2.
1. i copied jdbc driver to JBOSS_HOME/server/default/lib.
2. i copied following ds.xml to JBOSS_HOME/server/default/deploy (its based ony the mysql-ds.xml from the samples)
<?xml version="1.0" encoding="UTF-8"?>
<datasources>
  <local-tx-datasource>
    <jndi-name>jndi-name</jndi-name>
    <connection-url>jdbc:mysql://localhost:3306/databasename</connection-url>
    <driver-class>org.gjt.mm.mysql.Driver</driver-class>
    <user-name>username</user-name>
    <password>password</password>
    <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>
    <!-- sql to call when connection is created
    <new-connection-sql>some arbitrary sql</new-connection-sql>
      -->
    <!-- sql to call on an existing pooled connection when it is obtained from pool
    <check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql>
      -->
    <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
    <metadata>
       <type-mapping>mySQL</type-mapping>
    </metadata>
  </local-tx-datasource>
</datasources>I look this up using java:jndi-name. Works perfect.
For compatibility with other containers, i want to move my jndi-datasource to java:comp/env/jdbc/jndi-name
So i change my ds-description:
<?xml version="1.0" encoding="UTF-8"?>
<datasources>
  <local-tx-datasource>
    <jndi-name>comp/env/jdbc/jndi-name</jndi-name>
    <connection-url>jdbc:mysql://localhost:3306/databasename</connection-url>
    <driver-class>org.gjt.mm.mysql.Driver</driver-class>
    <user-name>username</user-name>
    <password>password</password>
    <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>
    <!-- sql to call when connection is created
    <new-connection-sql>some arbitrary sql</new-connection-sql>
      -->
    <!-- sql to call on an existing pooled connection when it is obtained from pool
    <check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql>
      -->
    <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
    <metadata>
       <type-mapping>mySQL</type-mapping>
    </metadata>
  </local-tx-datasource>
</datasources>Looking this up with java:comp/env/jdbc/jndi-name leads to Could not find datasource: java:comp/env/jdbc/jndi-name
javax.naming.NameNotFoundException: jdbc not bound
Some lines above jboss prints:
[WrapperDataSourceService] Bound connection factory for resource adapter for ConnectionManager 'jboss.jca:name=comp/env/jdbc/jndi-name,service=DataSourceBinding to JNDI name 'java:comp/env/jdbc/jndi-name
Please can somebody explain what the problem is about binding a datasource somewhere else than directly to "java:"

In web.xml making the following entry:
<web-app>
<description>MySQL Test App</description>
<resource-ref>
<description>DB Connection</description>
<res-ref-name>jdbc/test</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</web-app>
Next, add a file jboss-web.xml under WEB-INF/ folder of the web-application. This file should contain entry as:
<jboss-web>
<resource-ref>
<description>DB Connection</description>
<res-ref-name>jdbc/test</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<jndi-name>java:/jdbc/test</jndi-name>
<res-auth>Container</res-auth>
</resource-ref>
</jboss-web>
Next, in JBOSS_HOME/server/default/deploy folder make a xx-ds.xml file or else, a similiar file can be found in that same folder with the name hsqldb-ds.xml. Make following entries in that xml file:
<datasources>
<local-tx-datasource>
<jndi-name>/jdbc/test</jndi-name>
<type-mapping>MySQL</type-mapping>
<connection-url>jdbc:mysql://localhost:3306/shopping_cart</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<user-name>root</user-name>
<password>root123</password>
<min-pool-size>1</min-pool-size>
<max-pool-size>5</max-pool-size>
</local-tx-datasource>
This should bind the jndi name.
In our client application, we need to look up as:
Context ctx = new InitialContext();
DataSource ds = (DataSource)ctx.lookup("java:/jdbc/test");
Connection conn = ds.getConnection();
This works perfectly.

Similar Messages

  • Javax.naming.NameNotFoundException: jdbc not bound

    Hi !
    I've a application deployed with JBoss 4.0.2 Solaris 2.8, I've create a Oracle DS, when I try to read data from a database throw DS works fine, but when I try to insert, delete or update records from database the jboss show the next error.
    2005-09-07 09:17:55,662 ERROR [org.jboss.ejb.plugins.LogInterceptor] Transaction
    RolledbackLocalException in method: public abstract int com.soluzionasf.arqw10.g
    c.cmp.OracleSequenceSessionLocal.getNextSequenceNumber(java.lang.String) throws
    javax.ejb.FinderException, causedBy:
    javax.naming.NameNotFoundException: jdbc not bound
    at org.jnp.server.NamingServer.getBinding(NamingServer.java:491)
    at org.jnp.server.NamingServer.getBinding(NamingServer.java:499)
    at org.jnp.server.NamingServer.getObject(NamingServer.java:505)
    at org.jnp.server.NamingServer.lookup(NamingServer.java:249)
    at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:610)
    at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572)
    at javax.naming.InitialContext.lookup(InitialContext.java:347)
    at com.soluzionasf.arqw10.gc.cmp.OracleSequenceSessionBean.getConnection
    (OracleSequenceSessionBean.java:76)
    at com.soluzionasf.arqw10.gc.cmp.OracleSequenceSessionBean.getNextSequen
    ceNumber(OracleSequenceSessionBean.java:46)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at org.jboss.invocation.Invocation.performCall(Invocation.java:345)
    at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(S
    tatelessSessionContainer.java:214)
    at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invo
    ke(CachedConnectionInterceptor.java:185)
    at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(Stat
    elessSessionInstanceInterceptor.java:130)
    at org.jboss.webservice.server.ServiceEndpointInterceptor.invoke(Service
    EndpointInterceptor.java:51)
    at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidation
    Interceptor.java:48)
    at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInte
    rceptor.java:105)
    at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxIntercep
    torCMT.java:335)
    at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:1
    66)
    This is my DS definition
    <?xml version="1.0" encoding="UTF-8"?>
    <local-tx-datasource>
    <jndi-name>jdbc/OracleDS</jndi-name>
    <connection-url>jdbc:oracle:thin:@10.98.10.42:1532:orcl28</connection-url>
    <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
    <user-name>evo_adminis</user-name>
    evo_adminis1
    <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
    <type-mapping>Oracle9i</type-mapping>
    </local-tx-datasource>
    Who knows the solutions for my problem
    Thanks for advance

    Could be that your EJB is connected to a wrong datasource called only "jdbc"?
    Strangely you say that while reading data all works fine (so the datasource definition is ok) but only when writing data there is a NamingException.
    The stacktrace seems to report an error while getting datasource reference inside com.soluzionasf.arqw10.gc.cmp.OracleSequenceSessionLocal.getNextSequenceNumber method, the problems seems to be a bad name resource name ("jdbc" instead of java:jdbc/OracleDS or java:comp/env/jdbc/OracleDS if you use resource reference in your web.xml file). If you created this class as a CMP perhaps you misstype the right datasource name, otherwise if you code this method by yourseft you misstype the naming reference.

  • CF8 with JBoss JNDI datasource

    After installing and configuring a CF8 for J2EE running on
    JBoss 4.2.2.GA with Java 6, I have created a JNDI datasource for
    Oracle 10g in the oracle-ds.xml file. I have configured a CF8
    datasource that uses the JNDI resource.
    Any query that is NOT using cfqueryparam works quite well.
    As soon as cfqueryparam is used, I get an "Error casting an
    object of type org.jboss.resource.adapter.jdbc.WrappedConnection
    cannot be cast to coldfusion.server.j2ee.sql.JRunConnectionHandle
    to an incompatible type.".
    The configuration and the exception is pretty much the same
    as described in
    Problem
    description.
    This is clearly a CF8 bug and I was wondering if there is any
    known workaround for it.

    In web.xml making the following entry:
    <web-app>
    <description>MySQL Test App</description>
    <resource-ref>
    <description>DB Connection</description>
    <res-ref-name>jdbc/test</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>
    </web-app>
    Next, add a file jboss-web.xml under WEB-INF/ folder of the web-application. This file should contain entry as:
    <jboss-web>
    <resource-ref>
    <description>DB Connection</description>
    <res-ref-name>jdbc/test</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <jndi-name>java:/jdbc/test</jndi-name>
    <res-auth>Container</res-auth>
    </resource-ref>
    </jboss-web>
    Next, in JBOSS_HOME/server/default/deploy folder make a xx-ds.xml file or else, a similiar file can be found in that same folder with the name hsqldb-ds.xml. Make following entries in that xml file:
    <datasources>
    <local-tx-datasource>
    <jndi-name>/jdbc/test</jndi-name>
    <type-mapping>MySQL</type-mapping>
    <connection-url>jdbc:mysql://localhost:3306/shopping_cart</connection-url>
    <driver-class>com.mysql.jdbc.Driver</driver-class>
    <user-name>root</user-name>
    <password>root123</password>
    <min-pool-size>1</min-pool-size>
    <max-pool-size>5</max-pool-size>
    </local-tx-datasource>
    This should bind the jndi name.
    In our client application, we need to look up as:
    Context ctx = new InitialContext();
    DataSource ds = (DataSource)ctx.lookup("java:/jdbc/test");
    Connection conn = ds.getConnection();
    This works perfectly.

  • JBoss NameNotFoundError: tangosol.coherenceTx not bound

    I've successfully deployed the coherence-tx.rar to both JBoss-3.2.6 and JBoss-4.0.5. I am getting the following exception: javax.naming.NameNotFoundException: tangosol.coherenceTx not bound. Do I need to deploy something else in order for the JNDI name to get bound? Thanks in advance for any help.
    Mark

    One of our developers did some debugging and found that Coherence seems to read the manifest file in a way based on getProtectionDomain().getCodeSource().getLocation() and this call returns with a "jar:" prefix with our version of JBoss while the Sun (now Oracle) JVM does not include this prefix - Coherence also adds "jar:" to the string resulting in the failure to find the manifest (due to "jar:jar:....") ...
    As I read the Javadoc it is not clear if JBoss is doing something wrong or not but there must be simpler and more portable ways to get hold of the maifest (or at least add a check to see if there already is a "jar:" prefix before adding your own).
    My main question is however if we needs to worry about the error message? The only information Coherence would find in the manifest is the product version (that may be used for some default port numbers etc?!) - can you please check what happens if the Manifest cant be read...
    /Magnus

  • JNDI Exception :  [System] not bound in naming services

    Hi All,
    Is there any way to resolve this JNDI exception "Invalid Path: [System/Launchers] not bound in naming service" ?
    Thanks in Advance

    This did not work dear. I assume when you say [Add ur datasource], you mean the name of the datasource, and I did as you told. I was wondering though that I have an independent java class which try to get data source from WSAD server, then how does web.xml help, may be I am not understanding the connection here.
    Just to let you know, that same java class gets the datasource from 4.0 test server. I am running both servers now i.e. 4.0 test and 5.0 test server on different ports, and only data source from 4.0 workd good. Do you have any other solution, which I can try.
    Is there any difference the way data source is accessed between 4.0 and 5.0 versions.
    Thanks in advance.
    Open web.xml, There will reference tab,, then take
    Resource, Add ur datasourse on where the Cursor points
    and then JNDI Name.
    U need to restart ..

  • "Errored while looking up datasource: PWC4216: Name myDB is not bound in th

    hi all,
    am trying to deploy my web application (.war which has a servlet which connects to a db and fetches records and displays in jsp) file in SunOne web server V7 but i cant get past this error :
    [29/Jun/2010:15:14:46] failure (24218): for host 146.171.59.144 trying to POST /BbaMigrationQueryTool/BBAMigrationQuery, service-j2ee reports: NamingExcep
    tion caught: Errored while looking up datasource: PWC4216: Name myDB is not bound in this Context
    my java code to lookup the jndi name :
       1.     //looks up a datasource 
       2.     private static synchronized DataSource getDataSource(String jndiName) throws NamingException { 
       3.  
       4.         DataSource dataSource = null; 
       5.  
       6.         try { 
       7.             Context c = new InitialContext(); 
       8.              Context envContext = (Context) c.lookup("java:comp/env"); 
       9.             Logger.getLogger(DBUtilities.class.getName()).log(Level.INFO, "Found sub context"); 
      10.               dataSource = (DataSource) envContext.lookup(jndiName); 
      11.  
      12.         } catch (NamingException e) { 
      13.             e.printStackTrace(); 
      14.             throw new NamingException("Errored while looking up datasource: " + e.getMessage()); 
      15.         } 
      16.  
      17.         return dataSource; 
      18.     } 
      i call the above method with "jdbc/myDB" and have created a JDBC recourse within the SunOne web server via the admin console.
    my web.xml i have an entry for the resource as follows :
       1.             <resource-ref> 
       2.         <res-ref-name>jdbc/myDB</res-ref-name> 
       3.         <res-type>javax.sql.DataSource</res-type> 
       4.         <res-auth>Container</res-auth> 
       5.         <res-sharing-scope>Shareable</res-sharing-scope> 
       6.     </resource-ref> 
    in my sun-web.xml i have an entry as follows :
       1.     <resource-ref> 
       2.         <res-ref-name>jdbc/myDB</res-ref-name> 
       3.         <jndi-name>jdbc/myDB</jndi-name> 
       4.     </resource-ref> 
    server.xml has this entry in it :
       1.   <jdbc-resource> 
       2.     <jndi-name>jdbc/myDB</jndi-name> 
       3.     <datasource-class>oracle.jdbc.pool.OracleDataSource</datasource-class> 
       4.     <property> 
       5.       <name>password</name> 
       6.       <value>76765</value> 
       7.     </property> 
       8.     <property> 
       9.       <name>user</name> 
      10.       <value>56756</value> 
      11.     </property> 
      12.     <property> 
      13.       <name>url</name> 
      14.       <value>jdbc:oracle:thin:@serveretc etc</value> 
      15.     </property> 
      16.     <description/> 
      17.   </jdbc-resource>
      what could be wrong ??
    thanks in advance.
    Edited by: cesarNZ on Jun 29, 2010 7:58 PM
    Edited by: cesarNZ on Jun 29, 2010 8:00 PM

    try to not split the attributes in server.xml
    use them like
    <Context path="/myPath" docBase="myDocBase" debug="5" reloadable="true" crossContext="true" source="org.eclipse.jst.j2ee.server:myDocBase">
                          <Resource name="jdbc/myDB"
                                                     auth="Container"
                                                     type="javax.sql.DataSource"
                                                     maxActive="100"
                                                     maxIdle="30"
                                                     maxWait="10000"
                                                     username="$$$"
                                                     password="$$$"
                                                     driverClassName="com.mysql.jdbc.Driver"
                                                     url="jdbc:mysql://localhost/myTest" />
                     </Context>and i dont know why you define two resources
    try to look at
    http://forums.sun.com/thread.jspa?messageID=11013089&#11013089

  • Error - Name jdbc is not bound in this Context

    Hi,
    i wanted to use Datasource in JDBC to make connection with mysql
    suport and want to excute Jsp page but not able to execte some error is
    getting.
    1)Jsp Page: data_source.jsp
    <%@ page session="true" import="java.sql.*,javax.sql.*,javax.naming.*" %>
    <HTML>
    <body bgcolor="blue">
    <H1 align = "center" >
    Welcome to User and can see the DataSource Connection
    <%
    InitialContext ctx = new InitialContext();
    DataSource ds = (DataSource)ctx.lookup("jdbc/test");
    Connection conn = ds.getConnection();
    Statement stmt = conn.createStatement();
    ResultSet rs = stmt.executeQuery("SELECT * from emp");
    if(rs.next())
    %>
    <table width="100%" border="1" >
    <tr align="left">
    <th>Name</th>
    <th>Dept</th>
    </tr>
    <%
    do
    %>
    <TD> <%= rs.getString("Name") %> </TD>
    <TD> <%= rs.getString("Dept") %> </TD>
    <%
    }while(rs.next());
    %>
    </table>
    <%
    }else {
    %>
    No Results from Query:
    <%
    rs.close();
    stmt.close();
    conn.close();
    ctx.close();
    %>
    </body>
    </html>
    2) web.xml file content
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
    <description>MySQL Test App</description>
    <resource-ref>
    <description>Mysql DB Connection</description>
    <res-ref-name>jdbc/test</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>
    <servlet>
    <servlet-name>s1</servlet-name>
    <servlet-class>first</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>s1</servlet-name>
    <url-pattern>/test</url-pattern>
    </servlet-mapping>
    </web-app>
    3) myhealth.xml or server.xml
    <?xml version='1.0' encoding='utf-8'?>
    <Context docBase="C:/Program Files/Apache Software Foundation/Tomcat
    5.0/myhealth" path="/myhealth" reloadable="true" privileged="true">
    <Resource name="jdbc/test"
    scope="Shareable" type="javax.sql.DataSource"
    auth="Container" description="hOME.."/>
    <ResourceParams name="jdbc/test">
    <parameter>
    <name>driverClassName</name>
    <value>com.mysql.jdbc.Driver</value>
    </parameter>
    <parameter>
    <name>url</name>
    <value>jdbc:mysql://localhost:3306/test?autoReconnect=true</value>
    </parameter>
    <parameter>
    <name>username</name>
    <value>root</value>
    </parameter>
    <parameter>
    <name>password</name>
    <value>test</value>
    </parameter>
    </ResourceParams>
    </Context>
    4) Error which i got during execution of data_Source.jsp page.
    HTTP Status 500 -
    type Exception report
    message
    description The server encountered an internal error () that prevented it
    from fulfilling this request.
    exception
    javax.servlet.ServletException: Name jdbc is not bound in this Context
    org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:867)
    org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:800)
    org.apache.jsp.Data_005fSource_jsp._jspService(Data_005fSource_jsp.java:115)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    root cause
    javax.naming.NameNotFoundException: Name jdbc is not bound in this Context
    org.apache.naming.NamingContext.lookup(NamingContext.java:815)
    org.apache.naming.NamingContext.lookup(NamingContext.java:198)
    org.apache.naming.SelectorContext.lookup(SelectorContext.java:183)
    javax.naming.InitialContext.lookup(InitialContext.java:351)
    org.apache.jsp.Data_005fSource_jsp._jspService(Data_005fSource_jsp.java:56)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    As i made datasource Context using Tomcat apache. But i still get same error.
    I tried so much from Google search, please give me proper solution.
    Coz this is the common problem most of the programmers face initally
    Thanks,
    Prabhat

    i installed tomcat. the installation is done successfully..
    But i can't connect to the db(MySQL)
    i am getting some errors regarding some exception like
    **org.apache.jasper.JasperException: An exception occurred processing JSP page /TestTomcatToMySQLConn.jsp at line 16**
    **13:          Context ctx = new InitialContext();**
    **14:*          if(ctx == null )*
    *15:              throw new Exception("Boom - No Context");*
    *16:           ds = (DataSource)ctx.lookup("java:comp/env/jdbc/testDB");*
    *17:*
    *18:   if(ds == null )*
    *19:       throw new Exception("Boom - No Datasource");*
    Stacktrace:_
    *     org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:505)*
    *     org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:398)*
    *     org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)*
    *     org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)*
    *     javax.servlet.http.HttpServlet.service(HttpServlet.java:803)*
    root cause_
    javax.servlet.ServletException: javax.naming.NameNotFoundException: Name jdbc is not bound in this Context_
    *     org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:850)*
    *     org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:779)*
    *     org.apache.jsp.TestTomcatToMySQLConnjsp._jspService(TestTomcatToMySQLConn_jsp.java:88)*_
    *     org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)*
    *     javax.servlet.http.HttpServlet.service(HttpServlet.java:803)*
    *     org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)*
    *     org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)*
    *     org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)*
    *     javax.servlet.http.HttpServlet.service(HttpServlet.java:803)*
    please Help

  • "Name jdbc is not bound in this Context" when conncetiong from different pa

    Hi,
    I'm just a beginner at this so I'll have to explain everything in details as i have no idea what could be wrong.
    I have a working connection to mydatabase using the following method in a CommonMethods.java file in WEB-INF; this file belongs to the "package mrkt.app;" package.
        public Connection getDataBaseConnection() {
            Connection conn = null ;
            try {
                Context ctx = new InitialContext();
                DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/myproject");
                conn = ds.getConnection();
            } catch (Exception ex) {
                ex.printStackTrace();
            return conn ;
        }     I needed to create a new class in package "package mrkt.app.cat.shop;", in this new java file i need access to the database so i just copied and pasted the above code in the new java file, compiled it, put it in the "WEB-INF/classes/mrkt/app/cat/shop" folder, restarted tomcat to reload classes. The class is loaded successfully, but i always get the following error when calling the method(getShopsCount) using the connection function (getDatabaseConnection)
    javax.naming.NameNotFoundException: Name jdbc is not bound in this Context
         at org.apache.naming.NamingContext.lookup(NamingContext.java:770)
         at org.apache.naming.NamingContext.lookup(NamingContext.java:140)
         at org.apache.naming.NamingContext.lookup(NamingContext.java:781)
         at org.apache.naming.NamingContext.lookup(NamingContext.java:140)
         at org.apache.naming.NamingContext.lookup(NamingContext.java:781)
         at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
         at org.apache.naming.SelectorContext.lookup(SelectorContext.java:137)
         at javax.naming.InitialContext.lookup(InitialContext.java:351)
         at mrkt.app.cat.shop.ShoppingGuide.getDataBaseConnection(ShoppingGuide.java:30)
         at mrkt.app.cat.shop.ShoppingGuide.getShopsCount(ShoppingGuide.java:49)
         at org.apache.jsp.shopping_005fguide_005fsection_jsp._jspService(shopping_005fguide_005fsection_jsp.java:1418)Regards.
    Yehia A.Salam

    I have the same problem!
    I created a couple of virtualhost on the same webapp like described here
    http://www.onjava.com/pub/a/onjava/2003/06/25/tomcat_tips.html
    the application works without problems if I point my browser to
    http://ip_address/webapp
    but, if I open http://www.myvirtualhost.com/ I get a
    javax.servlet.ServletException: javax.naming.NameNotFoundException: Name jdbc is not bound in this Context
    I even defined the same datasource I use for the ip based browsing in the virtualhost datasources (through admin, without restarting tomcat) but I get the same exception... any suggestion?
    thanks

  • Ejb reference not bound when calling a stateless bean in jboss

    hi there !
    i am trying to deploy a simple stateless session bean in Jboss3.0.4_tomcat-4.1.12
    my bean is successfully deployed but when it is looked up in a jsp i am getting an exception as below :
    javax.naming.NameNotFoundException ejb not bound
    my ejb-jar.xml is as follows :
    <session>
    <display-name>FirstEJB</display-name>
    <ejb-name>First</ejb-name>
    <home>com.ejb.session.FirstHome</home>
    <remote>com.ejb.session.First</remote>
    <ejb-class>com.ejb.session.FirstEJB</ejb-class>
    <session-type>Stateless</session-type>
    <transaction-type>Container</transaction-type>
    </session>
    jboss.xml is as follows:
    <jboss>
    <enterprise-beans>
    <session>
    <ejb-name>First</ejb-name>
    <jndi-name>ejb/First</jndi-name>
    </session>
    </enterprise-beans>
    </jboss>
    my jsp is as follows :
    Properties props = new Properties();
    props.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
    props.put(Context.PROVIDER_URL,"localhost:1099");
    props.put(Context.URL_PKG_PREFIXES,"org.jboss.naming:org.jnp.interfaces" );
    props.put("java.naming.rmi.security.manager","yes");
    Context ctx = new InitialContext(props);
    System.out.println("Before LookUp");
    FirstHome home = (FirstHome)ctx.lookup("session.First");
    System.out.println("LookUp Successfull");
    First bean = home.create();
    Can anyone fix this ?
    Thanx in Advance

    Hi,
    hi Vicky !
    thanx again for ur response.
    i created a Demo.jar file as u said.
    and now where should i place my JSP ?
    first i will tell u my folder structure
    <jboss-home>/server/default/deploy/index.war
    index.war has the following
    firstEJB.jsp
    Web-inf/web.xml
    Web-inf/jboss-web.xml
    Web-inf/lib/First.jar
    First.jar file has my home , remote , bean classes.
    and ejb-jar.xml and jboss.xml files
    web.xml has the <welcome-file-list>
    jboss-web.xml has the <context-root>/</context-root>
    plz tell me where i have messed up my code.
    i have created the Demo.jar file now as u said.
    so plz tell me where should i place my jsp file.
    thanx
    lakshmi
    Since your application is having the jsp and ejb hence the deployment should be done as per the J2EE specification, where you have
    1)web-module
    2)ejb-module
    3)appliction-client module
    4)JCA(It is included in J2EE1.3+)
    Now follow the following steps:
    1)Demo.ear folder
    2)Create META-INF/application.xml
    3)Put your Demo.war and Demo.jar in Demo.ear
    4)Demo.jar and Demo.war should be as expalined earlier.Also no need to place the ejb related classes in the WEB-INF/lib of Demo.war.
    5)Write the following contents in the applicaiton.xml
    <?xml version="1.0"?>
    <!DOCTYPE application PUBLIC "-//Sun Microsystems, Inc.//DTD J2EE Application 1.2//EN" "http://java.sun.com/j2ee/dtds/application_1_2.dtd">
    <application>
         <display-name>Project</display-name>     
         <module>
         <ejb>
         Demo.jar
         </ejb>
         </module>     
         <module>
              <web>
                   <web-uri>Demo.war</web-uri>
                   <context-root>/demo</context-root>
              </web>
         </module>
    </application>
    6)You can create the compressed form of ear or keep it exploded in the Jboss/server/default/Demo.ear
    7)Note the console for the results of deplotment
    8)call http://localhost:8080/demo/yourjsp.jsp
    Hope now I have explained in the detail and it should work now.
    Regards
    Vicky

  • Bean Not Bound + Netbeans 5.5 + JBoss 4.0.2

    Hello Friends,
    I'm new to EJB. I'm writing EJB application using Netbeans 5.5 & Sun Java System application Server. When I run application I faced with following exception :
    javax.naming.NameNotFoundException: <beanname>Bean not bound
    Plz help me out. I have searched it on Google but Solutions is for JBoss.. or different situations.
    //PremInd
    Message was edited by:
    PremInd

    Hello Friends,
    I'm new to EJB. I'm writing EJB application using Netbeans 5.5 & Sun Java System application Server. When I run application I faced with following exception :
    javax.naming.NameNotFoundException: <beanname>Bean not bound
    Plz help me out. I have searched it on Google but Solutions is for JBoss.. or different situations.
    //PremInd
    Message was edited by:
    PremInd

  • Ejb3 bean not bound

    Hi I am new to EJB . Now in our project we are using ejb3 and persistance. So tried
    a simple program which I found out from net. But when I am trying to run I am getting
    bean not bound. And in JBoss console it is showing error like
    ObjectName: jboss.jca:service=DataSourceBinding,name=DefaultDS State: NOTYETINSTALLED
    These are all my files.
    Book.java
    package de.laliluna.library;
    import java.io.Serializable;
    import javax.persistence.Entity;
    import javax.persistence.GeneratedValue;
    import javax.persistence.GenerationType;
    import javax.persistence.Id;
    import javax.persistence.SequenceGenerator;
    import javax.persistence.Table;
    @Entity
    @Table(name="book")
    @SequenceGenerator(name = "book_sequence", sequenceName = "book_id_seq")
    public class Book implements Serializable {
         private static final long serialVersionUID = 7422574264557894633L;
         private Integer id;
         private String title;
         private String author;
         public Book() {
              super();
         public Book(Integer id, String title, String author) {
              super();
              this.id = id;
              this.title = title;
              this.author = author;
         @Override
         public String toString() {
              return "Book: " + getId() + " Title " + getTitle() + " Author "
                        + getAuthor();
         public String getAuthor() {
              return author;
         public void setAuthor(String author) {
              this.author = author;
         @Id
         @GeneratedValue(strategy = GenerationType.TABLE, generator = "book_id")
         public Integer getId() {
              return id;
         public void setId(Integer id) {
              this.id = id;
         public String getTitle() {
              return title;
         public void setTitle(String title) {
              this.title = title;
    }BookTestBean.java
    package de.laliluna.library;
    import java.util.Iterator;
    import java.util.List;
    import javax.ejb.Stateless;
    import javax.persistence.EntityManager;
    import javax.persistence.PersistenceContext;
    @Stateless
    public class BookTestBean implements BookTestBeanLocal, BookTestBeanRemote {
         @PersistenceContext(name="FirstEjb3Tutorial")
         EntityManager em;
         public static final String RemoteJNDIName =  BookTestBean.class.getSimpleName() + "/remote";
         public static final String LocalJNDIName =  BookTestBean.class.getSimpleName() + "/local";
         public void test() {
              Book book = new Book(null, "My first bean book", "Sebastian");
              em.persist(book);
              Book book2 = new Book(null, "another book", "Paul");
              em.persist(book2);
              Book book3 = new Book(null, "EJB 3 developer guide, comes soon",
                        "Sebastian");
              em.persist(book3);
              System.out.println("list some books");
              List someBooks = em.createQuery("from Book b where b.author=:name")
                        .setParameter("name", "Sebastian").getResultList();
              for (Iterator iter = someBooks.iterator(); iter.hasNext();)
                   Book element = (Book) iter.next();
                   System.out.println(element);
              System.out.println("List all books");
              List allBooks = em.createQuery("from Book").getResultList();
              for (Iterator iter = allBooks.iterator(); iter.hasNext();)
                   Book element = (Book) iter.next();
                   System.out.println(element);
              System.out.println("delete a book");
              em.remove(book2);
              System.out.println("List all books");
               allBooks = em.createQuery("from Book").getResultList();
              for (Iterator iter = allBooks.iterator(); iter.hasNext();)
                   Book element = (Book) iter.next();
                   System.out.println(element);
    }BookTestBeanLocal.java
    package de.laliluna.library;
    import javax.ejb.Local;
    @Local
    public interface BookTestBeanLocal {
         public void test();     
    }BookTestBeanRemote.java
    package de.laliluna.library;
    import javax.ejb.Remote;
    @Remote
    public interface BookTestBeanRemote {
         public void test();
    }client part--> FirstEJB3TutorialClient.java
    package de.laliluna.library;
    import java.util.Properties;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    import de.laliluna.library.BookTestBean;
    import de.laliluna.library.BookTestBeanRemote;
    * @author hennebrueder
    public class FirstEJB3TutorialClient {
          * @param args
         public static void main(String[] args) {
               * get a initial context. By default the settings in the file
               * jndi.properties are used. You can explicitly set up properties
               * instead of using the file.
                Properties properties = new Properties();
                properties.put("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
                properties.put("java.naming.factory.url.pkgs","=org.jboss.naming:org.jnp.interfaces");
                properties.put("java.naming.provider.url","localhost:1099");
              Context context;
              try {
                   context = new InitialContext(properties);
                   BookTestBeanRemote beanRemote = (BookTestBeanRemote) context
                             .lookup(BookTestBean.RemoteJNDIName);
                   beanRemote.test();
              } catch (NamingException e) {
                   e.printStackTrace();
                    * I rethrow it as runtimeexception as there is really no need to
                    * continue if an exception happens and I do not want to catch it
                    * everywhere.
                   throw new RuntimeException(e);
    }I have created persistance.xml and application.xml under META-INF folder.
    persistance.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <persistence>
    <persistence-unit name="FirstEjb3Tutorial">
    <jta-data-source>hsqldb-db</jta-data-source>
    <properties>
    <property name="hibernate.hbm2ddl.auto"
    value="create-drop"/>
    </properties>
    </persistence-unit>
    </persistence>application.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <application xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="5" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd">
         <display-name>Stateless Session Bean Example</display-name>
         <module>
              <ejb>FirstEjb3Tutorial.jar</ejb>
         </module>
    </application>and in hsqldb-ds i have configured the driver and connection
    <datasources>
       <local-tx-datasource>
          <!-- The jndi name of the DataSource, it is prefixed with java:/ -->
          <!-- Datasources are not available outside the virtual machine -->
          <jndi-name>ejb3ProjectDS</jndi-name>
          <!-- For server mode db, allowing other processes to use hsqldb over tcp.
          This requires the org.jboss.jdbc.HypersonicDatabase mbean.
          <connection-url>jdbc:hsqldb:hsql://${jboss.bind.address}:1701</connection-url>
          -->
          <!-- For totally in-memory db, not saved when jboss stops.
          The org.jboss.jdbc.HypersonicDatabase mbean is required for proper db shutdown
          <connection-url>jdbc:hsqldb:.</connection-url>
          -->
          <!-- For in-process persistent db, saved when jboss stops.
          The org.jboss.jdbc.HypersonicDatabase mbean is required for proper db shutdown
          -->
         <!-- <connection-url>jdbc:hsqldb:${jboss.server.data.dir}${/}hypersonic${/}localDB</connection-url-->
         <connection-url>jdbc:hsqldb:data/tutorial</connection-url>
          <!-- The driver class -->
          <driver-class>org.hsqldb.jdbcDriver</driver-class>
          <!-- The login and password -->
          <user-name>sa</user-name>
          <password></password>
          <!--example of how to specify class that determines if exception means connection should be destroyed-->
          <!--exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.DummyExceptionSorter</exception-sorter-class-name-->
          <!-- this will be run before a managed connection is removed from the pool for use by a client-->
          <!--<check-valid-connection-sql>select * from something</check-valid-connection-sql> -->
          <!-- The minimum connections in a pool/sub-pool. Pools are lazily constructed on first use -->
          <min-pool-size>5</min-pool-size>
          <!-- The maximum connections in a pool/sub-pool -->
          <max-pool-size>20</max-pool-size>
          <!-- The time before an unused connection is destroyed -->
          <!-- NOTE: This is the check period. It will be destroyed somewhere between 1x and 2x this timeout after last use -->
          <!-- TEMPORARY FIX! - Disable idle connection removal, HSQLDB has a problem with not reaping threads on closed connections -->
          <idle-timeout-minutes>0</idle-timeout-minutes>
          <!-- sql to call when connection is created
            <new-connection-sql>some arbitrary sql</new-connection-sql>
          -->
          <!-- sql to call on an existing pooled connection when it is obtained from pool
             <check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql>
          -->
          <!-- example of how to specify a class that determines a connection is valid before it is handed out from the pool
             <valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.DummyValidConnectionChecker</valid-connection-checker-class-name>
          -->
          <!-- Whether to check all statements are closed when the connection is returned to the pool,
               this is a debugging feature that should be turned off in production -->
          <track-statements/>
          <!-- Use the getConnection(user, pw) for logins
            <application-managed-security/>
          -->
          <!-- Use the security domain defined in conf/login-config.xml -->
          <security-domain>HsqlDbRealm</security-domain>
          <!-- Use the security domain defined in conf/login-config.xml or the
               getConnection(user, pw) for logins. The security domain takes precedence.
            <security-domain-and-application>HsqlDbRealm</security-domain-and-application>
          -->
          <!-- HSQL DB benefits from prepared statement caching -->
          <prepared-statement-cache-size>32</prepared-statement-cache-size>
          <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
          <metadata>
             <type-mapping>Hypersonic SQL</type-mapping>
          </metadata>
          <!-- When using in-process (standalone) mode -->
          <depends>jboss:service=Hypersonic,database=localDB</depends>
          <!-- Uncomment when using hsqldb in server mode
          <depends>jboss:service=Hypersonic</depends>
          -->
       </local-tx-datasource>
       <!-- Uncomment if you want hsqldb accessed over tcp (server mode)
       <mbean code="org.jboss.jdbc.HypersonicDatabase"
         name="jboss:service=Hypersonic">
         <attribute name="Port">1701</attribute>
         <attribute name="BindAddress">${jboss.bind.address}</attribute>    
         <attribute name="Silent">true</attribute>
         <attribute name="Database">default</attribute>
         <attribute name="Trace">false</attribute>
         <attribute name="No_system_exit">true</attribute>
       </mbean>
       -->
       <!-- For hsqldb accessed from jboss only, in-process (standalone) mode -->
       <mbean code="org.jboss.jdbc.HypersonicDatabase"
         name="jboss:service=Hypersonic,database=localDB">
         <attribute name="Database">localDB</attribute>
         <attribute name="InProcessMode">true</attribute>
       </mbean>
    </datasources>.
    Edited by: bhanu on Dec 2, 2008 9:45 AM

    Hi jadespirit ,
    I have the same problem in the same Book example ,my ejb3 project name "BaseHotele" so i follow what u said and this is my persistence.xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <persistence>
    <persistence-unit name="FirstEjb3Tutorial">
    *<jta-data-source>java:BaseHoteleDS</jta-data-source>*
    <properties>
    <property name="hibernate.hbm2ddl.auto"
    value="create-drop"/>
    </properties>
    </persistence-unit>
    </persistence>
    But it didn't work i have always HotelTestBean not bound!!
    Help PLEASE i think that i had a mistake in the persistence.xml:i have 2 days searching for solutions without a good result!!!!!!!!!!!!!

  • Javax.naming.NameNotFoundException: Name java:comp is not bound in this Con

    Hi
    I have developed a search servlet and deployed it in tomcat 4.0.3 and connected to mysql database through jdbc by specifying jndi.
    I have coded JNDI lokkup name as "java:comp/env/jdbc/KgoogleDB"
    I have added a context in server.xml file of tomcat for DBCP connection pooling .I have tested this in windows and it is running well in it.
    But when i hosted this in linux i got error like this
    INIT OF SEARCH SERVLET
    Error in file reading Connection refused
    File Not Found
    javax.naming.NameNotFoundException: Name java:comp is not bound in this Context
    at org.apache.naming.NamingContext.lookup(NamingContext.java:811)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:194)
    at javax.naming.InitialContext.lookup(InitialContext.java:354)
    at DbConnect.getConnection(DbConnect.java:35)
    at QueryDetails.Query(QueryDetails.java:32)
    at Search.doPost(Search.java:66)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:446)
    at org.apache.catalina.servlets.InvokerServlet.doPost(InvokerServlet.java:216)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
    at filters.ExampleFilter.doFilter(ExampleFilter.java:149)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
    at filters.ExampleFilter.doFilter(ExampleFilter.java:149)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:475)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
    at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2343)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
    at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.connector.warp.WarpRequestHandler.handle(WarpRequestHandler.java:217)
    at org.apache.catalina.connector.warp.WarpConnection.run(WarpConnection.java:194)
    at java.lang.Thread.run(Thread.java:536)
    Connection ID null
    Entered FINALLY
    =================================
    What would be the cause of this error?.Please help me.
    My server.xml context is
    - <Host className="org.apache.catalina.connector.warp.WarpHost" name="www.keralagoogle.com" debug="0" appBase="/domains/www.yy.com/tomcat/webapps" unpackWARs="true">
    - <Context path="/yyjava" docBase="/domains/www.yy.com/tomcat/webapps/yyjava" debug="0" reloadable="true" crossContext="true">
    <Logger className="org.apache.catalina.logger.FileLogger" prefix="localhost_KgoogleDB." suffix=".txt" timestamp="true" />
    <Resource name="jdbc/KgoogleDB" auth="Container" type="javax.sql.DataSource" />
    - <ResourceParams name="jdbc/KgoogleDB">
    - <parameter>
    <name>factory</name>
    <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
    </parameter>
    - <!--
    Maximum number of dB connections in pool. Make sure you
              configure your mysqld max_connections large enough to handle
              all of your db connections. Set to 0 for no limit.
    -->
    - <parameter>
    <name>maxActive</name>
    <value>500</value>
    </parameter>
    - <!--
    Maximum number of idle dB connections to retain in pool.
              Set to 0 for no limit.
    -->
    - <parameter>
    <name>maxIdle</name>
    <value>300</value>
    </parameter>
    - <!--
    Maximum time to wait for a dB connection to become available
              in ms, in this example 10 seconds. An Exception is thrown if
              this timeout is exceeded. Set to -1 to wait indefinitely.
    -->
    - <parameter>
    <name>maxWait</name>
    <value>12000</value>
    </parameter>
    - <!-- MySQL dB username and password for dB connections
    -->
    - <parameter>
    <name>username</name>
    <value>pratap</value>
    </parameter>
    - <parameter>
    <name>password</name>
    <value>ky67yumXg</value>
    </parameter>
    - <!-- Class name for mm.mysql JDBC driver
    -->
    - <parameter>
    <name>driverClassName</name>
    <value>com.mysql.jdbc.Driver</value>
    </parameter>
    - <!--
    The JDBC connection url for connecting to your MySQL dB.
              The autoReconnect=true argument to the url makes sure that the
              mm.mysql JDBC Driver will automatically reconnect if mysqld closed the
              connection. mysqld by default closes idle connections after 8 hours.
    -->
    - <parameter>
    <name>url</name>
    <value>jdbc:mysql://localhost:3306/kgoogle?</value>
    </parameter>
    </ResourceParams>
    </Context>
    ==============================
    Please help me find if i have to change the syntax for linux in the above code.
    Thanks in Advance
    Prathap

    hi
    Thanks for your advise.
    But when i chenged my web.xml and jndi name in my servlet file i got error like this
    javax.naming.NameNotFoundException: Name jdbc is not bound in this Context
    at org.apache.naming.NamingContext.lookup(NamingContext.java:811)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:194)
    at org.apache.naming.SelectorContext.lookup(SelectorContext.java:183)
    at javax.naming.InitialContext.lookup(InitialContext.java:354)
    at DbConnect.getConnection(DbConnect.java:35)
    at QueryDetails.Query(QueryDetails.java:32)
    at Search.doPost(Search.java:66)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServl
    et.java:446)
    at org.apache.catalina.servlets.InvokerServlet.doPost(InvokerServlet.jav
    a:216)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
    icationFilterChain.java:247)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
    ilterChain.java:193)
    at filters.ExampleFilter.doFilter(ExampleFilter.java:149)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
    icationFilterChain.java:213)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
    ilterChain.java:193)
    at filters.ExampleFilter.doFilter(ExampleFilter.java:149)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
    icationFilterChain.java:213)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
    ilterChain.java:193)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
    alve.java:243)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
    .java:566)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
    a:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
    alve.java:190)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
    .java:566)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authentica
    torBase.java:475)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
    .java:564)
    at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve
    .java:246)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
    .java:564)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
    a:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:
    2343)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
    ava:180)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
    .java:566)
    at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatche
    rValve.java:170)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
    .java:564)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
    ava:170)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
    .java:564)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:
    468)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
    .java:564)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
    a:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
    ve.java:174)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
    .java:566)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
    a:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcesso
    r.java:1012)
    at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.ja
    va:1107)
    at java.lang.Thread.run(Thread.java:536)
    Connection ID null
    Entered FINALLY
    Please help me
    Thanks in Advance
    Prathap

  • Error: ConnectionFactory not bound

    Hi,
    I have created a method in session bean to send message. below is the code of my method
    public void sendMessage() throws NamingException,JMSException{
    QueueConnectionFactory cf;
    QueueConnection connection;
    QueueSession session;
    Queue destination;
    QueueSender sender;
    TextMessage message;
    Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY,
    "org.jnp.interfaces.NamingContextFactory");
    env.put(Context.PROVIDER_URL,
    "localhost:1099");
    Context ctx = new InitialContext(env);
    //ctx = new InitialContext();
    cf = (QueueConnectionFactory)ctx.lookup("ConnectionFactory");
    destination = (Queue)ctx.lookup("queue/testQueue");
    connection = cf.createQueueConnection();
    session = connection.createQueueSession(false,
    Session.AUTO_ACKNOWLEDGE);
    sender = session.createSender(destination);
    message = session.createTextMessage();
    message.setText("Hello World1!");
    System.out.println("Sending Message.");
    sender.send(message);
    connection.close();
    System.out.println("Done.");
    I am getting the following error in the browser
    javax.naming.NameNotFoundException: ConnectionFactory not bound
    Can anyone tell me why this error is coming
    Thanks

    I am getting the following errors in the console. Please check it
    ===============================================================================
    JBoss Bootstrap Environment
    JBOSS_HOME: C:\jboss-4.0.1\bin\\..
    JAVA: D:\j2sdk1.4.2_07\bin\java
    JAVA_OPTS: -Dprogram.name=run.bat -Xms128m -Xmx512m
    CLASSPATH: D:\j2sdk1.4.2_07\lib\tools.jar;C:\jboss-4.0.1\bin\\run.jar
    ===============================================================================
    14:31:23,312 INFO [Server] Starting JBoss (MX MicroKernel)...
    14:31:23,312 INFO [Server] Release ID: JBoss [Zion] 4.0.1 (build: CVSTag=JBoss_4_0_1 date=200412230944)
    14:31:23,312 INFO [Server] Home Dir: C:\jboss-4.0.1
    14:31:23,312 INFO [Server] Home URL: file:/C:/jboss-4.0.1/
    14:31:23,312 INFO [Server] Library URL: file:/C:/jboss-4.0.1/lib/
    14:31:23,312 INFO [Server] Patch URL: null
    14:31:23,312 INFO [Server] Server Name: default
    14:31:23,328 INFO [Server] Server Home Dir: C:\jboss-4.0.1\server\default
    14:31:23,328 INFO [Server] Server Home URL: file:/C:/jboss-4.0.1/server/default/
    14:31:23,328 INFO [Server] Server Data Dir: C:\jboss-4.0.1\server\default\data
    14:31:23,328 INFO [Server] Server Temp Dir: C:\jboss-4.0.1\server\default\tmp
    14:31:23,343 INFO [Server] Server Config URL: file:/C:/jboss-4.0.1/server/default/conf/
    14:31:23,343 INFO [Server] Server Library URL: file:/C:/jboss-4.0.1/server/default/lib/
    14:31:23,343 INFO [Server] Root Deployment Filename: jboss-service.xml
    14:31:23,343 INFO [Server] Starting General Purpose Architecture (GPA)...
    14:31:24,312 INFO [ServerInfo] Java version: 1.4.2_07,Sun Microsystems Inc.
    14:31:24,312 INFO [ServerInfo] Java VM: Java HotSpot(TM) Client VM 1.4.2_07-b05,Sun Microsystems Inc.
    14:31:24,312 INFO [ServerInfo] OS-System: Windows 2000 5.0,x86
    14:31:25,203 INFO [Server] Core system initialized
    14:31:28,468 INFO [Log4jService$URLWatchTimerTask] Configuring from URL: resource:log4j.xml
    14:31:28,828 INFO [WebService] Using RMI server codebase: http://Mukti:8083/
    14:31:29,140 INFO [NamingService] Started jndi bootstrap jnpPort=1099, rmiPort=1098, backlog=50, bindAddress=/0.0.0.0, Client SocketFactory=null, Server SocketFactory=org.jboss.net.sockets.DefaultSocketFactory@ad093076
    14:31:38,968 INFO [Embedded] Catalina naming disabled
    14:31:40,250 INFO [Http11Protocol] Initializing Coyote HTTP/1.1 on http-0.0.0.0-8080
    14:31:40,343 INFO [Catalina] Initialization processed in 1203 ms
    14:31:40,343 INFO [StandardService] Starting service jboss.web
    14:31:40,359 INFO [StandardEngine] Starting Servlet Engine: Apache Tomcat/5.0.28
    14:31:40,421 INFO [StandardHost] XML validation disabled
    14:31:40,453 INFO [Catalina] Server startup in 110 ms
    14:31:40,750 INFO [TomcatDeployer] deploy, ctxPath=/invoker, warUrl=file:/C:/jboss-4.0.1/server/default/deploy/http-invoker.sar/invoker.war/
    14:31:42,859 INFO [TomcatDeployer] deploy, ctxPath=/ws4ee, warUrl=file:/C:/jboss-4.0.1/server/default/tmp/deploy/tmp4763jboss-ws4ee-exp.war/
    14:31:43,234 INFO [TomcatDeployer] deploy, ctxPath=/, warUrl=file:/C:/jboss-4.0.1/server/default/deploy/jbossweb-tomcat50.sar/ROOT.war/
    14:31:43,703 INFO [TomcatDeployer] deploy, ctxPath=/jbossmq-httpil, warUrl=file:/C:/jboss-4.0.1/server/default/deploy/jms/jbossmq-httpil.sar/jbossmq-httpil.war/
    14:31:48,765 INFO [MailService] Mail Service bound to java:/Mail
    14:31:49,984 INFO [RARDeployment] Required license terms exist view the META-INF/ra.xml: file:/C:/jboss-4.0.1/server/default/deploy/jboss-local-jdbc.rar
    14:31:50,375 INFO [RARDeployment] Required license terms exist view the META-INF/ra.xml: file:/C:/jboss-4.0.1/server/default/deploy/jboss-xa-jdbc.rar
    14:31:50,734 INFO [RARDeployment] Required license terms exist view the META-INF/ra.xml: file:/C:/jboss-4.0.1/server/default/deploy/jms/jms-ra.rar
    14:31:51,046 INFO [RARDeployment] Required license terms exist view the META-INF/ra.xml: file:/C:/jboss-4.0.1/server/default/deploy/mail-ra.rar
    14:31:51,968 ERROR [HypersonicDatabase] Starting failed jboss:database=localDB,service=Hypersonic
    java.sql.SQLException: General error: java.lang.NullPointerException
         at org.hsqldb.jdbc.jdbcUtil.sqlException(Unknown Source)
         at org.hsqldb.jdbc.jdbcConnection.<init>(Unknown Source)
         at org.hsqldb.jdbcDriver.getConnection(Unknown Source)
         at org.hsqldb.jdbcDriver.connect(Unknown Source)
         at java.sql.DriverManager.getConnection(DriverManager.java:512)
         at java.sql.DriverManager.getConnection(DriverManager.java:171)
         at org.jboss.jdbc.HypersonicDatabase.getConnection(HypersonicDatabase.java:806)
         at org.jboss.jdbc.HypersonicDatabase.startStandaloneDatabase(HypersonicDatabase.java:617)
         at org.jboss.jdbc.HypersonicDatabase.startService(HypersonicDatabase.java:587)
         at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:272)
         at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:222)
         at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:144)
         at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
         at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
         at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
         at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
         at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:891)
         at $Proxy0.start(Unknown Source)
         at org.jboss.system.ServiceController.start(ServiceController.java:416)
         at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:144)
         at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
         at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
         at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
         at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
         at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
         at $Proxy4.start(Unknown Source)
         at org.jboss.deployment.SARDeployer.start(SARDeployer.java:261)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:144)
         at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
         at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
         at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
         at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
         at org.jboss.mx.util.JMXInvocationHandler.invoke(JMXInvocationHandler.java:272)
         at $Proxy34.start(Unknown Source)
         at org.jboss.deployment.XSLSubDeployer.start(XSLSubDeployer.java:228)
         at org.jboss.deployment.MainDeployer.start(MainDeployer.java:964)
         at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:775)
         at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:738)
         at sun.reflect.GeneratedMethodAccessor48.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:144)
         at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
         at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:122)
         at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
         at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:131)
         at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
         at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
         at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
         at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
         at $Proxy8.deploy(Unknown Source)
         at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:305)
         at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:481)
         at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:204)
         at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:277)
         at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:272)
         at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:222)
         at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:144)
         at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
         at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
         at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
         at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
         at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:891)
         at $Proxy0.start(Unknown Source)
         at org.jboss.system.ServiceController.start(ServiceController.java:416)
         at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:144)
         at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
         at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
         at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
         at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
         at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
         at $Proxy4.start(Unknown Source)
         at org.jboss.deployment.SARDeployer.start(SARDeployer.java:261)
         at org.jboss.deployment.MainDeployer.start(MainDeployer.java:964)
         at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:775)
         at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:738)
         at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:722)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:144)
         at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
         at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:122)
         at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
         at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:131)
         at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
         at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
         at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
         at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
         at $Proxy5.deploy(Unknown Source)
         at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:413)
         at org.jboss.system.server.ServerImpl.start(ServerImpl.java:310)
         at org.jboss.Main.boot(Main.java:162)
         at org.jboss.Main$1.run(Main.java:423)
         at java.lang.Thread.run(Thread.java:534)
    14:31:51,968 WARN [ServiceController] Problem starting service jboss:database=localDB,service=Hypersonic
    java.sql.SQLException: General error: java.lang.NullPointerException
         at org.hsqldb.jdbc.jdbcUtil.sqlException(Unknown Source)
         at org.hsqldb.jdbc.jdbcConnection.<init>(Unknown Source)
         at org.hsqldb.jdbcDriver.getConnection(Unknown Source)
         at org.hsqldb.jdbcDriver.connect(Unknown Source)
         at java.sql.DriverManager.getConnection(DriverManager.java:512)
         at java.sql.DriverManager.getConnection(DriverManager.java:171)
         at org.jboss.jdbc.HypersonicDatabase.getConnection(HypersonicDatabase.java:806)
         at org.jboss.jdbc.HypersonicDatabase.startStandaloneDatabase(HypersonicDatabase.java:617)
         at org.jboss.jdbc.HypersonicDatabase.startService(HypersonicDatabase.java:587)
         at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:272)
         at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:222)
         at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:144)
         at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
         at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
         at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
         at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
         at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:891)
         at $Proxy0.start(Unknown Source)
         at org.jboss.system.ServiceController.start(ServiceController.java:416)
         at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:144)
         at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
         at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
         at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
         at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
         at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
         at $Proxy4.start(Unknown Source)
         at org.jboss.deployment.SARDeployer.start(SARDeployer.java:261)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:144)
         at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
         at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
         at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
         at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
         at org.jboss.mx.util.JMXInvocationHandler.invoke(JMXInvocationHandler.java:272)
         at $Proxy34.start(Unknown Source)
         at org.jboss.deployment.XSLSubDeployer.start(XSLSubDeployer.java:228)
         at org.jboss.deployment.MainDeployer.start(MainDeployer.java:964)
         at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:775)
         at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:738)
         at sun.reflect.GeneratedMethodAccessor48.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:144)
         at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
         at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:122)
         at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
         at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:131)
         at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
         at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
         at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
         at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
         at $Proxy8.deploy(Unknown Source)
         at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:305)
         at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:481)
         at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:204)
         at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:277)
         at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:272)
         at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:222)
         at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:144)
         at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
         at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
         at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
         at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
         at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:891)
         at $Proxy0.start(Unknown Source)
         at org.jboss.system.ServiceController.start(ServiceController.java:416)
         at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:144)
         at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
         at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
         at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
         at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
         at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
         at $Proxy4.start(Unknown Source)
         at org.jboss.deployment.SARDeployer.start(SARDeployer.java:261)
         at org.jboss.deployment.MainDeployer.start(MainDeployer.java:964)
         at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:775)
         at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:738)
         at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:722)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:144)
         at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
         at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:122)
         at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
         at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:131)
         at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
         at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
         at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
         at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
         at $Proxy5.deploy(Unknown Source)
         at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:413)
         at org.jboss.system.server.ServerImpl.start(ServerImpl.java:310)
         at org.jboss.Main.boot(Main.java:162)
         at org.jboss.Main$1.run(Main.java:423)
         at java.lang.Thread.run(Thread.java:534)
    14:31:52,562 INFO [ConnectionFactoryBindingService] Bound connection factory for resource adapter for ConnectionManager 'jboss.jca:name=JmsXA,service=ConnectionFactoryBinding to JNDI name 'java:JmsXA'
    14:31:52,921 INFO [WrapperDataSourceService] Bound connection factory for resource adapter for ConnectionManager 'jboss.jca:name=MySqlDS,service=DataSourceBinding to JNDI name 'java:MySqlDS'
    14:31:53,000 INFO [TomcatDeployer] deploy, ctxPath=/jmx-console, warUrl=file:/C:/jboss-4.0.1/server/default/deploy/jmx-console.war/
    14:31:53,515 INFO [TomcatDeployer] deploy, ctxPath=/web-console, warUrl=file:/C:/jboss-4.0.1/server/default/deploy/management/web-console.war/
    14:31:54,859 INFO [EARDeployer] Init J2EE application: file:/C:/jboss-4.0.1/server/default/deploy/teste.ear
    14:31:56,125 INFO [EjbModule] Deploying Teste
    14:31:56,421 WARN [StatelessSessionContainer] No resource manager found for jms/PointToPoint
    14:31:56,453 INFO [EJBDeployer] Deployed: file:/C:/jboss-4.0.1/server/default/tmp/deploy/tmp4815teste.ear-contents/teste-ejb.jar
    14:31:56,562 INFO [TomcatDeployer] deploy, ctxPath=/teste, warUrl=file:/C:/jboss-4.0.1/server/default/tmp/deploy/tmp4815teste.ear-contents/teste-exp.war/
    14:31:56,937 INFO [EARDeployer] Started J2EE application: file:/C:/jboss-4.0.1/server/default/deploy/teste.ear
    14:31:56,937 ERROR [URLDeploymentScanner] Incomplete Deployment listing:
    MBeans waiting for other MBeans:
    ObjectName: jboss.ejb:persistencePolicy=database,service=EJBTimerService
    state: CREATED
    I Depend On: jboss.jca:name=DefaultDS,service=DataSourceBinding
    Depends On Me:
    ObjectName: jboss.mq:service=InvocationLayer,type=HTTP
    state: CREATED
    I Depend On: jboss.mq:service=Invoker
    jboss.web:service=WebServer
    Depends On Me:
    ObjectName: jboss:service=KeyGeneratorFactory,type=HiLo
    state: CREATED
    I Depend On: jboss:service=TransactionManager
    jboss.jca:name=DefaultDS,service=DataSourceBinding
    Depends On Me:
    ObjectName: jboss.mq:service=StateManager
    state: CREATED
    I Depend On: jboss.jca:name=DefaultDS,service=DataSourceBinding
    Depends On Me: jboss.mq:service=DestinationManager
    ObjectName: jboss.mq:service=DestinationManager
    state: CREATED
    I Depend On: jboss.mq:service=MessageCache
    jboss.mq:service=PersistenceManager
    jboss.mq:service=StateManager
    Depends On Me: jboss.mq.destination:name=testTopic,service=Topic
    jboss.mq.destination:name=securedTopic,service=Topic
    jboss.mq.destination:name=testDurableTopic,service=Topic
    jboss.mq.destination:name=testQueue,service=Queue
    jboss.mq.destination:name=A,service=Queue
    jboss.mq.destination:name=B,service=Queue
    jboss.mq.destination:name=C,service=Queue
    jboss.mq.destination:name=D,service=Queue
    jboss.mq.destination:name=ex,service=Queue
    jboss.mq:service=SecurityManager
    jboss.mq.destination:name=DLQ,service=Queue
    ObjectName: jboss.mq:service=PersistenceManager
    state: CREATED
    I Depend On: jboss.jca:name=DefaultDS,service=DataSourceBinding
    Depends On Me: jboss.mq:service=DestinationManager
    ObjectName: jboss.mq.destination:name=testTopic,service=Topic
    state: CREATED
    I Depend On: jboss.mq:service=DestinationManager
    jboss.mq:service=SecurityManager
    Depends On Me:
    ObjectName: jboss.mq.destination:name=securedTopic,service=Topic
    state: CREATED
    I Depend On: jboss.mq:service=DestinationManager
    jboss.mq:service=SecurityManager
    Depends On Me:
    ObjectName: jboss.mq.destination:name=testDurableTopic,service=Topic
    state: CREATED
    I Depend On: jboss.mq:service=DestinationManager
    jboss.mq:service=SecurityManager
    Depends On Me:
    ObjectName: jboss.mq.destination:name=testQueue,service=Queue
    state: CREATED
    I Depend On: jboss.mq:service=DestinationManager
    jboss.mq:service=SecurityManager
    Depends On Me:
    ObjectName: jboss.mq.destination:name=A,service=Queue
    state: CREATED
    I Depend On: jboss.mq:service=DestinationManager
    Depends On Me:
    ObjectName: jboss.mq.destination:name=B,service=Queue
    state: CREATED
    I Depend On: jboss.mq:service=DestinationManager
    Depends On Me:
    ObjectName: jboss.mq.destination:name=C,service=Queue
    state: CREATED
    I Depend On: jboss.mq:service=DestinationManager
    Depends On Me:
    ObjectName: jboss.mq.destination:name=D,service=Queue
    state: CREATED
    I Depend On: jboss.mq:service=DestinationManager
    Depends On Me:
    ObjectName: jboss.mq.destination:name=ex,service=Queue
    state: CREATED
    I Depend On: jboss.mq:service=DestinationManager
    Depends On Me:
    ObjectName: jboss.mq:service=Invoker
    state: CREATED
    I Depend On: jboss.mq:service=TracingInterceptor
    Depends On Me: jboss.mq:service=InvocationLayer,type=HTTP
    jboss.mq:service=InvocationLayer,type=JVM
    jboss.mq:service=InvocationLayer,type=UIL2
    ObjectName: jboss.mq:service=TracingInterceptor
    state: CREATED
    I Depend On: jboss.mq:service=SecurityManager
    Depends On Me: jboss.mq:service=Invoker
    ObjectName: jboss.mq:service=SecurityManager
    state: CREATED
    I Depend On: jboss.mq:service=DestinationManager
    Depends On Me: jboss.mq.destination:name=testTopic,service=Topic
    jboss.mq.destination:name=securedTopic,service=Topic
    jboss.mq.destination:name=testDurableTopic,service=Topic
    jboss.mq.destination:name=testQueue,service=Queue
    jboss.mq:service=TracingInterceptor
    jboss.mq.destination:name=DLQ,service=Queue
    ObjectName: jboss.mq.destination:name=DLQ,service=Queue
    state: CREATED
    I Depend On: jboss.mq:service=DestinationManager
    jboss.mq:service=SecurityManager
    Depends On Me:
    ObjectName: jboss.mq:service=InvocationLayer,type=JVM
    state: CREATED
    I Depend On: jboss.mq:service=Invoker
    Depends On Me:
    ObjectName: jboss.mq:service=InvocationLayer,type=UIL2
    state: CREATED
    I Depend On: jboss.mq:service=Invoker
    Depends On Me:
    ObjectName: jboss.jca:name=DefaultDS,service=LocalTxCM
    state: CREATED
    I Depend On: jboss.jca:name=DefaultDS,service=ManagedConnectionPool
    jboss.jca:service=CachedConnectionManager
    jboss.security:service=JaasSecurityManager
    jboss:service=TransactionManager
    Depends On Me: jboss.jca:name=DefaultDS,service=DataSourceBinding
    ObjectName: jboss.jca:name=DefaultDS,service=ManagedConnectionPool
    state: CREATED
    I Depend On: jboss.jca:name=DefaultDS,service=ManagedConnectionFactory
    Depends On Me: jboss.jca:name=DefaultDS,service=LocalTxCM
    ObjectName: jboss.jca:name=DefaultDS,service=ManagedConnectionFactory
    state: CREATED
    I Depend On: jboss:database=localDB,service=Hypersonic
    jboss.jca:name='jboss-local-jdbc.rar',service=RARDeployment
    Depends On Me: jboss.jca:name=DefaultDS,service=ManagedConnectionPool
    ObjectName: jboss.jca:name=DefaultDS,service=DataSourceBinding
    state: CREATED
    I Depend On: jboss.jca:name=DefaultDS,service=LocalTxCM
    jboss:service=invoker,type=jrmp
    Depends On Me: jboss.ejb:persistencePolicy=database,service=EJBTimerService
    jboss:service=KeyGeneratorFactory,type=HiLo
    jboss.mq:service=StateManager
    jboss.mq:service=PersistenceManager
    ObjectName: jboss:database=localDB,service=Hypersonic
    state: FAILED
    I Depend On:
    Depends On Me: jboss.jca:name=DefaultDS,service=ManagedConnectionFactory
    java.sql.SQLException: General error: java.lang.NullPointerException
    MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM:
    ObjectName: jboss:database=localDB,service=Hypersonic
    state: FAILED
    I Depend On:
    Depends On Me: jboss.jca:name=DefaultDS,service=ManagedConnectionFactory
    java.sql.SQLException: General error: java.lang.NullPointerException
    14:31:57,265 INFO [Http11Protocol] Starting Coyote HTTP/1.1 on http-0.0.0.0-8080
    14:31:57,578 INFO [ChannelSocket] JK2: ajp13 listening on /0.0.0.0:8009
    14:31:57,609 INFO [JkMain] Jk running ID=0 time=0/141 config=null
    14:31:57,625 INFO [Server] JBoss (MX MicroKernel) [4.0.1 (build: CVSTag=JBoss_4_0_1 date=200412230944)] Started in 33s:766ms

  • Remote JNDI DataSource

    Hi,
    I tried to use a WLS 8.1 JNDI-bound DB2 DataSource from a standalone client.
    For JDBC this works, but for IBM's bound SQLJ it does not, WLS throws an
    NPE. From within WLS, a servlet or EJB, it always works.
    This posting
    (http://forums.bea.com/bea/message.jspa?messageID=600038044&tstart=0 )
    hints that it should not be possible to use a remote JNDI DataSource,
    whereas this Sun doc
    (http://java.sun.com/j2se/1.4.2/docs/guide/jdbc/getstart/datasource.html
    ) states it should.
    So, do I try something, that should not work per specification, or do
    you guess that there is a bug in WLS's code or in IBM's SQLJ implementation?
    Thanks,
    J?rgen
    BTW: the http://forums.bea.com/ don't work neither with Firefox nor with
    IE at the moment.

    remove wlclient.jar from the client application's classpath and you should get a connection.

  • How do I use a JNDI datasource in my application?

    Not sure how to access the JNDI datasource i setup in my config.xml. I tried to browse it at rmi://localhost:1099/ but it only shows jmxrmi in the tree.
    My config.xml looks like
    <n1:config xsi:schemaLocation="http://www.bea.com/ns/wlevs/config/server wlevs_server_config.xsd" xmlns:n1="http://www.bea.com/ns/wlevs/config/server" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <netio>
        <name>NetIO</name>
        <port>9002</port>
      </netio>
      <work-manager>
        <name>JettyWorkManager</name>
        <min-threads-constraint>5</min-threads-constraint>
        <max-threads-constraint>10</max-threads-constraint>
      </work-manager>
      <jetty>
        <name>JettyServer</name>
        <network-io-name>NetIO</network-io-name>
        <work-manager-name>JettyWorkManager</work-manager-name>
      </jetty>
      <rmi>
        <name>RMI</name>
        <http-service-name>JettyServer</http-service-name>
      </rmi>
      <jndi-context>
        <name>JNDI</name>
      </jndi-context>
      <exported-jndi-context>
        <name>exportedJndi</name>
        <rmi-service-name>RMI</rmi-service-name>
      </exported-jndi-context>
      <jmx>
        <jndi-service-name>JNDI</jndi-service-name>
        <rmi-service-name>RMI</rmi-service-name>
        <rmi-registry-port>1099</rmi-registry-port>
        <rmi-jrmp-port>9999</rmi-jrmp-port>
      </jmx>
      <transaction-manager>
          <name>transactionmanager</name>
          <!--max-resource-requests-on-server>1</max-resource-requests-on-server>
          <max-resource-unavailable-millis>1000</max-resource-unavailable-millis-->
      </transaction-manager>
      <data-source>   
          <name>hqsqlconn</name>   
          <driver-params>     
            <url>jdbc:hsqldb:hsql://localhost/wlevdb</url>
            <driver-name>org.hsqldb.jdbcDriver</driver-name>
            <properties>
              <element>
                <name>user</name>
                <value>sa</value>
              </element>
              <element>
                <name>password</name>
                <value></value>
              </element>
            </properties>
            <use-xa-data-source-interface>true</use-xa-data-source-interface>   
          </driver-params>   
          <connection-pool-params>     
            <initial-capacity>1</initial-capacity>     
            <max-capacity>5</max-capacity>     
            <test-table-name>test_table</test-table-name>   
          </connection-pool-params>   
          <data-source-params>     
            <jndi-names>
              <element>hqsqlconn</element>
            </jndi-names>
            <global-transactions-protocol>TwoPhaseCommit</global-transactions-protocol>
          </data-source-params> 
      </data-source>
    </n1:config>

    I see what you are saying.
    The JNDI approach should work-we will try to reproduce this internally.
    I would recommend leveraging the OSGi service registry, instead of using JNDI, however. The Event Server is a modular server based on OSGi, so one should use the OSGi service registry whenever possible instead of using the jndi registry. Jndi is primarily there to support legacy code that requires Jndi.
    Any data sources that you configure are automatically registered in the OSGi service registry. When there is more than one data source they can be distinguished using their name.
    There are a couple of options.
    If you want to inject a reference to your datasource into a Spring bean, you can use an annotation, @Service, to annotate a setter method on your bean (see my previous post). The container will then inject a reference to the data source into the bean.
    You can also put the following in your spring application context file
    <osgi:reference id="myDataSource"
    interface="javax.sql.DataSource"/>
    This creates a bean proxy that references the datasource by looking up the datasource in the OSGi service registry. It works similarly to JndiObjectFactoryBean, but it uses the OSGi service registry instead of the JNDI registry. You can read more about it here
    http://www.springframework.org/osgi/specification
    (Look in section 3.3)
    Hope that helps.
    Seth
    Edited by swhite at 08/01/2007 6:19 PM

Maybe you are looking for