Weblogic and Tomcat

Discussions

EJB design: Weblogic and Tomcat

  1. Weblogic and Tomcat (4 messages)

    I'm trying to migrate a web application from Tomcat to Weblogic.

    Tomcats server.xml lets you configure system environmental variables with <Environment name="XXX" type= ...>

    What is the equivalent in Weblogic. I've tried searching dev2dev and the rest of the web but have hit a blank.

    Thanks

    Threaded Messages (4)

  2. Weblogic and Tomcat[ Go to top ]

    You have to set it up in the server starup script as a JVM variable:

    -Dmyvariablename=myvariablevalue

    This is in the JAVA_OPTIONS variable and you will find it in the startManagedWeblogic script.

    If you want application level variables for the webapp, then you probably know that you have to use <context-param> in the web.xml

    Do let us know if this addresses your question.
  3. Weblogic and Tomcat[ Go to top ]

    Hi

    Thought this was going to work, should have thought of it myself. Unfortunately I still get the same error:

    javax.naming.NameNotFoundException: While trying to look up handlerPackage in java:comp/env.; remaining name 'handlerPackage'

    Which tends to imply a JNDI issue. Until the developer gets in I can't tell you how he is trying to access 'handlerPackage' I'd assumed he was using
    System.getProperty which I guess would work with your suggestion.

    Just have to wait until I see the code.

    Thanks
  4. Weblogic and Tomcat[ Go to top ]

    Hello

    This does look like a JNDI issue, the code is


        protected static final String LOOKUP = "java:comp/env";
        protected static final String HANDLER_PACKAGE = "handlerPackage";
        protected Context initCtx;
        protected Context envCtx;

        initCtx = new InitialContext();
        envCtx = (Context) initCtx.lookup(LOOKUP);
            
        setHandlerPackage((String) envCtx.lookup(HANDLER_PACKAGE));

    So it looks like I need to configure weblogic with a JNDI entry for a string named 'handlerPackage'. Where do you do this?
  5. Weblogic and Tomcat[ Go to top ]

    Thanks for the post I've now figured this out.

    All that was needed was a env-entry in the web.xml

    Cheers