2 Replies Latest reply on Feb 27, 2007 8:47 AM by mandarjboss

    ClassCastException while getting reference to ConnectionFact

    saraks

      Hi,

      Have deployed an Adapter for Siebel. Find below the src for ra.xml & siebel-service.xml

      ra.xml:
      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE connector PUBLIC '-//Sun Microsystems, Inc.//DTD Connector 1.0//EN' 'http://java.sun.com/dtd/connector_1_0.dtd'>

      <display-name>SYMPHONY_SIEBEL_ADAPTER</display-name>
      Siebel Resource Adapter
      <vendor-name>Symphony Software Inc.</vendor-name>
      <spec-version>1.0</spec-version>
      <eis-type>Siebel</eis-type>
      1.0

      <managedconnectionfactory-class>com.symphony.adapter.siebel63.spi.ManagedConnectionFactoryImpl</managedconnectionfactory-class>
      <connectionfactory-interface>javax.resource.cci.ConnectionFactory</connectionfactory-interface>
      <connectionfactory-impl-class>com.symphony.adapter.siebel63.cci.ConnectionFactoryImpl</connectionfactory-impl-class>
      <connection-interface>javax.resource.cci.Connection</connection-interface>
      <connection-impl-class>com.symphony.adapter.siebel63.cci.ConnectionImpl</connection-impl-class>
      <transaction-support>NoTransaction</transaction-support>
      <config-property>
      <config-property-name>UserName</config-property-name>
      <config-property-type>java.lang.String</config-property-type>
      <config-property-value>SADMIN</config-property-value>
      </config-property>
      <config-property>
      <config-property-name>Password</config-property-name>
      <config-property-type>java.lang.String</config-property-type>
      <config-property-value>SADMIN</config-property-value>
      </config-property>
      <config-property>
      <config-property-name>ConnectionURL</config-property-name>
      <config-property-type>java.lang.String</config-property-type>
      <config-property-value>inblrsbpm02,siebel,SCCObjMgr,SiebelServer</config-property-value>
      </config-property>
      <authentication-mechanism>
      <authentication-mechanism-type>BasicPassword</authentication-mechanism-type>
      <credential-interface>javax.resource.security.PasswordCredential</credential-interface>
      </authentication-mechanism>
      <reauthentication-support>false</reauthentication-support>



      siebel-service.xml:
      <!-- The non-transaction FileSystem resource adaptor service configuration
      -->


      jboss.jca:service=RARDeployer
      <depends optional-attribute-name="ManagedConnectionFactoryName">

      <depends optional-attribute-name="OldRarDeployment">
      jboss.jca:service=RARDeployment,name=SYMPHONY_SIEBEL_ADAPTER



      <config-property>
      Connection URL
      <config-property-name>ConnectionURL</config-property-name>
      <config-property-type>java.lang.String</config-property-type>
      <config-property-value>inblrsbpm02,siebel,SCCObjMgr,SiebelServer</config-property-value>
      </config-property>
      <config-property>
      UserName
      <config-property-name>UserName</config-property-name>
      <config-property-type>java.lang.String</config-property-type>
      <config-property-value>SADMIN</config-property-value>
      </config-property>
      <config-property>
      Password
      <config-property-name>Password</config-property-name>
      <config-property-type>java.lang.String</config-property-type>
      <config-property-value>SADMIN</config-property-value>
      </config-property>


      SymphonySiebelAdapter


      <depends optional-attribute-name="ManagedConnectionPool">

      0
      50
      5000
      10
      ByContainer


      <depends optional-attribute-name="CachedConnectionManager">
      jboss.jca:service=CachedConnectionManager

      <depends optional-attribute-name="JaasSecurityManagerService">
      jboss.security:service=JaasSecurityManager




      The adapter is deployed successfully. But when I am trying to get reference to the connectionfactory through JSP i am getting ClassCastException.

      JSP:

      <%
      InitialContext initCtx = null;
      Connection obj = null;
      try
      {
      initCtx = new InitialContext();
      System.out.println("Got Context");

      ConnectionFactory Cf =

      (ConnectionFactory)initCtx.lookup("java://SymphonySiebelAdapter");
      System.out.println("Got ConnectinFactory");


      } catch(Exception e) {
      System.out.println("Error with context: " + e);
      e.printStackTrace() ;
      }

      %>

      I am getting the following exception:

      14:22:17,618 INFO [STDOUT] Got Context
      14:22:17,618 INFO [STDOUT] Error with context: java.lang.ClassCastException: or
      g.jnp.interfaces.NamingContext
      14:22:17,618 ERROR [STDERR] java.lang.ClassCastException: org.jnp.interfaces.Nam
      ingContext
      14:22:17,618 ERROR [STDERR] at org.apache.jsp.TestSiebel$jsp._jspService(Tes
      tSiebel$jsp.java:77)
      14:22:17,618 ERROR [STDERR] at org.apache.jasper.runtime.HttpJspBase.service
      (HttpJspBase.java:107)
      14:22:17,628 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpSe
      rvlet.java:853)
      14:22:17,628 ERROR [STDERR] at org.apache.jasper.servlet.JspServlet$JspServl
      etWrapper.service(JspServlet.java:201)
      14:22:17,628 ERROR [STDERR] at org.apache.jasper.servlet.JspServlet.serviceJ
      spFile(JspServlet.java:381)
      14:22:17,628 ERROR [STDERR] at org.apache.jasper.servlet.JspServlet.service(
      JspServlet.java:473)
      14:22:17,628 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpSe
      rvlet.java:853)
      14:22:17,628 ERROR [STDERR] at org.mortbay.jetty.servlet.ServletHolder.handl
      e(ServletHolder.java:366)
      14:22:17,628 ERROR [STDERR] at org.mortbay.jetty.servlet.WebApplicationHandl
      er.dispatch(WebApplicationHandler.java:293)
      14:22:17,628 ERROR [STDERR] at org.mortbay.jetty.servlet.ServletHandler.hand
      le(ServletHandler.java:581)
      14:22:17,628 ERROR [STDERR] at org.mortbay.http.HttpContext.handle(HttpConte
      xt.java:1687)
      14:22:17,638 ERROR [STDERR] at org.mortbay.jetty.servlet.WebApplicationConte
      xt.handle(WebApplicationContext.java:544)
      14:22:17,638 ERROR [STDERR] at org.mortbay.http.HttpContext.handle(HttpConte
      xt.java:1637)
      14:22:17,638 ERROR [STDERR] at org.mortbay.http.HttpServer.service(HttpServe
      r.java:875)
      14:22:17,638 ERROR [STDERR] at org.jboss.jetty.Jetty.service(Jetty.java:543)

      14:22:17,638 ERROR [STDERR] at org.mortbay.http.HttpConnection.service(HttpC
      onnection.java:806)
      14:22:17,638 ERROR [STDERR] at org.mortbay.http.HttpConnection.handleNext(Ht
      tpConnection.java:956)
      14:22:17,638 ERROR [STDERR] at org.mortbay.http.HttpConnection.handle(HttpCo
      nnection.java:823)
      14:22:17,638 ERROR [STDERR] at org.mortbay.http.SocketListener.handleConnect
      ion(SocketListener.java:203)
      14:22:17,638 ERROR [STDERR] at org.mortbay.util.ThreadedServer.handle(Thread
      edServer.java:290)
      14:22:17,638 ERROR [STDERR] at org.mortbay.util.ThreadPool$JobRunner.run(Thr
      eadPool.java:743)
      14:22:17,638 ERROR [STDERR] at java.lang.Thread.run(Thread.java:484)


      Pls help me out on this problem..

      Thanks in advance



        • 1. Re: ClassCastException while getting reference to Connection
          saraks

          Hi,

          Found the error. the error occured cause of the way I've been refering Jndi in JSP

          it should be

          ConnectionFactory Cf = (ConnectionFactory)initCtx.lookup("java:/SymphonySiebelAdapter");

          instead of

          ConnectionFactory Cf = (ConnectionFactory)initCtx.lookup("java://SymphonySiebelAdapter");

          Take a note of namespace reference in the JNDIName..



          • 2. Re: ClassCastException while getting reference to Connection
            mandarjboss

            Hi

            I am writing a custom Siebel Resource Adapter using JCA.I am facing a couple of difficulties.
            1) I can not see my connection being returned back to the pool once the client invokes a close method on the connection object.
            2) I can not see any evidence of "close" method of "ManagedConnection" upon server shutdown.Due to which I get a "Socket" exception after executing the application for sufficient requests.

            I am in Pune and if you dont mind I would like to have a conversation with you regarding the same issues.If you give me your contact number then I can call you up. Please help me. I need your help.