EJBContainer (glassfish v 3.0 impl) and JUnit, jndi lookup is impossible!!!

Hello,
i hope to find a solution, but i think there's something wrong:
i did my JUnit test case and i instantiate the glassfish v3 EJBContainer in my @BeforeClass method
running the test, deploy messages are something like this:
INFO: Portable JNDI names for EJB PhaseHandler : [java:global/ejb-app4338883541443661181/classes/MyEJB!my.package.MyEJB, java:global/ejb-app4338883541443661181/classes/MyEJB]i would like to lookup for the ejb in my @Before methods... but... which jndi name should i use to fetch the EJB if the app name is random?
i've tried some tries:
java:global/classes/MyEJB (read from a tutorial)
java:app/classes/MyEJB (thought it could work but.. no it doesn't)
java:module/MyEJB (failed :/ )
any suggestion? any help will be greatly appreciated
follows my maven dependency configuration
    <repositories>
        <repository>
            <id>maven2-repository.dev.java.net</id>
            <name>Java.net Repository for Maven</name>
            <url>http://download.java.net/maven/glassfish</url>
            <layout>default</layout>
        </repository>
    </repositories>
    <dependencies>
        <dependency>
            <groupId>org.glassfish.extras</groupId>
            <artifactId>glassfish-embedded-all</artifactId>
            <version>3.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-api</artifactId>
            <version>6.0</version>
            <type>jar</type>
            <scope>provided</scope>
        </dependency>
    </dependencies>and this is my test case:
    @BeforeClass
    public static void startContainer() {
        container = EJBContainer.createEJBContainer();
    @AfterClass
    public static void stopContainer() {
        if (container != null) {
            container.close();
     * @throws NamingException
    @Before
    public void setup() throws NamingException {
        myEjb =(MyEJB)container.getContext().lookup(
                "which jndi should i use?");
    }

i did my JUnit test case and i instantiate the glassfish v3 EJBContainer in my @BeforeClass methodWhat is "your jUnit test case"?
You don't have to implement jUnit tests, and if you do, you generally benefit to have more than one.
Moreover, you shouldn't think it as "doing jUnit test cases", but merely as "doing unit-testing using jUnit"

Similar Messages

  • Rich Domain Model and Local JNDI Lookups

    Hi,
    I'm sure this is a problem a lot of other people have come across but there seems to be very little coherent discussion on the issue, so I'd very much appreciate any views people might have on the matter.
    The problem is whether or not you compromise your object-oriented principles and stick with the field or method level EJB dependency injection annotations, a procedural programming style, and a weak domain-model; or, strive for a richer domain model with a sub-optimal JDNI lookup solution.
    Take adding an item to simple shopping cart as an example.
    @Stateful
    public class CartBean implements Cart {
      @EJB
      private ProductManagerLocal productManager;
      @EJB
      private PricingServiceLocal pricingService;
      private Order order;
      public void addItem(final int productId) {
        if (order.containsLineItem(productId) {
          order.addQuantity(productId, 1);
        } else {
          final Product product = productManager.getProduct(productId);
          final Price price = pricingService.getPrice(productId);
          order.createLineItem(product, price);
    }The code above makes Cart dependent on Product and Price, when in reality Cart only cares about Order. The logic in the addItem() method should really be in the Order object on the basis Order is the information expert, but because Order is a POJO you can't inject the necessary EJB references. What's more, because the EJB interfaces are local they don't have a JNDI name assigned in the same way a remote one would.
    To perform a portable lookup of the required EJBs from within an instance of the Order class, the method must be invoked by a component with the required EJB references in its private namespace. See https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html#POJOLocalEJB. This makes for a very brittle solution with no compile time checks whatsoever.
    The problem seems to have been addressed in EJB 3.1 as the proposal for portable global JNDI names also applies to session beans exposing local only interfaces. See http://blogs.sun.com/kensaks/entry/portable_global_jndi_names.
    There seems to be very little guidance from Sun on this matter; ALL the examples in the JEE 5 Tutorial follow the anaemic domain model approach with business objects presented as little more than dumb placeholders for persistent data.
    What are people's thoughts on this? When it comes to EJB do we simply have to accept that local service lookups from POJOs aren't that robust and go with a procedural programming style, or should we be implementing a local service locator to facilitate domain objects taking on appropriate responsibilities via access to local stateless session beans / services?

    Hi,
    I'm sure this is a problem a lot of other people have come across but there seems to be very little coherent discussion on the issue, so I'd very much appreciate any views people might have on the matter.
    The problem is whether or not you compromise your object-oriented principles and stick with the field or method level EJB dependency injection annotations, a procedural programming style, and a weak domain-model; or, strive for a richer domain model with a sub-optimal JDNI lookup solution.
    Take adding an item to simple shopping cart as an example.
    @Stateful
    public class CartBean implements Cart {
      @EJB
      private ProductManagerLocal productManager;
      @EJB
      private PricingServiceLocal pricingService;
      private Order order;
      public void addItem(final int productId) {
        if (order.containsLineItem(productId) {
          order.addQuantity(productId, 1);
        } else {
          final Product product = productManager.getProduct(productId);
          final Price price = pricingService.getPrice(productId);
          order.createLineItem(product, price);
    }The code above makes Cart dependent on Product and Price, when in reality Cart only cares about Order. The logic in the addItem() method should really be in the Order object on the basis Order is the information expert, but because Order is a POJO you can't inject the necessary EJB references. What's more, because the EJB interfaces are local they don't have a JNDI name assigned in the same way a remote one would.
    To perform a portable lookup of the required EJBs from within an instance of the Order class, the method must be invoked by a component with the required EJB references in its private namespace. See https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html#POJOLocalEJB. This makes for a very brittle solution with no compile time checks whatsoever.
    The problem seems to have been addressed in EJB 3.1 as the proposal for portable global JNDI names also applies to session beans exposing local only interfaces. See http://blogs.sun.com/kensaks/entry/portable_global_jndi_names.
    There seems to be very little guidance from Sun on this matter; ALL the examples in the JEE 5 Tutorial follow the anaemic domain model approach with business objects presented as little more than dumb placeholders for persistent data.
    What are people's thoughts on this? When it comes to EJB do we simply have to accept that local service lookups from POJOs aren't that robust and go with a procedural programming style, or should we be implementing a local service locator to facilitate domain objects taking on appropriate responsibilities via access to local stateless session beans / services?

  • Netbeans and junit

    Hi,
    I am sorry if this is the wrong place to post this but I need a quick answer.
    I have developed a school project in netbeans and junit.
    How can I execute the junit tests externaly to the IDE?
    Where is the junit installed?
    thanks,
    Sebastian

    JUnit is just a java library. Take a look at
    http://www.junit.org/index.htm

  • ANT and JUnit in weblogic

    Hi.
    I see that the problem with ant and junit is discussed here, but with no absolutte solution.
    The problem:
    I create an build.xml containing the <junit>-task and want to run this from within the BEA Workshop. The standard error-message is that it cant find the junit-task. I can run the same build file from command since I got ANT set up correctly with JUnit outside Weblogic.
    It sems for me that Workshop dont care about existing installation of ANT, it uses it own version. I have included junit.jar in the same direstory as ant.jar is in BEA-install-dir also, but it wont work.
    Does anyone have a solution to this "small" problem??
    Thanks in advance.

    I haven't figured out why, but my JDeveloper automatically adds the classpath I have in my ant build.xml to the additional classpath of the project. My classpath is set like this in the build.xml:<path id="classpath">
    <fileset dir="env/lib">
          <include name="**/*.jar"/>
        </fileset>
    </path>And my compile target looks like this:<target name="compile" depends="init">
        <mkdir dir="${compile.outdir}"/>
        <!--Compile Java source files-->
        <javac destdir="${compile.outdir}" debug="on">
           <classpath refid="classpath"/>
           <src refid="srcpath"/>
        </javac>
      </target>And my Jdev project settings -> common -> ant has my build.xml file selected with default make and rebuild targets selected. I have never put a single entry in the additional classpath area but somehow I have all the libs as I set up in my build.xml file. I'm using JDev 9.0.3.2 by the way.

  • Ant 1.6.5 and JUnit 4.1

    According to ant bugs Bug-40682 and Bug-40697, Ant 1.6.5 and JUnit 4.1 have integration problems. Is there a plan for Jdeveloper 11g to upgrade to Ant 1.7?

    We are currently testing up take of Ant 1.7 for JDeveloper 11.
    --RiC                                                                                                                                                                                           

  • JNDI lookup and Singletons

    Hi there,
    I am doing some tests on Glassfish v3 and new EJB 3.1 features. I've migrated some beans I previously had to bind to the web layer and now I can have in the EJB layer thanks to the new Singleton concept. The problem is that I don't know if I can get them with a JNDI lookup as I do with session beans. In Glassfish log I only see entries about JNDI names for the SSBs, not for the Singletons.
    Are they visible in the JNDI naming system? How can I know the names? (I am migrating from JBoss 5.1 so I am also a bit new to Glassfish)
    I cannot do a Dependency injection @EJB as I am using struts2 actions. I can only use JNDI (not right?) :-)
    Thanks for any help,
    Ignacio

    Hi there,
    I am doing some tests on Glassfish v3 and new EJB 3.1 features. I've migrated some beans I previously had to bind to the web layer and now I can have in the EJB layer thanks to the new Singleton concept. The problem is that I don't know if I can get them with a JNDI lookup as I do with session beans. In Glassfish log I only see entries about JNDI names for the SSBs, not for the Singletons.
    Are they visible in the JNDI naming system? How can I know the names? (I am migrating from JBoss 5.1 so I am also a bit new to Glassfish)
    I cannot do a Dependency injection @EJB as I am using struts2 actions. I can only use JNDI (not right?) :-)
    Thanks for any help,
    Ignacio

  • Doing a jndi lookup() for an EJB deployed on Glassfish v3

    Hello.
    I have deployed a Stateful Sesion EJB on a Glassfish v3 AppServer.
    It is running under 'localhost' on my laptop pc.
    I am also running a stand-alone java application on the same pc... it attempts to get a remote connection from the client-app to the Glassfish Server and then do a jndi lookup() to get a reference to my EJB.
    here is the client source code:
    public class LookupTest {
    static Properties props = null;
    public static void main(String[] args) {
    try {
    props = new Properties();
    props.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.cosnaming.CNCtxFactory");
         props.put(Context.PROVIDER_URL, "iiop://localhost:3700");
         Context ctx = new InitialContext(props);
         System.out.println( "the context is: " + ctx);
         System.out.println( "the environment contains: " + ctx.getEnvironment() );
         System.out.println( " ");
         // do a lookup.
         Object elementObj = ctx.lookup("SerialContextProvider");
         System.out.println(elementObj);
    } catch (NamingException e) {
    e.printStackTrace();
    When I run this app, there are no Errors or Exceptions. It appears that the connection succeeds. But there are no EJB references in the context that is created. The only item that seems to be present in the context is an item named "SerialContextProvider", as noted in the return value from a list("") method invocation. Why can i not see the EJB within the context? Is my code wrong ??
    Thanks,
    Andy Jerpe
    Edited by: user1169567 on Nov 28, 2010 12:12 PM

    Ok, but the communication seems to be OK over the wire because if I use netstat -a I can see the ESTABLISHED connection with the server in the right RMI port.
    TCP PORTAL35:1581 caapiranga:12405 ESTABLISHED
    and then when I stop the instance in the OAS, the client shows an exception telling that the connection was lost.
    An curious thing is that the ons.log doesn't log this connection ;/

  • 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

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

  • NamingException and ClassCastException during jndi lookup

    Hi,
    I am trying to access the SAP database(MaxDb)using JNDI lookup in WebDynpro simple java project.
    But, during lookup I am getting the following error
    com.sap.engine.services.jndi.persistent.exceptions.NamingException: Exception during lookup operation of object with name : jdbc/VSLOOKUP , can not resolve object reference [Root exception is java.lang.ClassCastException]
         at com.sap.engine.services.jndi.implclient.ClientContext.lookup(ClientContext.java:469)
         at com.sap.engine.services.jndi.implclient.ClientContext.lookup(ClientContext.java:558)
         at javax.naming.InitialContext.lookup(InitialContext.java:347)
         at com.vitalspring.healthbenefits.dbaccess.DBAccessHelper.main(DBAccessHelper.java:51)
    Caused by: java.lang.ClassCastException
         at com.sap.engine.services.connector.ResourceObjectFactory.getObjectInstance(ResourceObjectFactory.java:149)
         at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:301)
         at com.sap.engine.services.jndi.implclient.ClientContext.lookup(ClientContext.java:466)
         ... 3 more
    Can anybody throw some light on it?
    Because, it's urgent for my project.
    I would appreciate any kind of help in this regard.
    Thanks & Regards,
    Rambabu Kancharla

    Hello Anilkumar,
    Sorry for delay in reply as I was on out of work and didn't get chance to check the SDN forums.
    I was able to do it in latest version sneak preview 11.
    I think the problem with the version.
    Thanks,
    Rambabu

  • JNLP and Tomcat JNDI DataSource

    Software
    JDK 1.5 Update 6
    Tomcat 5.5.4
    Requirements
    I have a Client Side requirement and this project is going to be deployed to 5 users initially all in a lan but there are very chances of adding more users simultaneously.
    I am thinking of deploying in JNLP Environment.
    At present the Swing application though in development phase is running a little slow and therefore I required the way by which I could store the references of the Object in some server.Getting Connection Object is also a major time consumer and so I needed some way by which I can use the Tomcat DataSource and use the JNDI facility to store certain intermediate values in the server.
    Can I use the JNDI in the JNLP Application.
    Please provide me the way by which I can do this stuff
    Thanks in advance
    CSJakharia

    .> I am using tomcat 5.5.9 and oracle 9i. I am hosting a
    portal which uses connection pooling.
    I have decided to use the connection pooling through
    tomcat's JNDI naming lookup.Excellent idea.
    for this i have used the following steps --
    1) made entry of <resource-ref> in webapp's web.xml
    2) made relevant and corresponding entry in tomcat's
    ${TOMCAT_HOME}/conf/context.xml (for JNDI
    JDBC-datasource)No, don't do it that way.
    .> my problems are--
    1) making the entry for context.xml in tomcats
    conf folder makes the application war dependent
    on web server which i dont want to make.Yes, it does.
    2) i have to put classes12.jar in tomcats
    ${TOMCAT_HOME}/common/lib folder and only then the
    application connection pooling works else the
    exception coming on tomcat console is --
    org.apache.tomcat.dbcp.dbcp.SQLNestedException.
    Why aren't you using the latest JDBC driver from Oracle? That's in ojdbc14.jar.
    .> I dont want to put classes12.jar in web server i want
    the web server's JNDI lookup to pick the driver frm
    my webapps' internal lib folder. please help me on
    these very pressing and immediate issues. all the
    help coming from anyone in this regard is very much
    welcome.
    thanks in advance!
    VaivYour instinct is correct.
    (1) Put ojdbc14.jar in WEB-INF/lib of your WAR file.
    (2) Edit the <Context> XML into a file named context.xml and put it in META-INF of your WAR. Tomcat should pick up the context information for the JNDI data source from that.
    Everything is in the WAR, and you don't have any dependence on the server that way.
    %

  • 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

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

  • HttpClusterServlet and cluster JNDI tree

              Hello,
              Our ear is being deployed in a clustered environment. The ear contains a jar
              (multiple ejbs), a web app war, and a webservice war. The httpClusterServlet
              proxy is being run in a server outside the cluster, on port 80. When our servlets
              try to do a JNDI lookup for any of the ejbs, a Naming Exception is thrown. The
              URL for the InitialContext provider is using port 80. So I assume that the lookup
              request is going to the proxy server, which isn't aware of the cluster JNDI tree.
              Aside from moving the proxy inside the cluster (the server configuration is being
              controlled by another developer), is there anyway to resolve this? Changing the
              URL of the provider for the lookups would require knowing the ports of the cluster
              servers.
              Thanks,
              Bob
              

              Hello,
              Our ear is being deployed in a clustered environment. The ear contains a jar
              (multiple ejbs), a web app war, and a webservice war. The httpClusterServlet
              proxy is being run in a server outside the cluster, on port 80. When our servlets
              try to do a JNDI lookup for any of the ejbs, a Naming Exception is thrown. The
              URL for the InitialContext provider is using port 80. So I assume that the lookup
              request is going to the proxy server, which isn't aware of the cluster JNDI tree.
              Aside from moving the proxy inside the cluster (the server configuration is being
              controlled by another developer), is there anyway to resolve this? Changing the
              URL of the provider for the lookups would require knowing the ports of the cluster
              servers.
              Thanks,
              Bob
              

Maybe you are looking for

  • Mix of different runtime problems on a mac.

    Hi, I'm on a mac 10.3 and have no intentions of upgrading. When I try to start some demo's I get a lot of different errors, all as far as I can tell related to the JRE. I installed everything from the apple website: Java webstart 2.3.0 (modified the

  • Windows movie maker dose not seem to work with itunes music.

    Windows movie maker dose not seem to work with itunes music anymore. Hear is what happend in a nut shell. For reasons I can not explain I had to reinstall all my software on my Vista HP notbook. But I only had one why of saving my data music,photos.

  • What does "Upgrade Your Device" mean for a VZW customer?

    I had a LG Octane and "upgraded" to LG Cosmos at the end of my contract. The Octane does not have a camcorder but the Cosmos did. To me this was a "downgrade." I learned of this "downgrade" after I had the "upgraded" a few weeks. I believe Verizon's

  • Unload after sequence executes for Asynchrono​us VI

    Hello All,   I have a code module VI, which is reused repeatedly in my test sequence.  I run it asynchronously, perform some other test actions and then stop the VI (with TestStand Property Object calls).  Then I repeat this process several other tim

  • Preload looks better before?

    I tried to search keywords, but it turns up nothing... When loading RAW .NEF files: 1. First loads a blurry image preview 2. Then refreshes to a preload image like this: and then 3. loads a final preview like this: My question is...  Is there a way t