Datasource & JNDI lookup...

Another JDBC question.
To lookup a JDBC datasource in my Websphere appserver i use JNDI. In various doc�s I�ve found they say that I should use the same DataSource object to retrive the connections so I don�t have to make a lookup everytime i want a java.sql.Connection object. So my question is, do I have to make the get method of the datasource synchronized or is it "thread safe"?
Best regards
Nick

do u have an answe for this yet ?

Similar Messages

  • DataSource JNDI  Lookup gives NamingException

    Hi i am using Weblogic 11g
    I had created a Datasource in it from Services/JDBC/DataSources and assigned it a name myAppDbPool
    But from my servlet when i am looking for it It is displaying as
    While trying to look up comp/env/myAppDbPool in /app/webapp/TestingDS/9028625.
    I had used differnt options like
    1. Putting the properties and passing it to the InitailContext.
    2. Used java:comp/env/myAppDbPool, java:comp/myAppDbPool.
    But all in waste ,so please let me know where i am doing wrong .
    This is inside my servlet :
    InitialContext ctx=new InitialContext();
    DataSource ds=(DataSource)ctx.lookup("java:comp/env/myAppDbPool");
    Please tell me if i am doing anything wrong here .
    Thanks n advance

    Ok. Take one step back. Make sure that your Datasource is infact targetted to Admin Server (and all managed servers in case of cluster). When we create a Datasource in weblogic console, we create connection pool with all db details and as we click and click at one point, it should show Target Tab with list of servers on this domain. So make sure that it is targetted to Admin Server. Infact just open config.xml file and check if your datasource is listed there. config.xml file is under your domain/config folder.
    Goud

  • JNDI lookup of DataSource fails

    I'm trying to create a DataSource as follows:
    Connection connection = null;
    String ACCOUNT_DATASOURCE = "weblogic.jdbc.AccountDB";
    try {
    Context ctx = new InitialContext(System.getProperties());
    DataSource ds = (DataSource)ctx.lookup(ACCOUNT_DATASOURCE);
    connection = ds.getConnection();
    catch (Exception e) {
    The client window reveals:
    javax.ejb.CreateException: java.lang.NullPointerException
    at weblogic.rmi.internal.BasicOutboundRequest.sendReceive(BasicOutboundR
    equest.java:85)
    at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteR
    ef.java:274)
    at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteR
    ef.java:243)
    at weblogic.rmi.internal.ProxyStub.invoke(ProxyStub.java:90)
    at $Proxy1.create(Unknown Source)
    at helloWorld.Client.main(Client.java:22)
    Destroying account..
    The server window reveals:
    javax.naming.NameNotFoundException: Unable to resolve weblogic.jdbc.AccountDB.
    R
    esolved: 'weblogic.jdbc' Unresolved:'AccountDB' ; remaining name ''
    <<no stack trace available>>
    Via the console GUI I created a connection pool, which frequently disappears -
    I do not understand at all why this pool seems so transient but it doesn't sound
    good, and a data source, which does seem to persist, whose JNDI name corresponds
    exactly to the name used for the lookup above. I've seen some usage of the form
    java:comp/env/jdbc/... is this simply an arbitrary and therefore optional prefix,
    or does it have some arcance meaning of which I am unaware?
    Finally, the weblogic-ejb-jar.xml file defines the BMP entity bean and its associated
    JNDI name for the database connection.
    I've also created the cloudscape database via a .ddl file and copied it across
    to the ~/wlserver6.1_beta/samples/eval/cloudscape/data directory (this might not
    be the correct place)
    Any ideas or suggestions most welcome - I've currently come to a grinding halt
    with this.

    Did you make sure the DataSource (and the underlying connection pool were
    actually "deployed" to a target server after you created them? That bit me
    for a while...
    If you open up the console and open up the "Servers" folder on the left and
    right click on your server (myserver) and select "View JNDI Tree", do you
    see your DataSource under the jdbc node?
    greg
    "David Franklin" <[email protected]> wrote in message
    news:[email protected]...
    >
    I'm trying to create a DataSource as follows:
    Connection connection = null;
    String ACCOUNT_DATASOURCE = "weblogic.jdbc.AccountDB";
    try {
    Context ctx = new InitialContext(System.getProperties());
    DataSource ds = (DataSource)ctx.lookup(ACCOUNT_DATASOURCE);
    connection = ds.getConnection();
    catch (Exception e) {
    The client window reveals:
    javax.ejb.CreateException: java.lang.NullPointerException
    atweblogic.rmi.internal.BasicOutboundRequest.sendReceive(BasicOutboundR
    equest.java:85)
    atweblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteR
    ef.java:274)
    atweblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteR
    ef.java:243)
    at weblogic.rmi.internal.ProxyStub.invoke(ProxyStub.java:90)
    at $Proxy1.create(Unknown Source)
    at helloWorld.Client.main(Client.java:22)
    Destroying account..
    The server window reveals:
    javax.naming.NameNotFoundException: Unable to resolveweblogic.jdbc.AccountDB.
    R
    esolved: 'weblogic.jdbc' Unresolved:'AccountDB' ; remaining name ''
    <<no stack trace available>>
    Via the console GUI I created a connection pool, which frequentlydisappears -
    I do not understand at all why this pool seems so transient but it doesn'tsound
    good, and a data source, which does seem to persist, whose JNDI namecorresponds
    exactly to the name used for the lookup above. I've seen some usage ofthe form
    java:comp/env/jdbc/... is this simply an arbitrary and therefore optionalprefix,
    or does it have some arcance meaning of which I am unaware?
    Finally, the weblogic-ejb-jar.xml file defines the BMP entity bean and itsassociated
    JNDI name for the database connection.
    I've also created the cloudscape database via a .ddl file and copied itacross
    to the ~/wlserver6.1_beta/samples/eval/cloudscape/data directory (thismight not
    be the correct place)
    Any ideas or suggestions most welcome - I've currently come to a grindinghalt
    with this.

  • JNDI lookup() for sql server jdbc datasource returns null

    Hi,
    I am trying to use a jdbc datasource in tomcat 5 to access a sql server 2000 database. I had many common problems and did found an answer to them in the forums but I'm having one last (I hope) problem. My program is also using a mySQL datasource and it works fine.
    The problem is that my lookup returns null. No exception, just null. It seems that many people had this problem but I didn't found any answer to it.
    This is the lookup code:
        Context ctx = new InitialContext();
        Context envCtx = (Context)ctx.lookup("java:comp/env");
        axaptaDS = (DataSource) envCtx.lookup("jdbc/axapta"); //returns null :(This my context.xml config:
    <ResourceParams name="jdbc/axapta">
        <parameter>
          <name>factory</name>
          <value>com.microsoft.jdbcx.sqlserver.SQLServerDataSourceFactory</value>
        </parameter>
        <parameter>
          <name>url</name>
          <value>jdbc:microsoft:sqlserver://hostname:1433</value>
        </parameter>
        <parameter>
          <name>password</name>
          <value>password</value>
        </parameter>
        <parameter>
          <name>maxActive</name>
          <value>4</value>
        </parameter>
        <parameter>
          <name>maxWait</name>
          <value>5000</value>
        </parameter>
        <parameter>
          <name>driverClassName</name>
          <value>com.microsoft.jdbcx.sqlserver.SQLServerDataSource</value>
        </parameter>
        <parameter>
          <name>username</name>
          <value>username</value>
        </parameter>
        <parameter>
          <name>maxIdle</name>
          <value>2</value>
        </parameter>
      </ResourceParams>And I also put these lines in my web.xml file:
    <resource-ref id="ResourceRef_1092254277306">
         <res-ref-name>jdbc/axapta</res-ref-name>
         <res-type>javax.sql.DataSource</res-type>
         <res-auth>Container</res-auth>
         <res-sharing-scope>Shareable</res-sharing-scope>
    </resource-ref>Thanks for helping!

    I finally found a remedy to this problem:
    specify this driver instead and remove the entry about the factory in the context's .xml file:
    com.microsoft.jdbc.sqlserver.SQLServerDriver

  • EJB 3.0 and jndi lookup (simple question)

    hi all,
    i am newbie on Weblogic Application Server and i have some issues,
    i have weblogic application server 10.0, also i have oracle timesten in-memory database, i have configured datasource and deploy my ejb 3.0 application, but i could not done jndi lookup?
    here is my example:
    1. one stateless session bean :
    import javax.ejb.Remote;
    @Remote
    public interface InsertSubscriber {
         public void insertSubscriber(SubscriberT subscriberT);
    } 2. here is it's implementation :
    @Remote(InsertSubscriber.class)
    @Stateless
    public class InsertSubscriberBean implements InsertSubscriber {
         @PersistenceContext(unitName = "TimesTenDS")
         private EntityManager oracleManager;
         public void insertSubscriber(SubscriberT subscriber)
              try {
                   System.out.println("started");
                   oracleManager.persist(subscriber);
                   System.out.println("end");
              } catch (Exception e) {
                   e.printStackTrace();
    }3 and my test client :
    public class Client {
         public static void main(String[] args) {
              Context ctx = null;
              Hashtable ht = new Hashtable();
              ht.put(Context.INITIAL_CONTEXT_FACTORY,
                        "weblogic.jndi.WLInitialContextFactory");
              ht.put(Context.PROVIDER_URL, "t3://192.9.200.222:7001");
              try {
                   ctx = new InitialContext(ht);
                   InsertSubscriber usagefasade = (InsertSubscriber) ctx
                             .lookup("ejb.InsertSubscriberBean");               
              } catch (NamingException e) {
                   e.printStackTrace();
              } finally {
                   try {
                        ctx.close();
                   } catch (Exception e) {
                        e.printStackTrace();
    }what i did incorrect ???
    i got error like this : Name not fount exception
    when i tried to view jndi tree on weblogic server application console i found this :
         Binding Name:     
    TimestenExampleTimestenExample_jarInsertSubscriberBean_InsertSubscriber     
         Class:     
    test.InsertSubscriberBean_o7jk9u_InsertSubscriberImpl_1000_WLStub     
         Hash Code:     
    286     
         toString Results:     
    weblogic.rmi.internal.CollocatedRemoteRef - hostID: '2929168367193491522S::billing_domain:AdminServer', oid: '286', channel: 'null'what does it mean how i can done lookup to jndi ?
    Regards,
    Paata Lominadze,
    Magticom LTD.
    Georgia.

    Hi All,
    I am using the weblogic cluster with session replication and EJB 2.0 with Local entity beans.
    for fail-over session should be replicated to another server so we can achive the same session if 1st server fails.
    Suppose i m using two managed server(server1,server2) in the cluster.I am storing the object of class ABC into session and object contains the instance of Local-EntityBean home but i put that as a transient.I have also override the readObject and write object method.
    when write object is called on 1st server,readObject method should be called on second server so we will be sure that session is replicating properly.
    pleaase find the code below : -
    public IssuerPageBean() {
    initEJB();
    private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException {
    stream.defaultReadObject();
    initEJB();
    initializeCommonObject();
    private void writeObject(java.io.ObjectOutputStream stream) throws IOException {
    stream.defaultWriteObject();
    private void initEJB() {
    try {
    ic = new InitialContext();
    issuerHome = (LocalIssuerHome) ic.lookup("java:comp/env/Issuer");
    } catch (NamingException e) {
    e.printStackTrace();
    in my case if i am calling the constructor IssuerPageBean(),it calls the initEJB() method and lookeup the entity local home properly but when readObject method is called on another server only initEJB() method is called directly and getting the exception below :
    WARNING: Error during create -
    javax.naming.NameNotFoundException: remaining name: env/ejb/Client
    at weblogic.j2eeclient.SimpleContext.resolve(Ljavax/naming/Name;Z)Ljavax/naming/Context;(SimpleContext.java:35)
    at weblogic.j2eeclient.SimpleContext.resolve(Ljavax/naming/Name;)Ljavax/naming/Context;(SimpleContext.java:39)
    at weblogic.j2eeclient.SimpleContext.lookup(Ljavax/naming/Name;)Ljava/lang/Object;(SimpleContext.java:57)
    at weblogic.j2eeclient.SimpleContext.lookup(Ljavax/naming/Name;)Ljava/lang/Object;(SimpleContext.java:57)
    at weblogic.j2eeclient.SimpleContext.lookup(Ljava/lang/String;)Ljava/lang/Object;(SimpleContext.java:62)
    at weblogic.jndi.factories.java.ReadOnlyContextWrapper.lookup(Ljava/lang/String;)Ljava/lang/Object;(ReadOnlyCont
    extWrapper.java:45)
    at weblogic.jndi.internal.AbstractURLContext.lookup(Ljava/lang/String;)Ljava/lang/Object;(AbstractURLContext.jav
    a:130)
    at javax.naming.InitialContext.lookup(Ljava/lang/String;)Ljava/lang/Object;(InitialContext.java:347)
    at com.lb.equities.veda.tools.salesvault.jsp.ClientPageBean.initEJB()V(ClientPageBean.java:218)
    at com.lb.equities.veda.tools.salesvault.jsp.ClientPageBean.readObject(Ljava/io/ObjectInputStream;)V(ClientPageB
    ean.java:191)
    at java.lang.LangAccessImpl.readObject(Ljava/lang/Class;Ljava/lang/Object;Ljava/io/ObjectInputStream;)V(Unknown
    Source)
    at java.io.ObjectStreamClass.invokeReadObject(Ljava/lang/Object;Ljava/io/ObjectInputStream;)V(Unknown Source)
    at java.io.ObjectInputStream.readSerialData(Ljava/lang/Object;Ljava/io/ObjectStreamClass;)V(Unknown Source)
    at java.io.ObjectInputStream.readOrdinaryObject(Z)Ljava/lang/Object;(Unknown Source)
    at java.io.ObjectInputStream.readObject0(Z)Ljava/lang/Object;(Unknown Source)
    at java.io.ObjectInputStream.readObject()Ljava/lang/Object;(Unknown Source)
    at java.util.HashMap.readObject(Ljava/io/ObjectInputStream;)V(Unknown Source)
    at java.lang.LangAccessImpl.readObject(Ljava/lang/Class;Ljava/lang/Object;Ljava/io/ObjectInputStream;)V(Unknown
    Source)
    at java.io.ObjectStreamClass.invokeReadObject(Ljava/lang/Object;Ljava/io/ObjectInputStream;)V(Unknown Source)
    at java.io.ObjectInputStream.readSerialData(Ljava/lang/Object;Ljava/io/ObjectStreamClass;)V(Unknown Source)
    at java.io.ObjectInputStream.readOrdinaryObject(Z)Ljava/lang/Object;(Unknown Source)
    at java.io.ObjectInputStream.readObject0(Z)Ljava/lang/Object;(Unknown Source)
    at java.io.ObjectInputStream.defaultReadFields(Ljava/lang/Object;Ljava/io/ObjectStreamClass;)V(Unknown Source)
    at java.io.ObjectInputStream.readSerialData(Ljava/lang/Object;Ljava/io/ObjectStreamClass;)V(Unknown Source)
    at java.io.ObjectInputStream.readOrdinaryObject(Z)Ljava/lang/Object;(Unknown Source)
    at java.io.ObjectInputStream.readObject0(Z)Ljava/lang/Object;(Unknown Source)
    at java.io.ObjectInputStream.readObject()Ljava/lang/Object;(Unknown Source)
    at weblogic.common.internal.ChunkedObjectInputStream.readObject()Ljava/lang/Object;(ChunkedObjectInputStream.jav
    a:120)
    at weblogic.rjvm.MsgAbbrevInputStream.readObject(Ljava/lang/Class;)Ljava/lang/Object;(MsgAbbrevInputStream.java:
    121)
    at weblogic.cluster.replication.ReplicationManager_WLSkel.invoke(ILweblogic/rmi/spi/InboundRequest;Lweblogic/rmi
    /spi/OutboundResponse;Ljava/lang/Object;)Lweblogic/rmi/spi/OutboundResponse;(Unknown Source)
    at weblogic.rmi.internal.BasicServerRef.invoke(Lweblogic/rmi/extensions/server/RuntimeMethodDescriptor;Lweblogic
    /rmi/spi/InboundRequest;Lweblogic/rmi/spi/OutboundResponse;)V(BasicServerRef.java:492)
    Please help .
    Thanks in Advance.
    Edited by hforever at 03/04/2008 7:28 AM

  • How to use JNDI lookup 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

    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

  • JNDI lookup issue in weblogic 10 server

    Hi all,
    I have a serious problem in getting the datasource lookup. My application uses EJB3 and JPA and it is deployed in weblogic10. I configured datasource in the domain (ex:mydomain) using weblogic 10 admin console. Now when i try to call from a client program, it is giving me javax.naming.NameNotFoundException. I use eclipse IDE to deploy the application. From the IDE, i can start the oracle 10.3 server and it automatically deploys the application into the server in mydomain. The admin console shows that the application deployed fine. And i can see the webcontent WAR file and EJB jar deployed. Coming back to the issue.... I verified user_projects\domains\mydomain\config\jdbc\datasource-jdbc.xml and user_projects\domains\mydomain\config\config.xml file enteries. My entries are present in those files.
    When i start the server i am getting below error...
    << Stacktrace >>
    javax.naming.NameNotFoundException: While trying to look up jdbc in /app.; remaining name 'jdbc'
         at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:1139)
         at weblogic.jndi.internal.ApplicationNamingNode.lookup(ApplicationNamingNode.java:144)
         at weblogic.jndi.internal.WLEventContextImpl.lookup(WLEventContextImpl.java:254)
         at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:380)
         at weblogic.deployment.PersistenceUnitInfoImpl.lookUpAppScopedDataSource(PersistenceUnitInfoImpl.java:529)
         at weblogic.deployment.PersistenceUnitInfoImpl.reconfig(PersistenceUnitInfoImpl.java:549)
         at weblogic.ejb.container.deployer.EJBModule.reconfigPersistenceUnits(EJBModule.java:529)
         at weblogic.ejb.container.deployer.EJBModule.activate(EJBModule.java:515)
         at weblogic.application.internal.flow.ModuleListenerInvoker.activate(ModuleListenerInvoker.java:107)
         at weblogic.application.internal.flow.DeploymentCallbackFlow$2.next(DeploymentCallbackFlow.java:411)
         at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)
         at weblogic.application.internal.flow.DeploymentCallbackFlow.activate(DeploymentCallbackFlow.java:74)
         at weblogic.application.internal.flow.DeploymentCallbackFlow.activate(DeploymentCallbackFlow.java:66)
         at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:635)
         at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)
         at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:212)
         at weblogic.application.internal.EarDeployment.activate(EarDeployment.java:16)
         at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:162)
         at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:79)
         at weblogic.deploy.internal.targetserver.operations.AbstractOperation.activate(AbstractOperation.java:569)
         at weblogic.deploy.internal.targetserver.operations.ActivateOperation.activateDeployment(ActivateOperation.java:140)
         at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doCommit(ActivateOperation.java:106)
         at weblogic.deploy.internal.targetserver.operations.AbstractOperation.commit(AbstractOperation.java:323)
         at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentCommit(DeploymentManager.java:820)
         at weblogic.deploy.internal.targetserver.DeploymentManager.activateDeploymentList(DeploymentManager.java:1227)
         at weblogic.deploy.internal.targetserver.DeploymentManager.handleCommit(DeploymentManager.java:436)
         at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.commit(DeploymentServiceDispatcher.java:163)
         at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doCommitCallback(DeploymentReceiverCallbackDeliverer.java:181)
         at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$100(DeploymentReceiverCallbackDeliverer.java:12)
         at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$2.run(DeploymentReceiverCallbackDeliverer.java:67)
         at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:516)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
    << Client program snippet >>
    Hashtable ht = new Hashtable();
                   ht.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
                   ht.put(Context.PROVIDER_URL, "t3://10.237.76.132:7001");
                   InitialContext ctx = null;
                   ctx = new InitialContext(ht);
                   Object obj = (Object)ctx.lookup(EmployeeBean.RemoteJNDIName);
                   EmployeeRemote empRemote = (EmployeeRemote)PortableRemoteObject.narrow(obj,com.acs.test.emp.EmployeeRemote.class);
                   List empList = empRemote.getEmployeeDetails(1);
                   System.out.println("SUCCESS"+empList.size());
    << Persistence.xml >>
    <?xml version="1.0" encoding="UTF-8"?>
    <!-- Persistence deployment descriptor for dev profile -->
    <persistence xmlns="http://java.sun.com/xml/ns/persistence"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
    version="1.0">
    <persistence-unit name="cmsepool">
    <jta-data-source>java:/mydatasource</jta-data-source>
              <class>com.acs.test.emp.EmployeeVO</class>
              <properties>
    <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
              <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.WeblogicTransactionManagerLookup"/>
    </properties>
    </persistence-unit>
    </persistence>

    Make sure that this Datasource you created is Targetted to Admin Server and full Cluster (incase of cluster domain). From Admin Console, select your datasource and check for the Targets tab. Since its JNDI lookup error, most probably it may not be deployed properly.
    HTH
    Ravi Jegga

  • JNDI Lookup in OC4J *AND* Tomcat 5 (not either/or)

    I've been struggling to get a web application to deploy and run correctly on Tomcat 5.x. I couldn't ADF to look up the Datasource I'd set up in the Tomcat configs. After reading this forum post:
    Problem deploying BC4J Toy Store app on Tomcat 4
    I was able to run my test app successfully on Tomcat by prepending 'java:comp/env/' to the JNDI name of my Datasource in bc4j.xcfg. Unfortunately, specifying the JNDI name in this way breaks the JNDI lookup in the embedded OC4J container. The impression I got from the above forum post was that OC4J should be able to look up the data source when the name is specified as either jndi/myDataSource or java:comp/env/jndi/myDataSource. I can only get it to work with the former.
    Is there a way to specify the JNDI name of a datasource in bc4j.xcfg such that both Tomcat AND the embedded OC4J container within JDeveloper will be able to look it up?
    Thanks,
    -Matt

    To answer my own question, a fairly straight-forward way of achieving this is to use two configurations for the application module: one for testing locally (the supplied configuration), and another one for deployment that is a copy of the first except for the JNDI name. I can switch between the configurations via the Databindings depending on whether I want to test locally or deploy to Tomcat.
    This is certainly a useable solution, but I'm bothered by the fact that I need to reference the JNDI name in two different ways. Shouldn't this be container-independent?
    -Matt

  • JNDI lookup for Crystal Reports at runtime

    How to run a rpt to fetch data from database connection defined in Tomcat's JNDI resources ? We are using JDBC(JNDI) Data source while designing the report in the Crystal Report designer and we want to use 'Connection Name' at runtime for jndi lookup to Tomcats JNDI resources.

    Hi,
    Thanks, this helped in resolving the JNDI lookup problem. But we are not having an issue in connecting to DS as it fails with error "Unsupported JNDI Object".
    Tried suggestions on this link: "http://www.theserverside.com/discussions/thread.tss?thread_id=37430", but no luck.
    Here are the configuration files:
    context.xml:
    <Context>
    <Resource name="jdbc/remedy" auth="Container" type="javax.sql.DataSource" driverClassName="oracle.jdbc.OracleDriver" url="jdbc:oracle:thin:@10.76.85.68:1521:dtv" maxActive="20" maxIdle="10" maxWait="-1" />
    </Context>
    web.xml:
    <resource-ref>
              <description>DB Connection</description>
              <res-ref-name>jdbc/remedy</res-ref-name>
              <res-type>javax.sql.DataSource</res-type>
              <res-auth>Container</res-auth>
    </resource-ref>
    Log:
    2009-10-30 06:38:05,804 DEBUG [com.crystaldecisions.reports.formatter.a.c] - Export Supervisor: number of destination exporters:1
    2009-10-30 06:38:05,804 DEBUG [com.crystaldecisions.reports.formatter.a.c] - Export Supervisor: number of format exporters:4
    2009-10-30 06:38:05,865 INFO [com.businessobjects.reports.sdk.JRCCommunicationAdapter] - JRCAgent1 received request: fetchReportPageRequest
    2009-10-30 06:38:05,865 INFO [com.businessobjects.reports.sdk.JRCCommunicationAdapter] - JRCAgent1 attempting to acquire license
    2009-10-30 06:38:05,865 INFO [com.businessobjects.reports.sdk.JRCCommunicationAdapter] - JRCAgent1 successfully acquired license
    2009-10-30 06:38:05,867 DEBUG [com.businessobjects.reports.sdk.JRCCommunicationAdapter] - Requesting page 1
    2009-10-30 06:38:05,879 INFO [com.crystaldecisions.reports.queryengine.driverImpl] - Logon: Connecting to database using local JNDI server ...
    2009-10-30 06:38:05,888 DEBUG [com.crystaldecisions.reports.reportdefinition.datainterface] - Failed to open connection (Connection:  databaseType=JDBC (JNDI)  serverName=jdbc:oracle:thin:@10.76.85.68:1521:dtv  state=closed  databaseDriverName=crdb_jdbc.dll).
    com.crystaldecisions.reports.queryengine.al: Unsupported JNDI Object (remedy)
         at com.crystaldecisions.reports.queryengine.driverImpl.o.if(Unknown Source)
         at com.crystaldecisions.reports.queryengine.av.new(Unknown Source)
         at com.crystaldecisions.reports.queryengine.av.byte(Unknown Source)
         at com.crystaldecisions.reports.reportdefinition.datainterface.b.a(Unknown Source)
         at com.crystaldecisions.reports.reportdefinition.datainterface.b.a(Unknown Source)
         at com.crystaldecisions.reports.reportdefinition.datainterface.b.a(Unknown Source)
         at com.crystaldecisions.reports.reportdefinition.datainterface.b.if(Unknown Source)
         at com.crystaldecisions.reports.reportdefinition.datainterface.j.a(Unknown Source)
         at com.businessobjects.reports.sdk.b.i.if(Unknown Source)
         at com.businessobjects.reports.sdk.b.i.a(Unknown Source)
         at com.businessobjects.reports.sdk.b.i.byte(Unknown Source)
         at com.businessobjects.reports.sdk.JRCCommunicationAdapter.request(Unknown Source)
         at com.crystaldecisions.proxy.remoteagent.y.a(Unknown Source)
         at com.crystaldecisions.proxy.remoteagent.r.a(Unknown Source)
         at com.crystaldecisions.sdk.occa.report.application.cf.a(Unknown Source)
         at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(Unknown Source)
         at com.crystaldecisions.sdk.occa.report.application.ReportSource.getPage(Unknown Source)
         at com.crystaldecisions.sdk.occa.report.application.AdvancedReportSource.getPage(Unknown Source)
         at com.crystaldecisions.sdk.occa.report.application.NonDCPAdvancedReportSource.getPage(Unknown Source)
         at com.crystaldecisions.report.web.event.ac.a(Unknown Source)
         at com.crystaldecisions.report.web.event.ac.a(Unknown Source)
         at com.crystaldecisions.report.web.event.b2.a(Unknown Source)
         at com.crystaldecisions.report.web.event.b7.broadcast(Unknown Source)
         at com.crystaldecisions.report.web.event.av.a(Unknown Source)
         at com.crystaldecisions.report.web.WorkflowController.do(Unknown Source)
    Edited by: MuralidharS on Oct 30, 2009 8:46 AM

  • OC4J JNDI lookup problem

    I'm developing a simple struts app in JDeveloper where the model component connects to an Oracle database. The webapp works fine when I deploy it... I just want to get it running locally in the embedded OC4J server. I get this stack trace error:
    javax.naming.NameNotFoundException: java:/comp/env not found
    at com.evermind.server.rmi.RMIContext.lookup(RMIContext.java:164)
    at com.evermind.server.ApplicationContext.lookup(ApplicationContext.java:333)
    at com.evermind.server.ApplicationContext.lookup(ApplicationContext.java:120)
    at javax.naming.InitialContext.lookup(InitialContext.java:347)
    at lsqtms.LoginModel.checkLoginAgainstDB(LoginModel.java:34)
    at lsqtms.LoginAction.execute(LoginAction.java:45)
    at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
    at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
    at oracle.security.jazn.oc4j.JAZNFilter.doFilter(Unknown Source)
    at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:649)
    at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:322)
    at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:270)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
    at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
    at java.lang.Thread.run(Thread.java:534)
    Here is my code to access this connection pool:
    Context initContext = new InitialContext();
    Context envContext = (Context) initContext.lookup("java:/comp/env"); //error occurs here
    javax.sql.DataSource ds = (javax.sql.DataSource) envContext.lookup("Oracle");
    Connection conn = ds.getConnection();     // retreive db connection from pool     
    I've tried to edit the OC4J preferences for the DataSource and JNDI and data-sources.xml... no luck...
    I read the OC4J article on datasources and I'm not really sure what I'm doing - I apologize for being a "newbie." How can I fix this so that I can write and debug code locally.
    Thanks
    Doug

    To web.xml add
    <resource-ref>
      <res-ref-name>jdbc/OracleDS</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
    </resource-ref>Obtaing Connection with
    InitialContext initialContext = new InitialContext();
        javax.sql.DataSource ds = (javax.sql.DataSource)initialContext.lookup("java:comp/env/jdbc/OracleDS");
    java.sql.Connection conn = ds.getConnection();

  • JNDI LookUp does not work in WSAD5.0

    Hi,
    I have an independent java class which creates Data Source in WASD 5.0, and this works fine to get data source when the server is 4.0, but does not work for server 5.0, here is the code:
    public static void main(String[] args) throws NamingException {
         javax.naming.InitialContext initialContext = null;
         java.util.Hashtable htContextEnvironment = new java.util.Hashtable();
            htContextEnvironment.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory");
            htContextEnvironment.put(javax.naming.Context.DNS_URL,"dns://127.0.0.1");
         htContextEnvironment.put(javax.naming.Context.PROVIDER_URL,"iiop://127.0.0.1:2809/");
            initialContext = new javax.naming.InitialContext(htContextEnvironment);
            System.out.println("Initial Context = " + initialContext.getNameInNamespace());
            Hashtable ht = initialContext.getEnvironment();
            DataSource ds = (DataSource) initialContext.lookup("jndi/abcd");
            System.out.println("Data Source = \n" + ds);
    }The only change which I need to make is change the port name from 2809 [5.0] to 900[4.0], the jndi name in both server is defined as "jndi/abcd"
    I always get the initial context in both cases, but can not get data source. For 5.0, I get the following exception:
    javax.naming.NameNotFoundException: jndi/abcd
         at com.ibm.ejs.ns.jndi.CNContextImpl.doLookup(CNContextImpl.java:1445)
         at com.ibm.ejs.ns.jndi.CNContextImpl.lookup(CNContextImpl.java:1129)
         at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:128)
         at javax.naming.InitialContext.lookup(InitialContext.java:359)Is there any difference in creating inital context and data source between 4.0 and 5.0 servers.
    Any help on this please.
    Thanks
    Rajender

    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 ..

  • JNDI lookup from a JSP page (URGENT)

    Hello,
    In my JSP I was using the "conn = DriverManager.getConnection("URL","username", "password")" scheme
    to connect to the database. I want to change this to use the JNDI for the database lookup in the same JSP.
    After creating this JSP i am using the include directive to include this JSP in all my other JSPs so that I can get the connection on other JSPs too.
    My included JSP where I use the JNDI look up is:
    <%@ page import="javax.naming.*,javax.sql.DataSource,java.sql.*" %>
    <%!
    static Connection conn;
    static Statement statement;
    static DataSource dataSource;
    %>
    try{
         Context ctx = new InitialContext();
         dataSource = (DataSource)ctx.lookup("MY_JNDI_NAME");
         conn = dataSource.getConnection();
         statement = conn.createStatement();
    }catch (Exception excep){
         out.println("Exception occurred "+excep);
    %>
    After I include this JSP in my main JSP, i get some error:
    188: Type expected. } catch (Throwable t) { ^ 1 error
    Can anyone here please help how to fix this.
    Thanks

    <%@ page import="javax.naming.*,javax.sql.DataSource,java.sql.*" %>
    <%!
    static Connection conn;
    static Statement statement;
    static DataSource dataSource;
    %><% // <-- you were missing a "<%" here
    try{
    Context ctx = new InitialContext();
    dataSource = (DataSource)ctx.lookup("MY_JNDI_NAME");
    conn = dataSource.getConnection();
    statement = conn.createStatement();
    }catch (Exception excep){
    out.println("Exception occurred "+excep);
    %>If I run that code in tomcat I get "Exception occurred javax.naming.NameNotFoundException: Name MY_JNDI_NAME is not bound in this Context". Which is what I would expect.
    btw: You really shouldn't be doing this stuff in a jsp.

  • JNDI Lookup in Websphere

    Hi All,
    I am trying out a simple program using JNDI which works fine when I run it as a standalone program, but when I run the same inside Embedded Websphere (eWAS), I get a NamingContextPackage not found exception.
    Here is my Standalone program:
    public class TestLDAP {
    final static String ldapServerName = "myHost:389";
    final static String rootdn = "cn=Manager,dc=abc,dc=com";
    final static String rootpass = "secret";
    final static String rootContext = "dc=abc,dc=com";
    public static void main( String[] args ) throws Exception {
    Properties env = new Properties();
    env.put( Context.INITIAL_CONTEXT_FACTORY,
    "com.sun.jndi.ldap.LdapCtxFactory" );
    env.put( Context.PROVIDER_URL, "ldap://" + ldapServerName + "/" + rootContext );
    env.put( Context.SECURITY_PRINCIPAL, rootdn );
    env.put( Context.SECURITY_CREDENTIALS, rootpass );
    try {
    // obtain initial directory context using the environment
    DirContext ctx = new InitialDirContext(env);
    OracleDataSource ods = new OracleDataSource();
    ods.setDriverType ( "thin" ); // type of driver
    ods.setServerName ( "myHost" ); // database server name
    ods.setNetworkProtocol("tcp"); // tcp is the default anyway
    ods.setDatabaseName("ORCL"); // Oracle SID
    ods.setPortNumber(1521); // listener port number
    ods.setUser("scott");
    ods.setPassword("tiger");
    //ctx.unbind("cn=myRandomInt");
    bindObjectInLDAP("cn=myRandomInt", ods, ctx);
    getObjectFromLDAP("cn=myRandomInt", ctx);
    } catch ( NameAlreadyBoundException nabe ) {
    System.err.println( "value has already been bound!" );
    } catch ( Exception e ) {
    System.err.println( e );
    private static void bindObjectInLDAP(String name, Object obj, DirContext ctx) throws Exception{
    System.out.println("Adding " + obj + " to directory..." );
    ctx.bind(name, obj);
    private static void getObjectFromLDAP(String name, DirContext ctx) throws Exception {
    DataSource dsUsingJNDI = (DataSource) ctx.lookup(name);
    System.out.println("Retreived: " + dsUsingJNDI);
    Connection connection = dsUsingJNDI.getConnection();
    System.out.println( "SUCCESS!" + connection);
    try {
    if( connection != null )
    connection.close();
    } catch (SQLException ignore ) {}
    }Inside websphere, when I run the same code, I can create the Inital Context, but it fails at the part where I do:
    DataSource dsUsingJNDI = (DataSource) ctx.lookup(name);
    Here is the Exception I get:
    Could not lookup:
    javax.naming.NameNotFoundException: Context: ImpactCell/nodes/ImpactNode/servers/server1, name: cn=myRandomInt: First component in name cn=myRandomInt not found. [Root exception is org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0]
    at com.ibm.ws.naming.jndicos.CNContextImpl.processNotFoundException(CNContextImpl.java:4730)
    at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1907)
    at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1862)
    at com.ibm.ws.naming.jndicos.CNContextImpl.lookupExt(CNContextImpl.java:1552)
    at com.ibm.ws.naming.jndicos.CNContextImpl.lookup(CNContextImpl.java:1354)
    at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:172)
    at javax.naming.InitialContext.lookup(InitialContext.java:363)
    Caused by: org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0
    Is this because of a missing jar or probably websphere doesn't like "com.sun.jndi.ldap.LdapCtxFactory" or something else?
    Any clues on what could be causing this?
    Thanks in advance!

    I'm having the same problem:
    Jun 6, 2006 8:16:36 PM com.ibm.ws.naming.util.Helpers
    WARNING: jndiGetObjInstNoop
    java.lang.ClassCastException: javax.naming.Reference
         at com.test.jms.Sender.main(Sender.java:33)
    Adding <WAS_HOME>/lib/dynacache.jar into the classpath solved the problem.
    My environment is: WAS 6.0.0.1, WebSphere MQ 6.0, JMS Client Java Application running in RAD 6.0

  • JNDI lookup in xml file

    I want to use JNDi lookup for DB. Where should i specify them. Rigtnow i have given the hibernate connections in persistance xml file with user name pwd etc. But i dont want to do this. I want to use JNDI lookup and configure my weblogic for the JNDI. What are the changes I need to make in the application context and persistance xml files. Pls help?
    my persistance .xml file looks like this,
    <?xml version="1.0" encoding="UTF-8"?>
    <persistence xmlns="http://java.sun.com/xml/ns/persistence"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    version="1.0"
    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
    <persistence-unit name="jpaPersistance" transaction-type="RESOURCE_LOCAL">
    <provider>org.hibernate.ejb.HibernatePersistence</provider>
    <class>com.ggg.jp.model.bo.individual</class>
    <exclude-unlisted-classes/>
    <properties>
    <property name="hibernate.archive.autodetection" value="class, hbm"/>
    <property name="hibernate.show_sql" value="true"/>
    <property name="hibernate.connection.driver_class" value="oracle.jdbc.driver.OracleDriver"/>
    <property name="hibernate.connection.password" value="test"/>
    <property name="hibernate.connection.url" value="jdbc:oracle:thin:@localhost:1521:xe"/>
    <property name="hibernate.connection.username" value="test"/>
    <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/>
    </properties>
    </persistence-unit>
    </persistence>
    Application context looks like this,
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:jee="http://www.springframework.org/schema/jee"
    xmlns:aop="http://www.springframework.org/schema/aop"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
    http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd
    http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
    http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
    <!-- <bean/> definitions here -->
    <context:annotation-config/>
    <bean id="demoDataServiceImpl" class="com.gg.jp.model.services.impl.DemoDataServiceImpl" />
    <bean id="recordGeneratorWebServiceHandler" class="com.gg.jp.webservice.RecordGeneratorWebServiceHandler">
    <property name="service" ref="demoDataServiceImpl"/>
    </bean>
    <bean id="entityManagerFactory"
    class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
    <property name="persistenceUnitName" value="jpaPersistance"/>
    </bean>
         <tx:annotation-driven/>
         <bean id="transactionManager"
         class="org.springframework.orm.jpa.JpaTransactionManager" >
         <property name="entityManagerFactory" ref="entityManagerFactory"/>
         </bean>
         </beans>

    Me again!
    So I found that I can't do jndi lookup (NamingException) for the datasource as mentioned, in the init method.
    However, the very same jndi lookup was successful in the overridden authenticate method, called by oc4j when trying to authenticate the user.
    Go figure!
    TIA,
    - nik.

  • JNDI lookup fails ...IMMEDIATE HELP REQUIRED !!!

    Hi
    I am new to using the WLS,currenty I am using Weblogic6.1(sp).I developed a statelessSession
    Bean and have successfully deployed it to the server.Counterfit I wrote a Client
    class to check weather my beans are working properly.My client class to be in
    breif inserts some values into the database.
    When I am trying to execute my client code it gives me out the following error
    - with nested exception:
    [javax.naming.NameNotFoundException: Unable to resolve SQLConnectionPool. Resolved:
    '' Unresolved:'SQLConn
    ectionPool' ; remaining name '']
    at com.wellmanage.Bean.MessageLoggerBean.getConnection(MessageLoggerBean.java:186)
    at com.wellmanage.Bean.MessageLoggerBean.logMessage(MessageLoggerBean.java:77)
    at com.wellmanage.Bean.MessageLoggerBean_3p5ifg_EOImpl.logMessage(MessageLoggerBean_3p5ifg_EOImpl.
    java:79)
    at com.wellmanage.Bean.MessageLoggerBean_3p5ifg_EOImpl_WLSkel.invoke(Unknown
    Source)
    at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:296)
    at weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.java:93)
    at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:265)
    at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:22)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    End server side stack trace
    SQLConnectionPool is the JNDI name i mentioned in the weblogic console.In the
    same fashion I also mentioned the jndilookup in my bean class with the same name
    (SQLConnectionPool)as follows
    public Connection getConnection() throws SQLException
    try
    InitialContext jndiCntx = new InitialContext();
    // DataSource ds = (DataSource)jndiCntx.lookup("java:comp/env/jdbc/SQLConnectionPool");
    DataSource ds = (DataSource)jndiCntx.lookup("SQLConnectionPool");
    return ds.getConnection();
    catch(NamingException ne)
    throw new EJBException(ne);
    SO FINALLY IT GIVES ME OUT THE ABOVE FIRST MENTIONED ERROR.i ALSO TRIED USING
    THE jnidlookup mentioned in the comments ie.."DataSource ds = (DataSource)jndiCntx.lookup("java:comp/env/jdbc/SQLConnectionPool");
    " then also it throws an error.
    CAN ANYBODY HELP ME IT A MATTER OF URGENCY...
    Thanks
    Srini

    can u post ur config.xml
    Srini wrote:
    Hi
    I am new to using the WLS,currenty I am using Weblogic6.1(sp).I developed a statelessSession
    Bean and have successfully deployed it to the server.Counterfit I wrote a Client
    class to check weather my beans are working properly.My client class to be in
    breif inserts some values into the database.
    When I am trying to execute my client code it gives me out the following error
    - with nested exception:
    [javax.naming.NameNotFoundException: Unable to resolve SQLConnectionPool. Resolved:
    '' Unresolved:'SQLConn
    ectionPool' ; remaining name '']
    at com.wellmanage.Bean.MessageLoggerBean.getConnection(MessageLoggerBean.java:186)
    at com.wellmanage.Bean.MessageLoggerBean.logMessage(MessageLoggerBean.java:77)
    at com.wellmanage.Bean.MessageLoggerBean_3p5ifg_EOImpl.logMessage(MessageLoggerBean_3p5ifg_EOImpl.
    java:79)
    at com.wellmanage.Bean.MessageLoggerBean_3p5ifg_EOImpl_WLSkel.invoke(Unknown
    Source)
    at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:296)
    at weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.java:93)
    at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:265)
    at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:22)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    End server side stack trace
    SQLConnectionPool is the JNDI name i mentioned in the weblogic console.In the
    same fashion I also mentioned the jndilookup in my bean class with the same name
    (SQLConnectionPool)as follows
    public Connection getConnection() throws SQLException
    try
    InitialContext jndiCntx = new InitialContext();
    // DataSource ds = (DataSource)jndiCntx.lookup("java:comp/env/jdbc/SQLConnectionPool");
    DataSource ds = (DataSource)jndiCntx.lookup("SQLConnectionPool");
    return ds.getConnection();
    catch(NamingException ne)
    throw new EJBException(ne);
    SO FINALLY IT GIVES ME OUT THE ABOVE FIRST MENTIONED ERROR.i ALSO TRIED USING
    THE jnidlookup mentioned in the comments ie.."DataSource ds = (DataSource)jndiCntx.lookup("java:comp/env/jdbc/SQLConnectionPool");
    " then also it throws an error.
    CAN ANYBODY HELP ME IT A MATTER OF URGENCY...
    Thanks
    Srini

