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

Similar Messages

  • JNDI lookup from OC4J to weblogic throws javax.naming.NameNotFoundException

    Hi All,
    We have the below setup in our production environment.
    EJB application is deployed in the Weblogic 10.3.4.0 Server on Sun Solaris. The EJB version is 3.0
    OC4J 10.2.0 is running on another Sun Solaris machine.
    There are 2 webservice applications WEBSERV1 & TestSoapEJB running on this OC4J container.
    We need to do lookup the EJBs deployed on the Weblogic server. For this we used the below logic in the web service's Stateless session bean:
    String weblogicURL = "";
    Properties props = new Properties();
    try
    props.load(Thread.currentThread().getContextClassLoader().getResourceAsStream("wl.properties"));
    weblogicURL     = props.getProperty("weblogicURL");     
    catch (FileNotFoundException e)
    e.printStackTrace();
    catch (IOException e)
    e.printStackTrace();
    Context ctx = null;
    Hashtable ht = new Hashtable();
    ht.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
    ht.put(Context.SECURITY_PRINCIPAL,"weblogic");
    ht.put(Context.SECURITY_CREDENTIALS,"weblogic654");
    ht.put(Context.PROVIDER_URL, weblogicURL);
    ctx = NamingManager.getInitialContext(ht) ;
    // tried using //ctx = new InitialContext(ht); same behavior.
    TestEJB.AdministratorEJB ejb = (TestEJB.AdministratorEJB) ctx.lookup("TestEJB#TestEJB.AdministratorEJB");
    ctx.close();
    When we first test first WEBSER1, the lookup is fine.
    But when we test the second webservice WEBSER2, the webservice name itself not able to lookup: It gives the below error:
    javax.naming.NameNotFoundException: remaining name: env/TestSoapEJB
    Below is the stack throws thrown on browser:
    500 Internal Server Error
    javax.naming.NameNotFoundException: remaining name: env/TestSoapEJB     
    at weblogic.j2eeclient.SimpleContext.resolve(SimpleContext.java:35)     
    at weblogic.j2eeclient.SimpleContext.resolve(SimpleContext.java:39)     
    at weblogic.j2eeclient.SimpleContext.lookup(SimpleContext.java:59)     
    at weblogic.j2eeclient.SimpleContext.lookup(SimpleContext.java:59)     
    at weblogic.j2eeclient.SimpleContext.lookup(SimpleContext.java:64)     
    at weblogic.jndi.factories.java.ReadOnlyContextWrapper.lookup(ReadOnlyContextWrapper.java:45)     
    at weblogic.jndi.internal.AbstractURLContext.lookup(AbstractURLContext.java:130)     
    at javax.naming.InitialContext.lookup(InitialContext.java:392)     
    at oracle.j2ee.ws.SessionBeanRpcWebService.init(SessionBeanRpcWebService.java:65)     
    at javax.servlet.GenericServlet.init(GenericServlet.java:258)     
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.HttpApplication.loadServlet(HttpApplication.java:2354)     
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.HttpApplication.findServlet(HttpApplication.java:4795)     
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.HttpApplication.getRequestDispatcher(HttpApplication.java:2821)     
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:680)     
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.HttpRequestHandler.run(HttpRequestHandler.java:285)     
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].server.http.HttpRequestHandler.run(HttpRequestHandler.java:126)     
    at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:186)     
    at java.lang.Thread.run(Thread.java:662)
    It seems that, the OC4J is looking in Weblogic context. But it should be looking in its own context. How to resolve this issue.
    The same case happens if i restart the OC4J and first test the TestSoapEJB the lookup is fine . But if i test the WEBSERV1 , it throws the same error as above. In short, if one of the webservices lookup is working fine, the other webservice is not working. At the same time only one webservice's lookup is working.
    Kindly help me to resolve this issue.
    regards,
    Zia
    Edited by: PT Expert on Sep 9, 2012 3:16 AM

    I work now more that two days on this error!!!
    -> I remade my complete jdev project, it did not work!
    -> I deleted the jdev/system/j2ee/oc4j/workspace dir
    -> I search for some .lock files
    -> and many more tries!!! But without success...
    Is there a way to reset the Embedded OC4J?

  • RMI JNDI Lookup on remote iAS causing "Not Authorised"

    Hi all
    I'm running through an OJMS example using AQ and all is looking good until I try and Update my plan from Design Studio..
    I get:
    IMessageSourceReceiver->messageReceive: javax.naming.NamingException: Lookup error: javax.naming.AuthenticationException: Not authorized; nested exception is:
         javax.naming.AuthenticationException: Not authorized. Root exception is javax.naming.AuthenticationException: Not authorized
         at com.evermind.server.rmi.RMIConnection.connect(RMIConnection.java:2523)
         at com.evermind.server.rmi.RMIConnection.connect(RMIConnection.java:2339)
         at com.evermind.server.rmi.RMIConnection.lookup(RMIConnection.java:1781)
         at com.evermind.server.rmi.RMIServer.lookup(RMIServer.java:721)
         at com.evermind.server.rmi.RMIContext.lookup(RMIContext.java:149)
         at javax.naming.InitialContext.lookup(InitialContext.java:347)
         at iteration.enterpriselink.sources.JMSConsumer.start(JMSConsumer.java:85)
         at iteration.enterpriselink.sources.JMSMessageSourceReceiverImpl.jmsConsumerStart(JMSMessageSourceReceiverImpl.java:1001)
    This appears to be because iAS is using JAZN security and is not allowing an anonymous lookup from BAM.
    I can't see anywhere in Architect or Administrator where I can configure a username/password for authentication with my iAS install...
    Has anyone any advice?
    Cheers
    Chris

    Hi, Chriseb2
    even i also have the same problem
    I am getting one Error while Creating Enterprise Link Plan in Design Studio of BAM and Failed to Create the Plan.
    i.e.(IMessageSourceReceiver>messageReceive:javax.NameNotFoundException: java:comp/resource/BAMTTT/TopicConnectionFactories/bam_ttq_tab not found)
    Setup:
    Integration between Oracle EBS 11.5.10 and Oracle BAM 10.1.3.
    I am trying to get the Raw Data and sending over to the Enterprise Link Plan.
    1. Created bam_ttq AQ and bam_ttq_tab.
    2. Configured all of the startup parameters required for Enterprise Message Source Type (Oracle (AS JMS and OJMS)) in the Administrator of BAM.
    3. Configured the Oracle (AS JMS and OJMS) with the following values in the Enterprise Message Sources in the Architect of BAM.
    Initial Context Factory : com.evermind.server.rmi.RMIInitialContextFactory.
    JNDI Service Provider URL : opmn:ormi://inaportal.inatech.com:6004:home.
    TopicConnectionFactory Name : java:comp/resource/BAMTTT/TopicConnectionFactories/bam_ttq_tab.
    Topic Name : java:comp/resource/BAMTTT/Topics/bam_ttq.
    JMS Message Type : Text Message.
    Durable Subscriber Name (Optional) : Bamclient.
    Message Selector (Optional) :
    Client ID (Optional) : ClientId.
    4. Also configured the data-sources.xml and applications.xml in OC4J (10.1.2) to reference the database schema where the BAM_TTQ queue is created.
    5. Modified the jndi.properties file with required properties.
    java.naming.security.principal = ias_admin
    java.naming.security.credentials = inaportal321
    java.naming.provider.url = opmn:ormi://inaportal.inatech.com:6004:home
    java.naming.factory.initial = com.evermind.server.rmi.RMIInitialContextFactory
    6. In the Design Studio I have a Plan with Oracle BAM Enterprise Message Receiver and Grid.
    And when I am updating the plan I am getting the following error.
    IMessageSourceReceiver->messageReceive: javax.naming.NameNotFoundException: java:comp/resource/BAMTTT/TopicConnectionFactories/bam_ttq_tab not found
    at com.evermind.server.rmi.RMIContext.lookup(RMIContext.java:164)
    at javax.naming.InitialContext.lookup(InitialContext.java:347)
    at iteration.enterpriselink.sources.JMSConsumer.start(JMSConsumer.java:85)
    at iteration.enterpriselink.sources.JMSMessageSourceReceiverImpl.jmsConsumerStart(JMSMessageSourceReceiverImpl.java:1001)
    at iteration.enterpriselink.sources.JMSMessageSourceReceiverImpl.messageReceive(JMSMessageSourceReceiverImpl.java:326)
    [Oracle BAM Enterprise Link error code: 0x75 -- 0x1, 0x75 -- 0x3A]
    Error during Message Receive operation.
    [Oracle BAM Enterprise Link error code: 0x75 -- 0x1, 0x75 -- 0x3B]
    Error while processing the data for the step 'Oracle BAM Enterprise Message Receiver'
    [Oracle BAM Enterprise Link error code: DC -- 0x1, DC -- 0x83]
    Error while processing the data for the step 'Oracle BAM Enterprise Message Receiver'
    [Oracle BAM Enterprise Link error code: DC -- 0x1, DC -- 0x83]
    Update of Plan "EBS_Example" failed.
    [Oracle BAM Enterprise Link error code: PlanMgr -- 0x1, PlanMgr -- 0xD5]
    Can U pls help me out with this? Its Urgent for Me
    Thx
    Renuka.

  • Oc4j and tomcat problem ....very urgent..pl respond

    Hi.Avi and all
    here we r working with oc4j as ejb container and tomcat as webcontainer.as of now we r in oc4j as both webserver and appsrver.in this case my application is running successfully.but just week days we have decide to use tomcat as webserver and 0c4j as appserver.this is my client requirement.when we r working with thses two iam keeping my web files in tomcat and iamtrying to acess ejb's deployed on oc4j.in this scenarion iam struggling with ejb handle of stateful session bean.
    here is the exact prob iam facing:
    We have got the EJBHandle for EjboBJECT. We have placed the Handle in session and while retrieving EJBObject from it the container is throwing OrionRemoteException.
    -----THIS IS STACK TRACE OF MY ERROR----$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
    $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
    $$$$$$$$$$$$$$$$$$$$$$$$$ BEFORE ezc.client.EzcPurchaseUtilManager$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
    FW >>>>> In the prepareParams.....[Session handle EzUserHome: 1]
    09/05/2002 - 22:12:15 :: ******************** session test in the utilmanager ***********
    09/05/2002 - 22:12:15 :: EzSession: ezc.session.EzSession@2942da handle is: [Session handle EzUserHome: 1]
    ****************** Exception com.evermind.server.rmi.OrionRemoteException: The EJBHome could not be found at location 'EzUserHome'class com.evermind.server.rmi.OrionRemoteException
    Exception com.evermind.server.rmi.OrionRemoteException: The EJBHome could not be found at location 'EzUserHome'class com.evermind.server.rmi.OrionRemoteException
    $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
    $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
    $$$$$$$$$$$$$$$$$$$$$$$$$ BEFORE ezc.client.EzcPurchaseUtilManager$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
    FW >>>>> In the prepareParams.....[Session handle EzUserHome: 1]
    09/05/2002 - 22:12:15 :: ******************** session test in the utilmanager ***********
    09/05/2002 - 22:12:15 :: EzSession: ezc.session.EzSession@2942da handle is: [Session handle EzUserHome: 1]
    ****************** Exception com.evermind.server.rmi.OrionRemoteException: The EJBHome could not be found at location 'EzUserHome'class com.evermind.server.rmi.OrionRemoteException
    Exception com.evermind.server.rmi.OrionRemoteException: The EJBHome could not be found at location 'EzUserHome'class com.evermind.server.rmi.OrionRemoteException
    Can anyone write to me on this.
    thx..
    Vasu

    Hi,
    I tried this on OC4J 9.0.3 production ( http://otn.oracle.com ) and Tomcat 4.0.1 (Catalina). I have a SF session bean deployed on OC4J, a web app deployed on tomcat. web.xml has ejb references added.
    The code in first JSP is like this..
    java.util.Properties prop = System.getProperties();
    prop.put(Context.INITIAL_CONTEXT_FACTORY,
    "com.evermind.server.rmi.RMIInitialContextFactory");
    prop.put(Context.PROVIDER_URL, "ormi://localhost:23891/current-workspace-app");
    prop.put(Context.SECURITY_PRINCIPAL, "admin");
    prop.put(Context.SECURITY_CREDENTIALS, "welcome");
    Context ctx = new InitialContext(prop);
    HealthCareServiceHome h = HealthCareServiceHome)PortableRemoteObject.narrow(ctx.lookup("HealthCareService"),HealthCareServiceHome.class);;
    HealthCareService js = h.create();
    Handle eh = js.getHandle();
    session.setAttribute("Eh",eh);
    and in a second JSP, I access this stateful session bean like this...
    Handle eh= (Handle)session.getAttribute("Eh");
    HealthCareService s = (HealthCareService)eh.getEJBObject();
    // do something on this instance. Everything works fine
    I dont know what versions of tomcat/oc4j you are using, may be an upgrade will help?
    Thanks,
    Neelesh
    OTN Team @ IDC

  • JNDI lookup, uncheked bean and LoginModule

    Hi people!
    I have stateless session bean with uncheked method permissions.My application use custom login module. When I try to lookup it home interface the container invoke my login module. Why it do so? This is incorrect behaviour, I think. Why container authenticate any jndi-lookup? How can I to get out this behaviour?
    Thanks.

    There are two steps since your ejb client is not a managed bean.
    1) Define an ejb-local-ref in web.xml or a class-level @EJB in some managed class within
    the same .war.
    2) Lookup the dependency by ejb-ref-name or @EJB(name) relative to java:comp/env
    Our EJB FAQ has more detail :
    https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html#POJOLocalEJB

  • JNDI lookup in iPlanet and specifying it in IAB

    Hi,
    I an trying to port a entiry bean deployed in WebLogic written in J2EE
    standards with no reference to weblogic apis. I open the JAR in IAB and it
    generates all the required XML and stubs correctly. In meta editor all the
    CMP properties are OK except JNDL name. So, I specified JNDI name as the
    same used in weblogic using EJB ref tab of meta-editor . I am trying to
    lookup using a servlet (developed in iPlanet) to look it up using the
    specified name. But I'm always getting a error NameNotFound Exception. JNDI
    name is also coming in XML
    Can anybody help me out in this ?
    --thanks
    Dipan

    you should be using:
    java:comp/env/<ejb-ref-name>
    you should have this tag (embedded under <ejb-ref>) in your ias-web.xml
    and web.xml DD files
    -geoff.
    "Dipan Talukdar" <[email protected]> wrote in message
    news:9p0068$[email protected]..
    Hi,
    I an trying to port a entiry bean deployed in WebLogic written in J2EE
    standards with no reference to weblogic apis. I open the JAR in IAB and it
    generates all the required XML and stubs correctly. In meta editor all the
    CMP properties are OK except JNDL name. So, I specified JNDI name as the
    same used in weblogic using EJB ref tab of meta-editor . I am trying to
    lookup using a servlet (developed in iPlanet) to look it up using the
    specified name. But I'm always getting a error NameNotFound Exception.JNDI
    name is also coming in XML
    Can anybody help me out in this ?
    --thanks
    Dipan

  • JNDI lookup in a clustered environment

              Hi,
              I have deployed my application on a clustered environment containing one admin
              server and two managed servers. The application is deployed on the managed servers.
              We have a DNS for these two managed servers.
              Currently, I am using t3:localhost:portnumber to get an initial context for JNDI
              lookup.
              But this will not provide perfect load balancing, since each server side component
              (EJB) will lookup for a needed component on the same server itself.
              Is there any way to get the Initial Context by using the DNS name?
              I tried t3:DNSName (Our DNS is created till the port number. e.g. http://DNS points
              to http://Managedserver1:portnumber and http://Managedserver2:portnumber
              It works, but is random. Sometimes, it gives me the following exception:
              Root exception is java.net.ConnectException: t3://DNS Name: Destination not
              reachable using: 't3'
              Could someone help me figure out a way to do this in a better way?
              Thanks,
              Aparna
              

              If you don't want or have money to use external load balancers you should be using
              the DNS entry as t3://server1:port,server2:port (you indicated you are using http.
              Also make sure your network elements between the client and the servers allow
              t3 protocol if there is packet filtering).
              S
              "Aparna" <[email protected]> wrote:
              >
              >Hi,
              >
              >I have deployed my application on a clustered environment containing
              >one admin
              >server and two managed servers. The application is deployed on the managed
              >servers.
              >We have a DNS for these two managed servers.
              >
              >Currently, I am using t3:localhost:portnumber to get an initial context
              >for JNDI
              >lookup.
              >But this will not provide perfect load balancing, since each server side
              >component
              >(EJB) will lookup for a needed component on the same server itself.
              >
              >Is there any way to get the Initial Context by using the DNS name?
              >
              >I tried t3:DNSName (Our DNS is created till the port number. e.g. http://DNS
              >points
              >to http://Managedserver1:portnumber and http://Managedserver2:portnumber
              >
              >It works, but is random. Sometimes, it gives me the following exception:
              > Root exception is java.net.ConnectException: t3://DNS Name: Destination
              > not
              >reachable using: 't3'
              >
              >Could someone help me figure out a way to do this in a better way?
              >
              >Thanks,
              >Aparna
              

  • JPA's EntityManagerFactory jndi lookup problem

    Hi,
    I need to do jndi lookup of EntityManagerFactory from DAO layer. I don't want to inject entitymanagerfactory in a session bean.
    I am using weblogic 10.0 . I could do a jndi lookup for jboss and oracle servers but not for weblogic
    I have tried below code which fails:
    ic.lookup("java:comp/env/EJB30");
    ic.lookup("java:comp/env/persistence/EJB30");
    <?xml version="1.0" encoding="windows-1252" ?>
    <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" xmlns="http://java.sun.com/xml/ns/persistence">
    <persistence-unit name="EJB30" >
    <jta-data-source>
    jdbc/empDS
    </jta-data-source>
    <class>
    com.Department
    </class>
    <class>
    com.Employee
    </class>
    </persistence-unit>
    </persistence>
    Error is:
    javax.naming.NameNotFoundException: While trying to look up comp/env/EJB30 in /app/ejb/DeptEJB30.jar#empSessionEJBBean.; remaining name 'comp/env/EJB30'
    Regards,
    Prashant

    In your EJB add the annotation @TransactionManagement(TransactionManagementType.BEAN)
    You can use JTA UserTransaction to begin and end transactions, for example
    UserTransaction userTransation = null;
    Context context = null;
    try {
    context = new InitialContext();
    userTransation = (UserTransaction) context.lookup("java:comp/UserTransaction");
    } catch (NamingException e) {
    e.printStackTrace();
    entityManager = entityManagerFactory.createEntityManager();
    userTransation.begin();
    entityManager.find(Department.class, 10);
    userTransation.commit();

  • JNDI lookups on Tomcat 5.5 and Oracle XE

    Hi there!
    I'm using Oracle 10g XE and Tomcat 5.5.9. I just wanna get advice on how to do JNDI lookups. I know XE doesn't have native support for Java and servlets and I noticed the "jndi.jar" file is missing in XE, unlike in Oracle 10g EE. Is "jndi.jar" required for JNDI functionality on XE, or can I just use Tomcat's JNDI functionality to do the lookups? Any input would be appreciated. Tnx!
    Leslie

    Hmmm
    After some search and restart the oracle-xe and checking the "alert_XE.log" file I found some strange!
    Some lib files was missing (no link was made in the /usr/lib path)
    And the dbf file "/usr/lib/oracle/xe/oradata/XE/control.dbf" was missing......
    I remove the installation (rpm -e oracle-xe)
    and then reinstall it.
    Run the config and now I can access the host!
    It seams that the installation scripts is not perfect!
    I hope this will help some other.
    //TEW

  • OC4J, JNDI lookup and UserManager

    Hi
    Recently we decided to upgrade our Oracle9iAS to 9.0.3 from 9.0.2 and its JVM to 1.4.2_02 from 1.3.1.
    We have 2 customs implementations of UserManager that worked in the earlier version and, after the upgrade, it became unstable. Each UserManager uses a connection to a database provided by a DataSource, which is retrieved by a JNDI lookup. This lookup throws a NameNotFoundException after some time of execution. A container restart solves the problem, but it appears again later.
    What´s happening?
    Jose Antonio.

    Hi
    Recently we decided to upgrade our Oracle9iAS to 9.0.3 from 9.0.2 and its JVM to 1.4.2_02 from 1.3.1.
    We have 2 customs implementations of UserManager that worked in the earlier version and, after the upgrade, it became unstable. Each UserManager uses a connection to a database provided by a DataSource, which is retrieved by a JNDI lookup. This lookup throws a NameNotFoundException after some time of execution. A container restart solves the problem, but it appears again later.
    What´s happening?
    Jose Antonio.

  • JNDI lookup name in a standalone oc4j instance

    Hi,
    Could you please let me know how to create a JNDI lookup name for a database in a stanalone OC4j Instance?
    Both OC4J and oracle 9i database are in the same server.
    Thanks in advance,
    Sukonya

    Hi,
    I have the oracle 9i database as well as the oc4j instance in my local machine.I am trying to deploy a J2ee Application on the OC4j instance,using eclipse IDE.I have not created any connection pool or datasource in the oc4j instance but after i build the application I see that the connection pool and datasource instance have been created in the OC4j instance.
    following are the contents of the build.xml file(for the ant build tool)
    <?xml version="1.0" encoding="UTF-8" ?>
    - <project name="TicketLoggingSystem" default="bind-web-app" basedir="../">
    <property name="app.server" value="D:/oc4j/j2ee/home" />
    <property name="dest.dir" value="${basedir}/dest" />
    <property name="war.file" value="${dest.dir}/TicketLoggingSystem.war" />
    <property name="ear.file" value="${dest.dir}/TicketLoggingSystem.ear" />
    <property name="web.inf" value="${basedir}/WEB-INF" />
    <property name="web.classes" value="${dest.dir}/classes" />
    <property name="app.xml" value="${basedir}/application.xml" />
    <property name="src.dir" value="${basedir}/src" />
    <property name="oc4j.host" value="localhost" />
    <property name="oc4j.admin.port" value="23791" />
    <property name="oracle.home" value="D:/oc4j" />
    <property name="j2ee.home" value="${oracle.home}/j2ee/home" />
    <property name="oc4j.admin.username" value="oc4jadmin" />
    <property name="oc4j.admin.password" value="welcome" />
    <property name="oc4j.ormi" value="ormi://${oc4j.host}:${oc4j.admin.port}" />
    <property name="app.name" value="TicketLoggingSystem" />
    <property name="jdbc.url" value="jdbc:oracle:thin:@localhost:1521:80" />
    <property name="jdbc.username" value="scott" />
    <property name="jdbc.password" value="tiger" />
    <property name="connection.driver" value="oracle.jdbc.driver.OracleDriver" />
    <property name="connection.datasource" value="oracle.jdbc.pool.OracleDataSource" />
    <property name="xa.location" value="jdbc/xa/MpsiDS" />
    - <!-- Delete dest folder
    -->
    - <target name="init">
    <delete dir="${dest.dir}" includeemptydirs="true" />
    <mkdir dir="${dest.dir}" />
    <mkdir dir="${web.classes}" />
    </target>
    - <!-- Compile all Java files
    -->
    - <target name="wscompile">
    - <javac srcdir="${src.dir}" destdir="${web.classes}" deprecation="on" debug="on">
    <exclude name="**/*.properties,**/*.xml" />
    - <classpath>
    <fileset dir="${web.inf}/lib" includes="*.jar" />
    <fileset dir="${app.server}/lib" includes="servlet.jar" />
    </classpath>
    </javac>
    </target>
    - <!-- Build Web archive file
    -->
    - <target name="buildWar" depends="init,wscompile">
    - <war destfile="${war.file}" webxml="${web.inf}/web.xml">
    - <fileset dir="${basedir}">
    <include name="content*/**" />
    </fileset>
    <webinf dir="${web.inf}" includes="*.xml,*.tld" excludes="web.xml" />
    <classes dir="${web.inf}/classes" />
    <lib dir="${web.inf}/lib" includes="*.jar" />
    </war>
    </target>
    - <!-- Build Enterprsie Archive
    -->
    - <target name="buildEar" depends="buildWar">
    - <ear destfile="${ear.file}" appxml="${app.xml}">
    <fileset dir="${dest.dir}" includes="*.war" />
    </ear>
    </target>
    - <!-- Checking availability of oc4j
    -->
    - <target name="check-oc4j-available">
    <echo message="------> Checking to see if OC4J is started ." />
    <echo message="[checking oc4j on machine =${oc4j.host}]" />
    <echo message="[port=${oc4j.admin.port}]" />
    - <condition property="oc4j.started">
    <socket server="${oc4j.host}" port="${oc4j.admin.port}" />
    </condition>
    </target>
    - <!-- Remove data source
    -->
    - <target name="remove-data-source" depends="check-oc4j-available" if="oc4j.started">
    <echo message="Removing DataSource" />
    - <java jar="${j2ee.home}/admin.jar" fork="true">
    <arg value="${oc4j.ormi}" />
    <arg value="${oc4j.admin.username}" />
    <arg value="${oc4j.admin.password}" />
    <arg value="-application" />
    <arg value="${app.name}" />
    <arg value="-removeDataSource" />
    <arg value="-location" />
    <arg value="jdbc/TicketLoggingSystem" />
    </java>
    <echo message="Removed DataSource Successfully" />
    </target>
    - <!-- Undeploy
    -->
    - <target name="undeploy" depends="remove-data-source" description="Undeploying the application" if="oc4j.started">
    <echo message="Undeploying the Application ${app.name}" />
    - <java jar="${j2ee.home}/admin.jar" fork="true">
    <arg value="${oc4j.ormi}" />
    <arg value="${oc4j.admin.username}" />
    <arg value="${oc4j.admin.password}" />
    <arg value="-undeploy" />
    <arg value="${app.name}" />
    </java>
    <echo message="Undeploying the Application ${app.name} is Successful" />
    </target>
    - <!-- Deploy
    -->
    - <target name="deploy" depends="undeploy,buildEar" if="oc4j.started">
    <echo message="Deploying the Application ${app.name}" />
    - <java jar="${j2ee.home}/admin.jar" fork="true">
    <arg value="${oc4j.ormi}" />
    <arg value="${oc4j.admin.username}" />
    <arg value="${oc4j.admin.password}" />
    <arg value="-deploy" />
    <arg value="-file" />
    <arg value="${ear.file}" />
    <arg value="-deploymentName" />
    <arg value="${app.name}" />
    </java>
    <echo message="Deploying the Application ${app.name} is Successful" />
    </target>
    - <!-- Create data source
    -->
    - <target name="create-data-source" depends="check-oc4j-available" if="oc4j.started">
    <echo message="Creating DataSource for Application ${app.name}" />
    - <java jar="${j2ee.home}/admin.jar" fork="true">
    <arg value="${oc4j.ormi}" />
    <arg value="${oc4j.admin.username}" />
    <arg value="${oc4j.admin.password}" />
    <arg value="-application" />
    <arg value="${app.name}" />
    <arg value="-installDataSource" />
    <arg value="-jar" />
    <arg value="${oracle.home}/jdbc/lib/ojdbc14dms.jar" />
    <arg value="-url" />
    <arg value="${jdbc.url}" />
    <arg value="-connectionDriver" />
    <arg value="${connection.driver}" />
    <arg value="-location" />
    <arg value="jdbc/TicketLoggingSystem" />
    <arg value="-username" />
    <arg value="${jdbc.username}" />
    <arg value="-password" />
    <arg value="${jdbc.password}" />
    <arg value="-className" />
    <arg value="${connection.datasource}" />
    </java>
    <echo message="Created DataSource Successfully for Application ${app.name}" />
    </target>
    - <!-- Binding web-app
    -->
    - <target name="bind-web-app" depends="deploy,create-data-source" if="oc4j.started">
    <echo message="executing bind web app" />
    - <java jar="${j2ee.home}/admin.jar" fork="true">
    <arg value="${oc4j.ormi}" />
    <arg value="${oc4j.admin.username}" />
    <arg value="${oc4j.admin.password}" />
    <arg value="-bindWebApp" />
    <arg value="${app.name}" />
    - <!-- app deployname
    -->
    <arg value="${app.name}" />
    - <!-- web module name
    -->
    <arg value="default-web-site" />
    - <!-- web site name
    -->
    <arg value="/${app.name}" />
    - <!-- context root
    -->
    </java>
    <echo message="Access the application using: http://${oc4j.host}:8888/${app.name}" />
    </target>
    </project>
    Following are the contents of Oc4J home->services->jdbc resources:
    Datasource:
    Name jdbc/TicketLoggingSystem
    Application TicketLoggingSystem
    JNDI Location jdbc/TicketLoggingSystem
    Connection Pool
    Managed by OC4j
    Test
    when i click the datasource name,I see that its type is Native datasource with no related connection pool.
    Whereas for the default datasource oracleDS,
    Type     Managed Data Source
    Connection Pool     Example Connection Pool
    However on deployment a connection pool is also created along with the datasource
    Name jdbc/TicketLoggingSystem_connectionPool
    Application TicketLoggingSystem
    ConnectionFactory class : oracle.jdbc.pool.OracleDataSource
    Do we need to bind this connection pool to our datasource?If yes how is it done.And if that is not required,why is this connection pool created?Are the datasource and connection pool already bound to each other?
    Also when I test either the datasource or connection pool,it says
    Confirmation     
    Connection to "jdbc/TicketLoggingSystem_connectionPool" established successfully
    or
    Connection to "jdbc/TicketLoggingSystem" established successfully.
    and displays both the connection pool and datasource details together for both the tests.
    In my java code,while trying to establish connection to the database what should I mention in lookup i.e,
    InitialContext context = new InitialContext();
    DataSource dataSource = (DataSource) context.lookup("     jdbc/TicketLoggingSystem or      jdbc/TicketLoggingSystem_connectionPool");
    con = dataSource.getConnection();
    Sorry if I am sounding novice.Thanks a lot in advance,
    Sukanya

  • JNDI and Tomcat

    Alright. I'm new using JNDI, but i get all the Context, Binding, lookup operations and rellated issues.
    But, I need to connect to a server who has Tomcat using JNDI. (A high-school homework)
    In a manner of fact, I need to create 2 subcontext an in the last one I need to bind a name with a reference to cmd.exe (it seems that I need to execute it), all of it using Tomcat's JNDI connection capabilities.
    but when I'm trying to Construct the Initial Context reference, I'm not doing it in the right way... this is my Hashtable:
    Hashtable env = new Hastable();
    env.put(Context.INITIAL_CONTEXT_FACTORY, //I don't know what the hell goes hereApparentntly from web examples I have seen, It's the Implementation of the JNDI SPI from the Service Provider I want to connect... I really don't know which one to put when using Tomcat, or find other one.
    I read in the HOW-TO section in the apache site, but find nothing...
    or didn't get the idea, I saw they only get the container like this:
    Context ct = new InitialContext();
    with no arguments... but I also tryed to do it that way, but the same NamingException is thrown, with the message that I need to psecify the context factory. Well. I hope it's clear my trouble, and any of you would help me.
    Not reporting anything else. Thanks.

    Hello,
    have you check the following link
    http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-resources-howto.html
    excerpts
    Tomcat 5 provides a JNDI InitialContext implementation instance to web applications running under it, in a manner that is compatible with those provided by a Java2 Enterprise Edition application server. Entries in this InitialContext are configured in the $CATALINA_HOME/conf/server.xml file, and may be referenced by the following elements in the web application deployment descriptor (/WEB-INF/web.xml) of your web application:
    used the resource file <resource-env-ref> , do not harcdode your jndi.properties
    basic data source factory
    <org.apache.commons.dbcp.BasicDataSourceFactory>
    and bean factory
    org.apache.naming.factory.BeanFactory
    thaks

  • JNDI lookup help please-Bean to Bean callout locally in same oc4j container

    Hi - I'm fairly new to oc4j/ejb coding - I'm trying to get a simple application running to show that our code can be run in local mode - here is the scenario:
    - Bean A (our application bean) within Application A
    - Bean B (customer-developed bean) within Application B
    - Bean B calls Bean A
    - Bean A + Bean B are different application instances in the same oc4j container
    - Jsp (residing in ApplicationB) within the same oc4j container calling Bean B, which invokes Bean A
    ====
    I get the following exception (classes renamed to match scenario):
    javax.naming.NameNotFoundException: oracle.apps.applicationa.common.BeanA not found in anothercompany.applicationb.common.BeanB
    [java] at com.oracle.naming.J2EEContext.getSubContext(J2EEContext.java:93)
    [java] at com.oracle.naming.J2EEContext.lookup(J2EEContext.java:76)
    [java] at com.evermind.server.ApplicationContext.lookupJavaCompEnv(ApplicationContext.java:265)
    [java] at com.evermind.server.ApplicationContext.lookupJavaComp(ApplicationContext.java:132)
    [java] at com.evermind.server.ApplicationContext.lookup(ApplicationContext.java:306)
    [java] at com.evermind.server.ApplicationContext.lookup(ApplicationContext.java:120)
    [java] at javax.naming.InitialContext.lookup(InitialContext.java:347)
    - BeanA is part of application named "AppA" in server.xml
    - BeanB is part of application named "AppB" in server.xml
    - AppB has attribute 'parent="AppA"' in server.xml
    - If I change the Jsp file (residing in AppB) to call BeanA directly in the jsp code it works with no JNDI error, but changing the jsp code back to calling BeanB (which then calls BeanA) will throw the NameNotFoundException
    My Stateless Session Bean is very simple and I have tried not setting the context and setting the context. I'm thinking this is a very simple configuration issue, but have not been able to find the solution yet... I've tried playing with the setSessionContext method in the session bean but have had no luck and am not sure what to set the variables to or even if I'm in the correct method...
    public void setSessionContext(SessionContext ctx) {   
    if (verbose)
    System.out.println("setSessionContext called");
    Properties env = new Properties();
    // tried all three context factories...
    //env.put(Context.INITIAL_CONTEXT_FACTORY,"com.evermind.server.ApplicationInitalContextFactory");
    env.put(Context.INITIAL_CONTEXT_FACTORY,"com.evermind.server.ApplicationClientInitialContextFactory");
    //env.put(Context.INITIAL_CONTEXT_FACTORY,"com.evermind.server.rmi.RMIInitialContextFactory");
    // not sure what url to put, if any
    //env.put(Context.PROVIDER_URL, "ormi://localhost:23791/AppB");
    env.put(Context.PROVIDER_URL, "ormi://localhost/AppB");
    // tried with and without security principals... also tried sysadmin/sysadmin
    env.put(Context.SECURITY_PRINCIPAL, "guest");
    env.put(Context.SECURITY_CREDENTIALS, "welcome");
    // mProps is a local transient member var of type Properties
    mProps = env;
    // mCtx is a local transient member var of type SessionContext
    mCtx = ctx;
    (edit) additional info:
    - all beans/classes are in the same classes directory; there are no jar files, so in application.xml the specified classpath is "classes" which includes both appA and appB classes
    - I verified that if I point (appB) jsp directly to BeanA it works with the "parent" attribute set on appB in server.xml, and when I remove the "parent" attribute on appB in server.xml the jsp throws a NameNotFoundException
    edit #2:
    another interesting note is that the exception message says "oracle.apps.applicationa.common.BeanA not found in anothercompany.applicationb.common.BeanB"
    and usually the naming error I see is:
    "oracle.apps.applicationa.common.BeanA not found in appB"
    (as with the case when I use a jsp to access appA beans without setting the parent application of appB to appA)
    - also my j2ee/home/applications/appB/WEB-INF/web.xml includes the oracle.apps.applicationa.common.BeanA ejb-ref tag
    any help is appreciated - thanks!
    Message was edited by:
    oleon

    Hi Steve
    thanks for the reply - I currently have the parent attribute set in server.xml which is why the jsp connection works, but for some strange reason the bean cannot connect to other bean...
    my server.xml has something like...
    <application name="appA" location="appA" auto-start="true"/>
    <application name="appB" location="appB" parent="appA" auto-start="true"/>
    (ok, the tags might be off because I'm not in front of my workstation looking at the xml file...)
    on another interesting note, in the session bean for AppB I've tried searching for the ejb bean for app B (itself basically) with the default initial context and it cannot find its own bean within the same application... the message would be something like "NameNotFoundException: anothercompany.applicationb.common.BeanB not found in anothercompany.applicationb.common.BeanB"

  • JNDI lookup from Tomcat to EJB Container

    Hello!
    i am currently trying to use a combination of Catalina and an external EJB Server (running on another machine).
    i am really struggeling with doing the jndi lookup. i have no idea where and how to set the properties in the web server and do the mapping from the ejb-refs to the jndi name? (since tomcat doesnt seem to have a deploymentplan?!)
    maybe someone here knows the problem and can help, please?
    (i am not sure but this might also be the wrong discussion group for that??)
    thanks
    wolfgang

    Hello Wolfgang,
    I solved this problem by setting the proper jndi properties in the startup phase (MyInitServlet) by System.setProperty(...).
    This seems ugly, but it works.
    Tilo

  • Env-entry-mapping in orion-application-client not available in JNDI lookup

    I have an application client module in my EAR file that I've configured to auto-start.
    It has a few env-entry defined in it's application-client.xml.
    When I deploy the EAR file to OC4J 10.1.3, the application client module gets started and can access these env-entry properties from its JNDIContext.
    Now, comes the problem. During the deployment process, I edit the Deployment Plan, and change the env-entry property values, and then deploy the application.
    However, the application client module still gets the original values when it does the JNDI lookups of those env-entry names.
    I have checked to see that OC4J creates an orion-application-client.xml during deployment and it shows the env-entry-mapping elements with the updated values.
    Why is the JNDI lookup returning the values from application-client.xml and not the overriden values set in orion-application-client.xml?
    I have tried this on OC4J 10.1.3, as well as 10.1.3.1.0 - got same behavior.
    Is this a bug in OC4J? This seems to work fine with ejb modules, but not application client modules.
    Thanks,
    Kalpak

    Avi!
    Of course, I had tried it before I wrote the question. I put the modified xml file into the application area. After that AS restarts OC4J instance. And then I find my xml without any changes I made! I tried to do the same thing from the AS console. The same!
    Leonid

Maybe you are looking for

  • Error in maintenence optimizer while selecting files for download for EHP4

    HI, We are trying to download files for upgrade of ECC (HCM) and Portal systems from EHP3 to EHP4. This download we are doing through the Solman 7.0. Solman is currently at 7.0 but going to be upgraded soon to EHP1. Problem is that after we select th

  • Can I delete photos from iPhoto after importing them to an external hard drive?

    For a while my family has been experiencing extreme slowness on our early 2008 iMac running OS X Lion.  We tried many different ways to speed it up.  I recently bought a new external hard-drive and was going to put some of our media on the hard-drive

  • Parental Controls app settings keep changing on their own

    I manage a lab and have setup Parental Controls to allow certain apps. However, later students will launch an app. that I have enabled and get the dialog box saying it isn't allowed. I go back and check parental controls for that computer and the app

  • Guest Server - Self-Service login page

    Hi Has anyone managed to customise the spash page users see when they login ? We are trying things like stopping the "access plan" from displaying and the phone country code to default to 44 and not +1. Any guidance would be appreciated. Thanks

  • Managing RAW image Files on several machines

    I am a new user of Lightroom, purchased three weeks ago, and trying to switch from Aperture, which doesn't support my newest addition to my equipment, the Canon G9 RAW files. I feel resonably comfortable after these weeks with LR's basic concept's, w