Problem looking up datasorce using JNDI

Hi, I'm trying to access the oracle 8i database using datasource JNDI.My problem is connection was successful.but fetching operation failed..not able to get the values from the database.
Pls find below the method used in bean and error returned.
public Connection getConnection()
                    InitialContext ctx = null;
                    String dsname = "jdbc/gpadb";
                    try
                    Hashtable parms = new Hashtable();
          parms.put("java.naming.factory.initial", "com.sun.jndi.cosnaming.CNCtxFactory");
                    ctx = new InitialContext(parms);
                    datasource = (DataSource)ctx.lookup(dsname);
                    objConnection = datasource.getConnection();
                    com.netscape.server.jdbc.DataSourceImpl dsi = (com.netscape.server.jdbc.DataSourceImpl)datasource;
          if(objConnection != null)
          System.out.println("*********Connection Successful*********"+objConnection);
               System.out.println("dsi.getUserName(): >" + dsi.getUserName() + "<");
               System.out.println("dsi.getPassWord(): >" + dsi.getPassWord() + "<");
               System.out.println("dsi.getDataBase(): >" + dsi.getDataBase() + "<");
               System.out.println("dsi.getDataSource(): >" + dsi.getDataSource() + "<");
               System.out.println("dsi.getDriverType(): >" + dsi.getDriverType() + "<");
               return objConnection;
               else
          System.out.println("*********Connection not Successful*********");
               return objConnection;
     catch(SQLException e) {
     e.printStackTrace(System.out);
     }catch(Exception e){
     e.printStackTrace(System.out);
return objConnection;
public java.util.Vector getAllCountries(int intLanguageid) {
          Vector                objVcountry=new Vector();
          Connection               objConn =null;
          CallableStatement     objCstmt =null;
          ResultSet                objRs =null;
          try
          objConn = getConnection();
          if (objConn != null)
                    String query = "begin ? := Pkg_common.Fn_GetCountries(?,?,?,?); end;";
                    objCstmt = objConn.prepareCall(query);
                    objCstmt.registerOutParameter(1,OracleTypes.CURSOR);          //To register result set as out parameter
                    objCstmt.registerOutParameter(2,Types.INTEGER);                    //To register Error No as out parameter
                    objCstmt.registerOutParameter(3,Types.VARCHAR);                    //To register Error desc as out parameter
                    objCstmt.registerOutParameter(4,Types.INTEGER);                    //To register Record count as out parameter
                    objCstmt.setInt(5,intLanguageid);                                   //To pass the Language id as i/p parameter
                                                                                               // 1 - English , 2 - Arabic
                    objCstmt.execute();
               int intErrnum = objCstmt.getInt(2);                              //Fetch the Error no returned by the DB
               int intRowcount = objCstmt.getInt(4);                              //To know the no.of records returned by Db
               if (objVcountry != null)
                    objVcountry.removeAllElements();
                    objVcountry.addElement(objCstmt.getInt(2)+" ");                    //To return the error no
               objVcountry.addElement(objCstmt.getString(3));                    //To return error description
               if ((intErrnum == 0) && (intRowcount >0))
                    objRs = (ResultSet) objCstmt.getObject(1);
                         while (objRs.next())
                              objVcountry.addElement(objRs.getString("COUNTRY_ID"));
                              objVcountry.addElement(objRs.getString("COUNTRY_NAME"));
                              objVcountry.addElement(objRs.getString("COUNTRY_CHAR"));
                    } else {
                    System.out.println("Failed to fetch the Countries :" + objCstmt.getString(3));
                    return objVcountry;
          } else {
                    System.out.println("Failed to get database connection in the Online Track & Trace service");
                              objVcountry.addElement("-9999");
                    objVcountry.addElement(" Database connection Failed ");
                    return objVcountry;
          } catch (SQLException e){
                    System.out.println("Failed to fetch the Countries " );
                    if (objVcountry != null)
                         objVcountry.removeAllElements();
                    objVcountry.addElement("-9057");
     objVcountry.addElement(" Failed to fetch the Countries ");
          return objVcountry;
          } catch (Exception e){
                    System.out.println("Failed to fetch the status of Ministry Of Labour cards.");
                    if (objVcountry != null)
                         objVcountry.removeAllElements();
                    objVcountry.addElement("-9057");
     objVcountry.addElement(" Failed to fetch the Countries ");
          return objVcountry;
          } finally{
                    try{
                              if(objRs!=null)      objRs.close();
                              if(objCstmt!=null)     objCstmt.close();
                              if(objConn!=null)     objConn.close();
                         } catch(Exception e){
                              System.out.println("Got Exception while releasing the objects in getAllCountries() method");
                              e.printStackTrace();
          return objVcountry;
This was the error thrown when i run my application
Going *********
Executing getHomeObject()method in Wrapper class
Retrieving JNDI initial context
Looking up Online track trace bean home interface
Looking up: java:comp/env/ejb/onlinetracktrace
*********Connection Successful*********com.netscape.server.jdbc.Connection@7b4703
dsi.getUserName(): >mack<
dsi.getPassWord(): >mack<
dsi.getDataBase(): >gpa.world<
dsi.getDataSource(): >gpa<
dsi.getDriverType(): >ORACLE_OCI<
Failed to fetch the Countries
Error Occured in the OnlinetracktraceBean method getAllCountries()
Going *********
Going *********
Null text data??
[03/Jan/2002 17:11:36:4] info: --------------------------------------
[03/Jan/2002 17:11:36:4] info: jsp.APPS.gpatracktrace.TTMOIncoming: init
[03/Jan/2002 17:11:36:4] info: --------------------------------------
Going *********
[03/Jan/2002 17:12:32:4] error: EB-serialize_ex: instance gpa.onlinetracktrace.SBSLOnlinetracktraceBean@3f5555 threw an exception
during serialization, ex = java.io.NotSerializableException: com.netscape.server.jdbc.DataSourceImpl
[03/Jan/2002 17:12:32:4] error: Exception Stack Trace:
java.io.NotSerializableException: com.netscape.server.jdbc.DataSourceImpl
at java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java:845)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:342)
at java.io.ObjectOutputStream.outputClassFields(ObjectOutputStream.java:1567)
at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:453)
at java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java:911)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:342)
at java.io.ObjectOutputStream.outputClassFields(ObjectOutputStream.java:1567)
at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:453)
at java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java:911)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:342)
at com.kivasoft.eb.EBObjectBase.serializeImpl(Unknown Source)
at com.kivasoft.eb.EBObjectBase.releaseStatefulImpl(Unknown Source)
at com.kivasoft.eb.EBObjectBase.isTimeout(Unknown Source)

