2 Replies Latest reply on Sep 15, 2003 11:58 AM by arabin

    What is wrong with my Solid Datasource?

    arabin Novice

      I have a problem connecting form JBoss 3.2.2 to Solid. Do you know what is wrong?

      My file solid-ds.xml is located under default/deploy directory and contains the following:

      <local-tx-datasource>
      <jndi-name>SolidDS</jndi-name>
      <!--NOTE: Solid wants the username/password in the URL, it will
      ignore the specific arguments.-->
      <connection-url>jdbc:solid://localhost:1315/dba/dba</connection-url>
      <driver-class>solid.jdbc.SolidDriver</driver-class>
      </local-tx-datasource>




      My standardjaws.xml ander default/conf contains the following:

      java:/SolidDS
      <type-mapping>SOLID</type-mapping>
      false

      My standardjbosscmp-jdbc.xml under default/conf contains the following:

      java:/SolidDS
      <datasource-mapping>SOLID</datasource-mapping>

      The server.log file contains the following:

      2003-09-15 11:37:48,515 DEBUG [org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.SolidDS] Binding object 'org.jboss.resource.adapter.jdbc.WrapperDataSource@1aac07d' into JNDI at 'java:/SolidDS'
      2003-09-15 11:37:48,515 INFO [org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.SolidDS] Bound connection factory for resource adapter for ConnectionManager 'jboss.jca:service=LocalTxCM,name=SolidDS to JNDI name 'java:/SolidDS'

      The JMX console MBean name=SolidDS,service=LocalTxCM shows JNDIName SolidDS

      I am using the following stateless session EJB code to access the database:

      package com.teamworks.ejb;


      import javax.ejb.SessionBean;
      import javax.ejb.EJBException;
      import javax.ejb.SessionContext;
      import javax.ejb.CreateException;

      import javax.rmi.PortableRemoteObject;
      import javax.naming.*;
      import javax.sql.DataSource;
      import javax.management.ObjectName;

      import java.rmi.RemoteException;
      import java.sql.*;
      import java.util.Collection;
      import java.util.Vector;
      import java.util.ArrayList;
      import java.util.Hashtable;
      import java.net.InetAddress;
      import java.net.UnknownHostException;

      /**

      * Example bean.
      *
      * @ejb.transaction type="Required"
      *
      * @ejb.transaction-type type="Container"
      *
      * @ejb.resource-ref
      * res-name="jdbc/SolidDS"
      * res-type="javax.sql.DataSource"
      * res-auth="Container"
      *
      * @ejb.bean name="jms/Example"
      * type="Stateless"
      * jndi-name="ejb/jms/Example"
      *
      * @jboss.resource-ref
      * res-ref-name="jdbc/SolidSDS"
      * resource-name="SolidDS"
      *
      * @jboss.ejb-ref-jndi
      * ref-name="jms/Example"
      * jndi-name="ejb/jms/Example"
      *
      * @jboss.container-configuration
      * name="Standard Stateless SessionBean"
      **/

      /**
      * Title:
      * Description:
      * Copyright: Copyright (c) 2002
      * Company:
      * @author unascribed
      * @version 1.0
      */

      public abstract class ExampleBean implements SessionBean {

      private DataSource ds;
      private String poolName = "java:/SolidDS";

      private static Hashtable m_configTypesHash = new Hashtable();

      /**
      * @ejb.interface-method
      */
      public String findConfigTypeByID (int confID)
      {
      try
      {
      return selectTypeByConfID (confID) ;
      }
      catch (SQLException ex)
      {
      ex.printStackTrace();
      return null;
      }
      }

      /*********************** Database Routines *************************/

      private Connection getConnection() throws SQLException
      {
      try {
      Context initialCtx = new InitialContext();
      ds = (DataSource) initialCtx.lookup (poolName);
      } catch (Exception e) {e.printStackTrace(); return null;}
      return ds.getConnection();
      }

      private String selectTypeByConfID (int confID) throws SQLException
      {
      Integer conf_int = new Integer(confID);
      String name = (String)m_configTypesHash.get(conf_int);
      if (name != null) return name;

      Connection con = getConnection();

      String selectStatement =
      "SELECT NAME FROM AA WHERE ID = 1";

      try {
      PreparedStatement prepStmt = con.prepareStatement(selectStatement);

      prepStmt.setInt (1, confID);

      ResultSet rs = prepStmt.executeQuery();

      name = "";
      if (rs.next())
      {
      name = rs.getString (1);
      }
      prepStmt.close();
      }
      finally {con.close();}

      if (!name.equals("")) {
      m_configTypesHash.put(conf_int, name);
      }

      return name;
      }



      /**
      * @ejb.create-method
      */

      public void ejbCreate () throws CreateException//, RemoteException
      {
      try {
      Context initialCtx = new InitialContext();
      ds = (DataSource) initialCtx.lookup (poolName);
      }
      catch(Exception ex) {throw new CreateException();}
      }

      public void ejbRemove() throws javax.ejb.EJBException, java.rmi.RemoteException
      {
      ds = null ;
      }

      }


      I have the following error when I am trying to connect and select from an existing table AA via executing method selectTypeByConfID of the EBJ:

      2003-09-15 11:38:09,640 ERROR [STDERR] java.sql.SQLException: [Solid JDBC 02.10.0025] SOLID Table Error 13011: Table AA does not exist
      2003-09-15 11:38:09,640 ERROR [STDERR] at solid.jdbc.SolidConnection.s_AddAndThrowError(Unknown Source)
      2003-09-15 11:38:09,640 ERROR [STDERR] at solid.jdbc.SolidPreparedStatement.s_prepareStmt(Unknown Source)
      2003-09-15 11:38:09,640 ERROR [STDERR] at solid.jdbc.SolidPreparedStatement.(Unknown Source)
      2003-09-15 11:38:09,640 ERROR [STDERR] at solid.jdbc.SolidConnection.prepareStatement(Unknown Source)
      2003-09-15 11:38:09,640 ERROR [STDERR] at solid.jdbc.SolidConnection.prepareStatement(Unknown Source)
      2003-09-15 11:38:09,640 ERROR [STDERR] at org.jboss.resource.adapter.jdbc.WrappedConnection.prepareStatement(WrappedConnection.java:221)
      2003-09-15 11:38:09,640 ERROR [STDERR] at com.teamworks.ejb.ExampleBean.selectTypeByConfID(ExampleBean.java:107)
      2003-09-15 11:38:09,640 ERROR [STDERR] at com.teamworks.ejb.ExampleBean.findConfigTypeByID(ExampleBean.java:75)
      2003-09-15 11:38:09,640 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2003-09-15 11:38:09,640 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      2003-09-15 11:38:09,656 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      2003-09-15 11:38:09,656 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:324)
      2003-09-15 11:38:09,656 ERROR [STDERR] at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:683)
      2003-09-15 11:38:09,656 ERROR [STDERR] at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)
      2003-09-15 11:38:09,656 ERROR [STDERR] at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:72)
      2003-09-15 11:38:09,656 ERROR [STDERR] at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84)
      2003-09-15 11:38:09,656 ERROR [STDERR] at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:267)
      2003-09-15 11:38:09,656 ERROR [STDERR] at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:128)
      2003-09-15 11:38:09,656 ERROR [STDERR] at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:118)
      2003-09-15 11:38:09,656 ERROR [STDERR] at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
      2003-09-15 11:38:09,656 ERROR [STDERR] at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
      2003-09-15 11:38:09,656 ERROR [STDERR] at org.jboss.ejb.StatelessSessionContainer.internalInvoke(StatelessSessionContainer.java:331)
      2003-09-15 11:38:09,656 ERROR [STDERR] at org.jboss.ejb.Container.invoke(Container.java:700)
      2003-09-15 11:38:09,656 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2003-09-15 11:38:09,656 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      2003-09-15 11:38:09,656 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      2003-09-15 11:38:09,656 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:324)
      2003-09-15 11:38:09,656 ERROR [STDERR] at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      2003-09-15 11:38:09,671 ERROR [STDERR] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
      2003-09-15 11:38:09,671 ERROR [STDERR] at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:362)
      2003-09-15 11:38:09,671 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2003-09-15 11:38:09,671 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      2003-09-15 11:38:09,671 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      2003-09-15 11:38:09,671 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:324)
      2003-09-15 11:38:09,671 ERROR [STDERR] at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
      2003-09-15 11:38:09,671 ERROR [STDERR] at sun.rmi.transport.Transport$1.run(Transport.java:148)
      2003-09-15 11:38:09,671 ERROR [STDERR] at java.security.AccessController.doPrivileged(Native Method)
      2003-09-15 11:38:09,671 ERROR [STDERR] at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
      2003-09-15 11:38:09,671 ERROR [STDERR] at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
      2003-09-15 11:38:09,671 ERROR [STDERR] at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
      2003-09-15 11:38:09,671 ERROR [STDERR] at java.lang.Thread.run(Thread.java:536)

      My server.log file is enclosed.