2 Replies Latest reply on Oct 26, 2006 11:17 PM by poonwingyee

    cannot connect db by EJB, pls Help!

    poonwingyee

      i need to upgrade my system from jboss 3.0.8 to 4.0.5.
      the configuration is difference.

      i try to set the

      <?xml version="1.0" encoding="UTF-8"?>
      <datasources>
       <local-tx-datasource>
       <jndi-name>ABCDB</jndi-name>
       <connection-url>jdbc:hsqldb:hsql://localhost:4467</connection-url>
      
       <!-- The driver class -->
       <driver-class>org.hsqldb.jdbcDriver</driver-class>
      
       <!-- The login and password -->
       <user-name>sa</user-name>
       <password></password>
       <min-pool-size>5</min-pool-size>
       <max-pool-size>20</max-pool-size>
       <idle-timeout-minutes>0</idle-timeout-minutes>
       <track-statements/>
      
       <security-domain>ABCDbRealm</security-domain>
      
       <prepared-statement-cache-size>32</prepared-statement-cache-size>
       <metadata>
       <type-mapping>Hypersonic SQL</type-mapping>
       </metadata>
       <depends>jboss:service=ABCHypersonic,database=ABC</depends>
       </local-tx-datasource>
      
       <!-- For hsqldb accessed from jboss only, in-process (standalone) mode -->
       <mbean code="org.jboss.jdbc.HypersonicDatabase" name="jboss:service=DOCAWAREHypersonic,database=ABC">
       <attribute name="Port">4467</attribute>
       <attribute name="Silent">true</attribute>
       <attribute name="Database">ABC</attribute>
       <attribute name="Trace">false</attribute>
       </mbean>
      </datasources>
      


      in the /conf/login-config.xml
      <application-policy name = "ABCDbRealm">
       <authentication>
       <login-module code = "org.jboss.resource.security.ConfiguredIdentityLoginModule"
       flag = "required">
       <module-option name = "principal">sa</module-option>
       <module-option name = "userName">sa</module-option>
       <module-option name = "password"></module-option>
       <module-option name = "managedConnectionFactoryName">jboss.jca:service=LocalTxCM,name=ABCDB</module-option>
       </login-module>
       </authentication>
       </application-policy>
      



      when i load the web page, the error is occured.
      java.lang.ClassCastException in
      try{
      Context ctx = getInitialContext();
      objref = ctx.lookup(lookUpName);
      EJBHome home = (EJBHome)PortableRemoteObject.narrow(objref,homeClass);
      .....
      the error is occured in PortableRemoteObject.narrow(objref,homeClass);
      


      how come. i am the first time to setting jboss. please help.!!!!

      if i don't use the ejb to connect , i can connect the db to get the data to the web page.

      HELP!!!!!!!!!!!!