Hi, I'm trying to access the oracle 8i database using datasource JNDI.My problem is connection was successful.but fetching operation failed..not able to get the values from the database.
Pls find below the method used in bean and error returned.
public Connection getConnection()
                    InitialContext ctx = null;
                    String dsname = "jdbc/gpadb";
                    try
                    Hashtable parms = new Hashtable();
          parms.put("java.naming.factory.initial", "com.sun.jndi.cosnaming.CNCtxFactory");
                    ctx = new InitialContext(parms);
                    datasource = (DataSource)ctx.lookup(dsname);
                    objConnection = datasource.getConnection();
                    com.netscape.server.jdbc.DataSourceImpl dsi = (com.netscape.server.jdbc.DataSourceImpl)datasource;
          if(objConnection != null)
          System.out.println("*********Connection Successful*********"+objConnection);
               System.out.println("dsi.getUserName(): >" + dsi.getUserName() + "<");
               System.out.println("dsi.getPassWord(): >" + dsi.getPassWord() + "<");
               System.out.println("dsi.getDataBase(): >" + dsi.getDataBase() + "<");
               System.out.println("dsi.getDataSource(): >" + dsi.getDataSource() + "<");
               System.out.println("dsi.getDriverType(): >" + dsi.getDriverType() + "<");
               return objConnection;
               else
          System.out.println("*********Connection not Successful*********");
               return objConnection;
     catch(SQLException e) {
     e.printStackTrace(System.out);
     }catch(Exception e){
     e.printStackTrace(System.out);
return objConnection;
public java.util.Vector getAllCountries(int intLanguageid) {
          Vector                objVcountry=new Vector();
          Connection               objConn =null;
          CallableStatement     objCstmt =null;
          ResultSet                objRs =null;
          try
          objConn = getConnection();
          if (objConn != null)
                    String query = "begin ? := Pkg_common.Fn_GetCountries(?,?,?,?); end;";
                    objCstmt = objConn.prepareCall(query);
                    objCstmt.registerOutParameter(1,OracleTypes.CURSOR);          //To register result set as out parameter
                    objCstmt.registerOutParameter(2,Types.INTEGER);                    //To register Error No as out parameter
                    objCstmt.registerOutParameter(3,Types.VARCHAR);                    //To register Error desc as out parameter
                    objCstmt.registerOutParameter(4,Types.INTEGER);                    //To register Record count as out parameter
                    objCstmt.setInt(5,intLanguageid);                                   //To pass the Language id as i/p parameter
                                                                                               // 1 - English , 2 - Arabic
                    objCstmt.execute();
               int intErrnum = objCstmt.getInt(2);                              //Fetch the Error no returned by the DB
               int intRowcount = objCstmt.getInt(4);                              //To know the no.of records returned by Db
               if (objVcountry != null)
                    objVcountry.removeAllElements();
                    objVcountry.addElement(objCstmt.getInt(2)+" ");                    //To return the error no
               objVcountry.addElement(objCstmt.getString(3));                    //To return error description
               if ((intErrnum == 0) && (intRowcount >0))
                    objRs = (ResultSet) objCstmt.getObject(1);
                         while (objRs.next())
                              objVcountry.addElement(objRs.getString("COUNTRY_ID"));
                              objVcountry.addElement(objRs.getString("COUNTRY_NAME"));
                              objVcountry.addElement(objRs.getString("COUNTRY_CHAR"));
                    } else {
                    System.out.println("Failed to fetch the Countries :" + objCstmt.getString(3));
                    return objVcountry;
          } else {
                    System.out.println("Failed to get database connection in the Online Track & Trace service");
                              objVcountry.addElement("-9999");
                    objVcountry.addElement(" Database connection Failed ");
                    return objVcountry;
          } catch (SQLException e){
                    System.out.println("Failed to fetch the Countries " );
                    if (objVcountry != null)
                         objVcountry.removeAllElements();
                    objVcountry.addElement("-9057");
     objVcountry.addElement(" Failed to fetch the Countries ");
          return objVcountry;
          } catch (Exception e){
                    System.out.println("Failed to fetch the status of Ministry Of Labour cards.");
                    if (objVcountry != null)
                         objVcountry.removeAllElements();
                    objVcountry.addElement("-9057");
     objVcountry.addElement(" Failed to fetch the Countries ");
          return objVcountry;
          } finally{
                    try{
                              if(objRs!=null)      objRs.close();
                              if(objCstmt!=null)     objCstmt.close();
                              if(objConn!=null)     objConn.close();
                         } catch(Exception e){
                              System.out.println("Got Exception while releasing the objects in getAllCountries() method");
                              e.printStackTrace();
          return objVcountry;
This was the error thrown when i run my application
Going *********
Executing getHomeObject()method in Wrapper class
Retrieving JNDI initial context
Looking up Online track trace bean home interface
Looking up: java:comp/env/ejb/onlinetracktrace
*********Connection Successful*********com.netscape.server.jdbc.Connection@7b4703
dsi.getUserName(): >mack<
dsi.getPassWord(): >mack<
dsi.getDataBase(): >gpa.world<
dsi.getDataSource(): >gpa<
dsi.getDriverType(): >ORACLE_OCI<
Failed to fetch the Countries
Error Occured in the OnlinetracktraceBean method getAllCountries()
Going *********
Going *********
Null text data??
[03/Jan/2002 17:11:36:4] info: --------------------------------------
[03/Jan/2002 17:11:36:4] info: jsp.APPS.gpatracktrace.TTMOIncoming: init
[03/Jan/2002 17:11:36:4] info: --------------------------------------
Going *********
[03/Jan/2002 17:12:32:4] error: EB-serialize_ex: instance gpa.onlinetracktrace.SBSLOnlinetracktraceBean@3f5555 threw an exception
during serialization, ex = java.io.NotSerializableException: com.netscape.server.jdbc.DataSourceImpl
[03/Jan/2002 17:12:32:4] error: Exception Stack Trace:
java.io.NotSerializableException: com.netscape.server.jdbc.DataSourceImpl
at java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java:845)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:342)
at java.io.ObjectOutputStream.outputClassFields(ObjectOutputStream.java:1567)
at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:453)
at java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java:911)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:342)
at java.io.ObjectOutputStream.outputClassFields(ObjectOutputStream.java:1567)
at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:453)
at java.io.ObjectOutputStream.outputObject(ObjectOutputStream.java:911)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:342)
at com.kivasoft.eb.EBObjectBase.serializeImpl(Unknown Source)
at com.kivasoft.eb.EBObjectBase.releaseStatefulImpl(Unknown Source)
at com.kivasoft.eb.EBObjectBase.isTimeout(Unknown Source)