Maybe you are looking for

  • Error in Block step in BPM.

    Hi all, I am getting the error in block step, my design follows like this i defined one transformation before block step, the transformation step will splits the input bunch of records into equal no of record packets and sent to block step.. while de

  • How to invoke and receive from csv file

    I have an employee.csv file which contains empid and empname deatils, I want to fetch corresponding empid by giving input as empname from the employee.csv file and write empid into DB I had created an read file for employee.csv, but for the receive a

  • Needs to remove Balnk spaces in the report next to data

    Dear SDN's, Report is displaying as below,my end user wants to remove blank spaces which has no data. Ex: In C1 sales is 10,but profit is blank.so profit wont be display for C1.Similar for C2 sales wont be displayed & profit shoud display. Customer  

  • Can not enable 802.11n on my MacBook (Core 2 Duo) running Snow Leopard.

    My MacBook has the AirPort card saying "a/b/g", so I know that it is not yet n-enabled. It is INDEED a Core 2 Duo. It is running Snow Leopard. When I try install the enabler off of my "AirPort Extreme: 802.11n Wi-Fi Wireless Base Station" disc, it te

  • Soundcloud doesn't work since I installed Win8

    When I was still on Windows 7 64bit, soundcloud worked perfectly. Ever since I installed Windows 8, the new soundcloud version hasn't been working properly. Tracks start loading but they don't want to play. I have tried removing adblock and reinstall