Similar Messages

  • Unexpected ClassCastException when looking up Home using JNDI

    J2EE Gurus,
    In the attached sample program, a EJB (named MyScheduler in package mytest) is
    used to install a java code dynamically in weblogic service (8.1sp1), as well
    as to invoke a test java code (MyTest.run()) in it using Java reflection. Another
    EJB (named MyEJB in package myejb) is deployed dynamically using Weblogic console
    with its client side packaged with dynamically deployed java code. When invoked
    through MyScheduler, MyTest.run() simply looks up the home of MyEJB using JNDI,
    and when it is cast to MyEJBHome, a ClassCastException is thrown.
    Can someone explain why this exception occurs? Does this mean that a (dynamically)
    deployed code (java or EJB) cannot call other (dynamically) deployed EJBs, even
    when it has the client side of EJB packaged with it?
    Any help will be deeply appreciated.
    Thanks,
    Abhay
    [testjava.jar]

    "Nick" <[email protected]> wrote in message news:40343200$[email protected]..
    Because returned instance implements javax.sql.DataSource.Ha ha.
    No kidding :-)No. One could have found it himself by printing out returned type class
    or just by going to google and typing XADataSource weblogic +ClassCastException...
    Why would you want to do it? weblogic takes care of all the XA
    connection pooling, resource enlistments etc.Yeah, true.
    I should know this - I just got a little confused ... :-)
    I have just come from doing all the XA stuff myself... and got used to having
    XADataSources around...Thanks to J2EE, there is no need for low level plumbing when transaction
    support is needed.
    Also, with JMS resources, you DO have to have the XAQueueConnection etc etc for
    XA - even in an appserver.Per my knowledge weblogic allows you creating XA-aware JMS resources.
    Regards,
    Slava Imeshev
    >
    Thanks.
    "Slava Imeshev" <[email protected]> wrote:
    "Nick" <[email protected]> wrote in message news:403121e2$[email protected]..
    I am getting a ClassCast exception when I lookup a "Global Transaction"enabled
    JDBC DataSource.
    XADataSource xads = (XADataSource) ctx.lookup("jdbc/MyDS");
    Why is this?Because returned instance implements javax.sql.DataSource.
    How do I configure an XADataSource in JNDI?Why would you want to do it? weblogic takes care of all the XA connection
    pooling, resource enlistments etc.
    Regards,
    Slava Imeshev

  • Problems looking up EJBs using MDBs in iAS 6.5

    Here is an interesting appserver behavior I have observed on 6.5.
    1. bring down appserver
    2. send 5 messages to the queue.
    3. start appserver. MDB gets created and initialized to process messages
    from the queue. Since my MDB needs to access other EJBs it will get
    NameNotFoundException. This happens before my EJBs are loaded. In
    onMessage() of my MDB I catch Exception and roll back transaction. Messages
    will remain in the queue. MDB is sleeping.
    4. Point my browser to access my application. AppServer now loads my EJBs.
    Now I send the 6th message to the queue.
    5. MDB receives the 6th message and is able to lookup other EJBs. Everything
    works fine and the message is eventually removed from the queue.
    6. Query the queue. It shows you there are 5 messages in the queue. MDB is
    still sleeping.

    You can only successfully lookup EJBs in the current iAS MDB implementation in
    the onMessage() callback - the lookups fail if you try to perform them in the
    setMessageDrivenBeanContext() or ejbCreate() methods - defect has been filed for
    this as it is a violation of the spec pertaining to MDBs.
    I've still got to file a defect for the Transactional issue I've been
    sidetracked working on other P1 issues and I don't have a customer whose gone
    this far with MDBs todate, I am assuming you are using Container Managed
    Transactions with your MDB.
    I've successfully sent messages to both a Queue and a Topic (using durable
    subscription) and had queued messsages delivered once iAS had been restarted.

  • How to use JNDI look up from a JSP

    Hello,
    I know I should not be doing this (writing the lookup code in a JSP) but have to do it for some reasons.
    I am using this code in my JSP:
    try
         Context ctx = new InitialContext();
         dataSource = (DataSource)ctx.lookup("jdbc/mybillingora");
         conn = dataSource.getConnection();
         statement = conn.createStatement();
    catch(Exception excep)
    Is this code enough for a JNDI look up?? When I use this code, I get an exception:
    "javax.naming.NameNotFound exception:jdbc/mybillingora"
    Do I need to do something else??
    Why do we use :
    Properties env = new Properties();
    env.put(Context.INITIAL_CONTEXT_FACTORY,
    "<some_context_factory>");
    env.put(Context.PROVIDER_URL, PROVIDER_URL);
    env.put(Context.SECURITY_PRINCIPAL, JNDI_USER);
    env.put(Context.SECURITY_CREDENTIALS, JNDI_PWD);
    InitialContext = new InitialDirContext(env);
    where JNDI_USER is the userid If ACL is configured at the JNDI server
    where JNDI_PWD is the password If ACL is configured at the JNDI server
    Context.INITIAL_CONTEXT_FACTORY is the initial Context factory and depends on ur JNDI service provider.
    PROVIDER_URL is the url of the JNDI server containing protocol/ip/port
    do i need to use this??
    would appreciate your help on this....
    Thanks

    I am working on a pretty similar problem and posted my problem minute ago.
    Include JNDI.jar from <Oracle_HOME>\jlib. (This is what I found in Oracle docs).
    I presume you are also trying to create the Datasource using Datasource interface via JNDI rather than using Driver Manager.
    Thanks
    Mei

  • Help how to look up ejb3 deployed in ear using jndi

    Hi,everyone:
    I'm trying to use jndi to look up ejb3 depoyed in ear-file. The structure of ear file is like: taas.ear\app.jar , the "app.jar" is where the ejbs are deployed.
    If i write code:
    jndiContext.lookup("ServiceProviderDaoImpl/local");There will be exception:
    javax.naming.NameNotFoundException: ServiceProviderDaoImpl not boundHowever, if i deploy the ejbs directly in a app.jar which is not in a ear-file, then same same code will work fine.
    I cannot figure out how to write the correct code to look up the ejbs.
    I use jboss 5.0.1GA.
    Could anyone help me? Thanks a lot.

    Usually the lookup name is:
    earname/ServiceProviderDao/local
    Replace "earname" with the name of your ear of course, without the '.ear' extension.
    Use the JBoss JMX console and then the jndiView service to see under what names your EJBs are bound (under "global namespace" I think the label was).

  • Using JNDI to access config file located outsite j2ee app

    Hi I'm wanting to store a config file for my J2ee app, somewhere on a tomcat server possibly inside the
    conf/ directory so that I can update this config file without having to redeploy the j2ee app every time a change is made.
    I've been told I can use JNDI to access this file, but I can't seem to find any examples or documentation on how I can do this.
    I'm new to JNDI and would appreciate any help, or suggestions.
    Thanks,
    Tim
    EDIT:
    So far I can access the file with this code:
    Hashtable env = new Hashtable();
              env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.fscontext.RefFSContextFactory");
              try {
                   Context ctx = new InitialContext(prop);
                   // look up context for name
                   //env.put(Context.PROVIDER_URL, "file:C:\\confluence\\confluence-2.5.1-std\\conf");
                   File f = (File)ctx.lookup("/confluence/confluence-2.5.1-std/conf/test.txt");My new problems are:
    1. The commented line env.put(Context.PROVIDER_URL, "file:C:\\confluence\\confluence-2.5.1-std\\conf"); it says in examples that this should set the dir to look in to the conf dir but if i change the lookup value to just test.txt it cannot find it.
    2. Can I somehow set the context to look into the conf directory of Tomcat without hard coding the path, as the path could change or be different on different machines??
    Edited by: Timothyja on Jan 15, 2008 7:00 PM

    Hi Kiran,
    Looking at the code you sent and the error, it looks like you should be casting the ds object to a javax.sql.DataSource object not a weblogic.jdbc.common.internal.RmiDataSource object.
    You may find some useful info at the following URL:
    http://edocs.bea.com/wls/docs81/jdbc/rmidriver.html#1026007

  • DBAdapter Using JNDI Configuration

    Hi,
    I have created a simple process with DBAdapter. (using a simple select from oracle 10g, calling one of the schema - not apps)
    When I ran this process on client it ran with no problem.
    When I ran it from the linux server it gave me a lot of exceptions, like:
    07/11/13 18:36:29 0 - ORABPEL-00000
    Exception not handled by the Collaxa Cube system
    Exception: java.lang.NullPointerException
    Handled As: com.collaxa.cube.CubeException
    ] -> [java.lang.NullPointerException: null]
    ORABPEL-00000
    Exception not handled by the Collaxa Cube system.
    07/11/13 18:36:29 1 - java.lang.NullPointerException
    <2007-11-13 18:36:29,575> <ERROR> <psnext_integration.collaxa.cube> <BaseCubeSessionBean::logError> Error while invoking bean "cube delivery": [com.collaxa.cube.CubeException: Exception not handled by the Collaxa Cube system.
    <DispatchHelper::handleMessage> failed to handle message
    ORABPEL-00000
    <2007-11-13 18:36:29,618> <ERROR> Failed to handle dispatch message ... exception ORABPEL-05002.
    I'm using soa suite 10.1.3.3 (Client and server).
    I had no problem with this on another server (with same installation - another customer)
    I think the process is looking for the JNDI definition and is not using the connection details from DB.wsdl in the process.
    I tried to define the JNDI connection (data-sources.xml, connectors, oc4j-ra) with no success (tried from EM and manualy also).
    Does anyone knows where in the server we define if we want to use JNDI or not.
    And if so, what are the correct steps to define it.
    Thanks
    Arik                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    The jist of it is:
    - define the jndi entry in $ORACLE_HOME/j2ee/<instance name>/application-deployments/default/DbAdapter/oc4j-ra.xml
    - the above entry refers to a data-source entry in $ORACLE_HOME/j2ee/<instance name>/config/data-sources.xml (default instance name is "home")
    As long as the above are set, it should work. Look at the example pre-seeded entry to avoid confusion with XA vs non-XA settings in the above entries.
    To just get the service working without having to worry about the above configuration, make sure that the jndi entry (i.e eis/DB/...) referred to in the adapter service wsdl does not appear in the above oc4j-ra.xml; then the adapter uses the connection info specified in the wsdl directly. To confirm that it is working the way you want it regardless of which of the above routes you take, enable DEBUG level logging for *.ws logger, and take a look at the log file $ORACLE_HOME/bpel/domains/<domain name>/logs/domain.log. (default domain name is "default")

  • Configure j2ee to support oracle9 database using jndi

    how to configure j2ee1.3.1 to support access to oracle9 data base using jndi
    i'm using a java bean to access an oracle9 data base,this snippet is written in the bean:
    public connexionBD() Throws SQLException{
    String dbName "java:com/env/jdbc/connexionBD";
    DataSource ds=(DataSource)InitialContext().lookup(dbName);
    Connection con =ds.getConnection("system","manager");
    when i try to access the .jsp page that uses this javabeans the SQLException is thrown
    I think it's a server configuration problem.
    Knowing that the classpath and .jar files are configured, Can you help me resolve this problem
    Thank you

    These sections from the J2EE 1.4 platform sepc should hopefully help you understand java:comp/env.
    J2EE.5.2.1.1 Access to Application Component s Environment An application component instance locates the environment naming context using the JNDI interfaces. An instance creates a javax.naming.InitialContext object by using the constructor with no arguments, and looks up the naming environment via the InitialContext under the name java:comp/env. The application component s environment entries are stored directly in the environment naming context, or in its direct or indirect subcontexts. Java Naming and Directory Interface" (JNDI) Naming Context 61 Environment entries have the Java programming language type declared by the Application Component Provider in the deployment descriptor. The following code example illustrates how an application component accesses its environment entries. public void setTaxInfo(int numberOfExemptions,...) throws InvalidNumberOfExemptionsException { ... // Obtain the application component s // environment naming context. Context initCtx = new InitialContext(); Context myEnv = (Context)initCtx.lookup( java:comp/env ); // Obtain the maximum number of tax exemptions // configured by the Deployer. Integer max = (Integer)myEnv.lookup( maxExemptions ); // Obtain the minimum number of tax exemptions // configured by the Deployer. Integer min = (Integer)myEnv.lookup( minExemptions ); // Use the environment entries to // customize business logic. if (numberOfExemptions > max.intValue() || numberOfExemptions < min.intValue()) throw new InvalidNumberOfExemptionsException(); // Get some more environment entries. These environment // entries are stored in subcontexts. String val1 = (String)myEnv.lookup( foo/name1 ); Boolean val2 = (Boolean)myEnv.lookup( foo/bar/name2 ); // The application component can also // lookup using full pathnames. Integer val3 = (Integer)initCtx.lookup( java:comp/env/name3 ); Integer val4 = (Integer)initCtx.lookup( java:comp/env/foo/name4 ); ... }
    J2EE.5.2.4 J2EE Product Provider s Responsibilities The J2EE Product Provider has the following responsibilities: NAMING 64 " Provide a deployment tool that allows the Deployer to set and modify the values of the application component s environment entries. " Implement the java:comp/env environment naming context, and provide it to the application component instances at runtime. The naming context must include all the environment entries declared by the Application Component Provider, with their values supplied in the deployment descriptor or set by the Deployer. The environment naming context must allow the Deployer to create subcontexts if they are needed by an application component.

  • Connecting through Data Source using JNDI

    I would like to connect my application to sql server database through data
    source using JNDI. But when i try to bind the data source object with the
    logical name, i am getting following exception. How can i ger rid of this
    error ? How can i provide the initial context ? I thought Java would create the default initial context by itself. But it doesn't seem to be true. Any type of help would be appreciated.
    -Prashant
    Exception :
    Naming Exception :Need to specify class name in environment or system
    property, or as an applet parameter, or in an application resource file:
    java.naming.factory.initial
    javax.naming.NoInitialContextException: Need to specify class name in
    environment or system property, or as an applet parameter, or in an
    application resource file: java.naming.factory.initial
    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:651)
    at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:246)
    at
    javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:283)
    at javax.naming.InitialContext.bind(InitialContext.java:358)
    at RegDataSource.regDataSource(RegDataSource.java:30)
    at RegDataSource.main(RegDataSource.java:52)
    Source code :
    public class RegDataSource
    public RegDataSource()
    private void regDataSource()
    try
    com.microsoft.jdbcx.sqlserver.SQLServerDataSource sds =
    new
    com.microsoft.jdbcx.sqlserver.SQLServerDataSource();
    sds.setServerName("servername13");
    sds.setDatabaseName("test");
    Context ctx = new InitialContext();
    ctx.bind("jdbc/EmployeeDB", sds);
    catch(NamingException e)
    System.out.println("Naming Exception :" + e.getMessage()
    //+ "\n" + e.getExplanation()
    //+ "\n" + e.getResolvedObj()
    //+ "\n" + e.getResolvedName()
    e.printStackTrace();
    catch(Exception e)
    System.out.println("Exception :" + e.getMessage());
    public static void main(String[] args)
    RegDataSource regDataSource1 = new RegDataSource();
    regDataSource1.regDataSource();

    Thanks you very very much for your prompt reply and helping me out. I have following questions.
    1) Now i am able to bind data source object to the logical name. But the problem is that whenever i try to look up the data source object by providing logical name (i.e. DataSource ds = (DataSource)ctx.lookup("jdbc/EmployeeDB") ), it returns always null. I don't know why it doesn't return the correct data source object ?
    Following is the code used to bind datasource with the logical name
    Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY,
    "com.sun.jndi.fscontext.RefFSContextFactory");
    env.put(Context.PROVIDER_URL, "file:/TEMP/jndi");
    Context ctx = new InitialContext(env);
    //Properties p = new Properties();
    //p.put(Context.INITIAL_CONTEXT_FACTORY,
    // "com.sun.jndi.fscontext.RefFSContextFactory");
    //Context ctx = new InitialContext(p);
    ctx.bind("jdbc/EmployeeDB", sds);
    Following is the code used to look up for the bound object
    Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY,
    "com.sun.jndi.fscontext.RefFSContextFactory");
    env.put(Context.PROVIDER_URL, "file:/TEMP/jndi");
    Context ctx = new InitialContext(env);
    DataSource ds = (DataSource)ctx.lookup("jdbc/EmployeeDB");
    2) I am writing client server application in which my client is going to access the SQL Server 2000 to read/write database related data. The reason behind using the JNDI is that i don't want my client application to kwon which driver (sql) and database i am using. It is going to provide the great flexibility whenever i can make my application to use other database like Oracel, sybase, etc. without changing any code most probably. In this situation, which JNDI service provider to use ? I am not sure about "File System" service provider be the ideal choice for this type of situation. so please let me know which JNDI service provider is the ideal for this situation.
    Any type of help would be appreacited.

  • How to use JNDI lookup

    Hi ,
    I am creating a POC for my project.Its using ATG and spring frameworks using RAD 6.first I have created ATG sample project in that same EAR file i created sample Spring project.Both are running in the same EAR.
    I want to use spring classes from ATG components to use those methods.that is i should pass parameters to spring project methods and i should get the return value after executing those methods.
    I heard that using JNDI look up I can get spring project class objects using that I can invoke spring project methods.
    My requirement is two projects will be running in the same EAR.But one project will not be having information about other projects.both are independent from other.Using JNDI look up i need to invoke Spring project methods.
    Please anyone help me how to do this.
    I used java:comp/env/com/dao/EmpDAO to get instance of my class EmpDAO.But i am getting naming exception.Can anyone help me how to do this
    Thanks in advance.

    If Tomcat is your servlet/JSP engine, they have a nice bit about how to do it:
    http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-howto.html
    MOD

  • We bought an iphone 4s for our daughter. We transfered it to straight talk. She can make calls and text no problem. She can use the WiFi but is unable to use the internet or mms. How do we update the APN?

    We bought an iphone 4s for our daughter. We transfered it to straight talk. She can make calls and text no problem. She can use the WiFi but is unable to use the internet or mms. How do we update the APN?

    To clarify for anyone who is still having any problems doing this.
    1. Unlock your phone with the carrier ( I know the process will work if it is jail broken but I am assuming you dont want to void the warranty on your phone) NOTE: even if you purchased the phone outright at Wal-Mart it is still locked to ATT so you will have to unlock the phone.  If it's already unlocked skip to step 2.  This works and will work even if you update the phone. 
    1a Here is the link to unlock a ATT iphone. Simply follow the instructions https://www.att.com/deviceunlock/client/en_US/
    2. Get a T- mobile SIM. Even if you don't want the service, if you feign interest, they will send you one for free or 99cents. If you need it now you can get one at a T-mobile store too.
    3. Once you have both your Straight talk SIM and your T-mobile SIM follow these instructions:http://www.youtube.com/watch?v=mFFf5uqk18M
    4. If you have any remaining questions look at all the responses posted previously on this thread or check out the Howard Forums Wiki: http://wiki.howardforums.com/index.php/Straight_Talk_iPhone
    Everything should work flawlessly at this point.  If not let me know and I'm happy to help when I can.  I hope this makes doing this very easy for everyone in the future. God Bless -J

  • PI 7.11 JMS adapter using JNDI weblogic server issue

    Hi SAP experts,
    I have a scenario to integrate to a application using JMS adapters. we use SAP PI 7.11 version.
    We have deployed JMS drivers successfully and We face issue here to connect to weblogic server
    We are using JMS adapter using JNDI to connect to weblogic server version 10.3.
    Can anyone help with the exact format to be used in JMS properties table and additional parameters table in JMS communication channel. Your quick help will be appreciated.
    A channel error occurred. The detailed error (if any) : com.sap.aii.adapter.jms.api.connector.ConnectorException: Error looking up destination: AccrualDetailsQueue for profile:  ConnectionProfile of channel: CC_SND_JMS on node: 3010950 having object id: 673696a9fe8c39fdab32213f0930afb3: javax.naming.NameNotFoundException: Unable to resolve 'AccrualDetailsQueue'. Resolved ''<br> at com.sap.aii.adapter.jms.core.connector.JndiConnectorImpl.createDestination(JndiConnectorImpl.java:168)<br

    Hi Padmini,
    Refer to the following link:
    http://help.sap.com/saphelp_nw04/helpdata/en/24/4cad3baabd4737bab64d0201bc0c6c/content.htm
    It was very helpful to me, for configuring the additional parameters in the communication Channel JMS.
    I leave you some screenshots of the settings that I did.
    I seize the opportunity to ask you, where do I can get the drivers (.Jar) for Weblogic?
    Regards.
    Rodrigo.

  • When attempting to use Lightroom external editor program to edit a photo in Photoshop Elements 10, the photo does not open / appear on photoshop elements screen.  I don't have any problem with this when using Photoshop Elements 6 or Photoshop CS.  I'm usi

    When attempting to use Lightroom external editor program to edit a photo in Photoshop Elements 10, the photo does not open / appear on photoshop elements screen.  I don't have any problem with this when using Photoshop Elements 6 or Photoshop CS.  I'm using a Mac with Mountain Lion OS.  Any solutions?

    Adobe now hides the editor - what looks like it is not - you want the editor hidden in the support folder - see http://forums.adobe.com/message/3955558#3955558 for details
    LN

  • Problem in invoking LiveCycle using EJB

    Hi All,
    I am trying to invoke LC using EJB protocol. I referred the code example from the link http://help.adobe.com/en_US/livecycle/9.0/programLC/help/index.htm?content=001001.html#154 8359
    But I am facing the problem in the same code. Here is the stack trace for the same:
    Error Occurred: Exception thrown is NOT a
    DSCException : UnExpected From DSC
    com.adobe.idp.um.api.UMException  
    | [com.adobe.livecycle.usermanager.client.AuthenticationManagerServiceClient] errorCode:16385 errorCodeHEX:0x4001 message:Exception thrown is NOT a DSCException : UnExpected From DSC chainedException:java.lang.IllegalStateExceptionchainedExceptionMessage:null chainedException trace:java.lang.IllegalStateException
    at com.adobe.idp.dsc.clientsdk.ServiceClientFactory$1.handleThrowable( 
    ServiceClientFactory.java:69)at com.adobe.idp.dsc.clientsdk.ServiceClient.invoke( 
    ServiceClient.java:220)at com.adobe.livecycle.usermanager.client.AuthenticationManagerServiceClient.authenticate( 
    AuthenticationManagerServiceClient.java:109)at in.gov.ebiz.eforms.invocation.AuthenticateUsersTest.main( 
    AuthenticateUsersTest.java:47)Caused by: java.lang.NoClassDefFoundError:  
    javax/ejb/EJBException
    at com.adobe.idp.dsc.clientsdk.ServiceClientFactory.evaluateMessageDispatcher( 
    ServiceClientFactory.java:587)at com.adobe.idp.dsc.clientsdk.ServiceClient.invoke( 
    ServiceClient.java:215)... 2 more
    Caused by:  
    java.lang.ClassNotFoundException: javax.ejb.EJBException
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged( 
    Native Method)at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    ... 4 more
    at com.adobe.livecycle.usermanager.client.ManagerServiceClient.throwNonUMExceptionAsUMExcept ion( 
    ManagerServiceClient.java:53)at com.adobe.livecycle.usermanager.client.ManagerServiceClient.handleException( 
    ManagerServiceClient.java:95)at com.adobe.livecycle.usermanager.client.AuthenticationManagerServiceClient.authenticate( 
    AuthenticationManagerServiceClient.java:113)at in.gov.ebiz.eforms.invocation.AuthenticateUsersTest.main( 
    AuthenticateUsersTest.java:47)
    Please advice me. Am I missing some jar? or Do I need to configure some settings at the server end?
    Regards,
    Ambika

    The .xml and code looks ok. Using java:comp/env is the right approach. How does getInitialContext() instantiate the InitialContext()? Make sure it's using the no-arg "new InitialContext" Also try running the $APS_HOME/bin/verifier on your .ear. Please also post the full stack trace. Thanks.
    --ken                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • What Datatype Should I Use to Change the "lockoutTime" attribute using JNDI

    I am able to use JNDI to modify an object's String valued attributes in ADAM.
    However, now I want to modify lockoutTime which has a datatype of LargeInteger/interval
    According to the documentation for AD, I can set the lockoutTime as:
    new BasicAttribute("lockoutTime", Integer.toString(0)));But with ADAM this throws the exception:
    [LDAP: error code 53 - 00000057: LdapErr: DSID-0C090A4C, comment: Error in attribute conversion operation, data 0, vece_What datatype do you suggest I use, to set lockoutTime to 0 using java/JNDI?
    What datatype does LargeInteger/interval map to in java?

    As both are equivalent to "0" it is impossible to believe that that solved your problem.

Maybe you are looking for

  • Save Dialog Box not Opening

     I have  SQL 2012 running on a Windows server 2012.   I just loaded the Visual Studio Business Intelligence Studo 2012 that I downloaded from Microsoft.  My problem is that when I click "Save Copy of package.dtsx As..." , instead of getting the "Save

  • Please I had a Problem in my IMAC and if someone can help me

    Interval Since Last Panic Report:  2028273 sec Panics Since Last Report:          14 Anonymous UUID:                    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX Sat Jan 26 16:12:32 2013 panic(cpu 1 caller 0xffffff80100b7bd5): Kernel trap at 0xffffff7f915c072

  • Merging/Combining email PDF Portfolios

    I am creating a few PDF portfolios with Acrobat Pro 9 and Outlook 2003 to archive my email. I have a few files because it seems like there's a limit on the number of email it will convert at one time(other thread). I have two separate PDF portfolios

  • Syntax error in program ZDOECL_000_00B_STRWRPR when load USERDETAILS MI 7.1

    Hi experts, I have a problem, i install MI 7.1 with SP09. I configure all, i have all Distribution Model and Data Objects in green, but, when i do a initial download or delta download for USERDETAILS, appear an error in the queue: In the include "ZDO

  • I am blocked from Twitter and YouTube and cannot find problem.

    The NY Times may be blocking me from any access to Twitter.com and YouTube.com. NYTimes has a lawsuit vs. Twitter.com/#1/freeunnamednews. (NY Times knows my IP address since 2001. I have free access to NYTimes.com thru December 31, 2011.) A few NYTim