OC4J- NamingException: Not in an application scope

I have a JMS program(ResourceAdapter) which I am deploying on OC4J 10g (10.0.3.0.0) .
The program first creates InitialContext object and and then looks for the JMS connection factory and JMS queue in the "start" method of resource adapter. When I deploy this program everything works fine first, but later when I bounce oc4j, I start
getting "javax.naming.NamingException: Not in an application scope"
exception. Can someone suggest me what could be causing this?
I have tried restarting the oc4j with userThreads option but it doesn't help.
Program code:
try{
mContext = new InitialContext();
System.out.println("**************1**********");
mQueueCF =
(QueueConnectionFactory)mContext.lookup("ojmsjra/MyQCF");
System.out.println("**************2************");
mQueue= (Queue)mContext.lookup("ojmsjra/QUEUE");
System.out.println("**************3*********");
}catch(Exception ex){
ex.printStackTrace();
After oc4j is restart only "**1**" gets printed and the following exception(lookup fails)
04/09/27 15:56:15 javax.naming.NamingException: Not in an application scope - start Orion with the -userThreads switch if using user-created threads
04/09/27 15:56:15 at com.evermind.server.PreemptiveApplicationContext.getContext(PreemptiveApplicationContext.java:29)
04/09/27 15:56:15 at
com.evermind.naming.FilterContext.lookup(FilterContext.java:127)
04/09/27 15:56:15 at
com.evermind.server.PreemptiveApplicationContext.lookup(PreemptiveApplicationContext.java:48)
04/09/27 15:56:15 at
javax.naming.InitialContext.lookup(InitialContext.java:347)
04/09/27 15:56:15 at
oracle.panama.messaging.driver.DriverResourceAdapter.<init>(DriverResourceAdapter.java:40)
04/09/27 15:56:15 at
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
04/09/27 15:56:15 at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
04/09/27 15:56:15 at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
04/09/27 15:56:15 at
java.lang.reflect.Constructor.newInstance(Constructor.java:274)
04/09/27 15:56:15 at java.lang.Class.newInstance0(Class.java:306)
04/09/27 15:56:15 at java.lang.Class.newInstance(Class.java:259)
04/09/27 15:56:15 at
com.evermind.server.connector.deployment.ConnectorArchive.createJavaBeanInstance(ConnectorArchive.java:462)
04/09/27 15:56:15 at
com.evermind.server.connector.deployment.ConnectorArchive.start(ConnectorArchive.java:360)
04/09/27 15:56:15 at
com.evermind.server.Application.initConnectors(Application.java:444)
04/09/27 15:56:15 at
com.evermind.server.Application.postInit(Application.java:681)
04/09/27 15:56:15 at
com.evermind.server.Application.setConfig(Application.java:201)
04/09/27 15:56:15 at
com.evermind.server.Application.setConfig(Application.java:170)
04/09/27 15:56:15 at
com.evermind.server.ApplicationServer.initializeApplications(ApplicationServer.java:1708)
04/09/27 15:56:15 at
com.evermind.server.ApplicationServer.setConfig(ApplicationServer.java:1412)
04/09/27 15:56:15 at
com.evermind.server.ApplicationServerLauncher.run(ApplicationServerLauncher.java:93)
04/09/27 15:56:15 at java.lang.Thread.run(Thread.java:536)

Gedomir,
Thanks for the reply. But unfortunately it did not work. I was using the default initial context. I tried setting the properties as well. Even then it did not work.
I am trying this with oc4j_extended.
Thanks again.

Similar Messages

  • Facing error as Not in an application scope - start Orion with the -userThr

    hi all,
    iam facing this error when an jsp which is in Oracle portal(emebedded in iframe code) is updating a flag in database through a datasource configured on portal side.
    Naming Service=Not in an application scope - start Orion with the -userThreads switch if using user-created threads
    regards,
    Ravi

    I encounter the same issues when using the TimerTask to access the JNDI tree. I have found success when I move my business logic to an EJB and call my EJB from my TimerTask. It's a bit more work, but not much. The EJB inherits it's identity based on it's configuration and has no trouble accessing the JNDI tree whenever it's called. Try this and see if your problem doesn't go away.
    Hope this helps,
    Perry Tew

  • Application scope java beans not behaving....

    I am using WL 5.1, sp8, on NT....
              I am running jsp code that declares java beans of application scope....
              However, it doesn't appear to be resolving the application scope
              properly, it seems to instantiate a new Bean each time I go to
              a new page within the same application....
              One thing I am not clear on, is whether I have properly configured
              the WebApp....I have just been assuming that all pages within
              the same path sub-directory are of the same application, but that
              doesn't appear to be working....
              I haven't found any weblogic.properties settings for defining WebApps,
              that will share application scope, etc....
              I assume there is a simple answer here, I appreciate any help...
              Thanks,
              Jason Rosenberg
              

    Jason,
              WLS 5.1.0 is up to service pack level 12 now, which you should go to
              http://support.bea.com/welcome.jsp and login to download from the "Supports
              Download" section. Note that you need to be a paying customer to see this
              section. After applying sp12 you should take a look at our web app docs
              here http://bernal.beasys.com/release/docs51/classdocs/webappguide.html for
              instructions on setting up a web app and registering it in wls 5.1.
              "Jason Rosenberg" <[email protected]> wrote in message
              news:[email protected]...
              > I am using WL 5.1, sp8, on NT....
              >
              > I am running jsp code that declares java beans of application scope....
              >
              > However, it doesn't appear to be resolving the application scope
              > properly, it seems to instantiate a new Bean each time I go to
              > a new page within the same application....
              >
              > One thing I am not clear on, is whether I have properly configured
              > the WebApp....I have just been assuming that all pages within
              > the same path sub-directory are of the same application, but that
              > doesn't appear to be working....
              >
              > I haven't found any weblogic.properties settings for defining WebApps,
              > that will share application scope, etc....
              >
              > I assume there is a simple answer here, I appreciate any help...
              >
              > Thanks,
              >
              > Jason Rosenberg
              >
              >
              >
              >
              >
              >
              >
              

  • Application scope variables ... an easier way or not ?

    Instead of sharing application scope variables through the
              servletContext()/application I am using a normal singleton class (or maybe
              static class) to share all my application varaiable. It works fine and it
              takes a lot less code to write.
              It seamed logical to do this a static classes or singletons are shared
              within a single servletContext/application (which there seems to be only one
              per WL instance anyway). (singleton is quite nice pattern coz. all
              jsp:useBeans with the application scope are by definition singletons)
              Has anoyne tried something similar or maybe know of the problem with this
              approach. I assume that server will never reinitialise application level
              variables ...... hope the assumption is correct. ....
              

    When you specify application scope, the JSP stores/retrieves the value
              into/from the servlet context. You may already know this, but it sounded
              like what you thought you were somehow avoiding.
              Cameron Purdy
              http://www.tangosol.com
              "Bohinc D" <[email protected]> wrote in message
              news:[email protected]..
              > Instead of sharing application scope variables through the
              > servletContext()/application I am using a normal singleton class (or maybe
              > static class) to share all my application varaiable. It works fine and it
              > takes a lot less code to write.
              >
              > It seamed logical to do this a static classes or singletons are shared
              > within a single servletContext/application (which there seems to be only
              one
              > per WL instance anyway). (singleton is quite nice pattern coz. all
              > jsp:useBeans with the application scope are by definition singletons)
              >
              > Has anoyne tried something similar or maybe know of the problem with this
              > approach. I assume that server will never reinitialise application level
              > variables ...... hope the assumption is correct. ....
              >
              >
              >
              

  • Will the Application Scope be shared across the cluster in a multi-node OC4

    Hi,
    I have the following requirement:
    Users of the application can only have single (browser) session. When a user who already has a session connects again, he should no longer be allowed to access the older session.
    My proposed implementation is:
    -     After successful login – possibly using a Session Listener - an entry is made in a HashMap UserSessions that lives in the application scope. Key is the username, value is the session id (HttpSession.getId()).
    -     For every request, using a ServletFilter, we check whether the session is still in the UserSessions HashMap for the current user. If a new session has been created for the same user, the session id for that new session is in the UserSessions map and the servletfilter will not find the session. In that case, the filter should invalidate the session and forward to the user to an error page.
    However, the application will run on a multi-node OC4J cluster. I am starting to wonder:
    Will the Application Scope be shared across the cluster in a multi-node OC4J environment?
    I know session state can be shared. But what application state/scope?
    Does anyone know? Do I have to do anything special in the cluster or the application to get this to work?
    Thanks for your help.
    Lucas

    gday Lucas --
    Application scope is not replicated across JVM boundaries with OC4J.
    I'm sure this used to be described in the doc, but I can't find it now from a quick scan.
    If you wanted to use this type of pattern, you could look to use a Coherence cache as distribution mechanism to share objects across multiple JVMs/nodes.
    -steve-

  • Embedded JMS/OC4J issue while running an application in Jdeveloper 10.1.3.2

    Hi,
    I am facing an issue while running an application on my laptop.I downloaded Jdeveloper 10.1.3.2.Installed Jheadstart along with that.
    Created a new application specified in HR demo.When I run the application I get following messages,After that it does not show my application pages.It does not even open browser window.
    [waiting for the server to complete its initialization...]
    Aug 29, 2007 6:01:47 PM com.evermind.server.jms.JMSMessages log
    INFO: JMSServer[]: OC4J JMS server recovering transactions (commit 0) (rollback 0) (prepared 0).
    Aug 29, 2007 6:01:47 PM com.evermind.server.jms.JMSMessages log
    INFO: JMSServer[]: OC4J JMS server recovering local transactions Queue[jms/Oc4jJmsExceptionQueue].
    07/08/29 18:01:55 Oracle Containers for J2EE 10g (10.1.3.1.1) initialized
    When I delete persistnce directory files under embedded oc4j (specifically jms.state), It logs following messages.But it does not run my application pages and not even open browser window to display some error.
    [Starting OC4J using the following ports: HTTP=8988, RMI=23891, JMS=9227.]
    C:\jdevstudio10132\jdev\system\oracle.j2ee.10.1.3.40.66\embedded-oc4j\config>
    C:jdevstudio10132\jdk\bin\javaw.exe -client -classpath C:jdevstudio10132\j2ee\home\oc4j.jar;C:jdevstudio10132\jdev\lib\jdev-oc4j-embedded.jar -Xverify:none -XX:MaxPermSize=256m -DcheckForUpdates=adminClientOnly -Doracle.application.environment=development -Doracle.j2ee.dont.use.memory.archive=true -Doracle.j2ee.http.socket.timeout=500 -Doc4j.jms.usePersistenceLockFiles=false oracle.oc4j.loader.boot.BootStrap -config C:\jdevstudio10132\jdev\system\oracle.j2ee.10.1.3.40.66\embedded-oc4j\config\server.xml
    [waiting for the server to complete its initialization...]
    07/08/29 18:06:16 Oracle Containers for J2EE 10g (10.1.3.1.1) initialized.
    I tried by creating another standalone application with simple html page, it throws same logs and does not show up browser window.I even tried with Jdeveloper 10.1.3.3, but still same issue .
    can you please throw some light on this issue and any suggestion for resolutions.
    Thanks.

    Can someone throw somelight on this issue?
    I posted the same issue in Jdeveloper forum but did not receive any reply .appreciate your suggestions.
    Thanks
    Sekar.

  • JMS/OC4J issue while running an application in Jdeveloper 10.1.3.2/10.1.3.3

    Hi,
    I am facing an issue while running an application on my laptop.I downloaded Jdeveloper 10.1.3.2.Installed Jheadstart along with that.
    Created a new application specified in HR demo.When I run the application I get following messages,After that it does not show my application pages.It does not even open browser window.
    [waiting for the server to complete its initialization...]
    Aug 29, 2007 6:01:47 PM com.evermind.server.jms.JMSMessages log
    INFO: JMSServer[]: OC4J JMS server recovering transactions (commit 0) (rollback 0) (prepared 0).
    Aug 29, 2007 6:01:47 PM com.evermind.server.jms.JMSMessages log
    INFO: JMSServer[]: OC4J JMS server recovering local transactions Queue[jms/Oc4jJmsExceptionQueue].
    07/08/29 18:01:55 Oracle Containers for J2EE 10g (10.1.3.1.1) initialized
    When I delete persistnce directory files under embedded oc4j (specifically jms.state), It logs following messages.But it does not run my application pages and not even open browser window to display some error.
    [Starting OC4J using the following ports: HTTP=8988, RMI=23891, JMS=9227.]
    C:\jdevstudio10132\jdev\system\oracle.j2ee.10.1.3.40.66\embedded-oc4j\config>
    C:jdevstudio10132\jdk\bin\javaw.exe -client -classpath C:jdevstudio10132\j2ee\home\oc4j.jar;C:jdevstudio10132\jdev\lib\jdev-oc4j-embedded.jar -Xverify:none -XX:MaxPermSize=256m -DcheckForUpdates=adminClientOnly -Doracle.application.environment=development -Doracle.j2ee.dont.use.memory.archive=true -Doracle.j2ee.http.socket.timeout=500 -Doc4j.jms.usePersistenceLockFiles=false oracle.oc4j.loader.boot.BootStrap -config C:\jdevstudio10132\jdev\system\oracle.j2ee.10.1.3.40.66\embedded-oc4j\config\server.xml
    [waiting for the server to complete its initialization...]
    07/08/29 18:06:16 Oracle Containers for J2EE 10g (10.1.3.1.1) initialized.
    I tried by creating another standalone application with simple html page, it throws same logs and does not show up browser window.I even tried with Jdeveloper 10.1.3.3, but still same issue .
    can you please throw some light on this issue and any suggestion for resolutions.
    Thanks.

    I am also facing the same issue on my laptop. I searched for forum but no luck.
    appreciate if anybody can throw some light on this.

  • Java.lang.IllegalStateException:  bean  not found in "request" scope

    In jsp,I use javaBean,the statement is following:
    <jsp:useBean id="collectionBean" scope="request" type="view.CollectionBean"/>
    but ,in runtime,there exist following mistakes:
    java.lang.IllegalStateException: bean "collectionBean" not found in "request" scope
         at basicContentSearch.jspService(basicContentSearch.jsp:8)
         [SRC:/basicContentSearch.jsp]
         at com.orionserver[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:349)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:509)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:413)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:778)
         at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:317)
         at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790)
         at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.run(HttpRequestHandler.java:270)
         at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
         at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
         at java.lang.Thread.run(Thread.java:534)
    why?
    Please everyone tell me if you can,thanks a lot.

    I believe, if it is the first time you are referring to the bean, you must use the class attribute rather than type:
    <jsp:useBean id="collectionBean" scope="request" class="view.CollectionBean"/>The type is used to change how the bean is referenced, for instance, in regular Java you might do this:
    // The Type                 The Class
    java.util.List myList = new java.util.ArrayList();In use bean you would do this:
    <jsp:useBean id="myList" class="java.util.ArrayList" type="java.util.List"/>

  • Updating Beans in Application Scope

    The problem is that i dont know how to update a bean in an application scope:
    in EA4 i use this instruction to update a bean property:
    // get the faces context
    FacesContext facesContext = FacesContext.getCurrentInstance();
    // update a property in application scope
    (Util.getValueBinding("BeanName.propertyName")).
    setValue(facesContext,"text");
    and it worked ok in jsp:
    <h:output_text valueRef="BeanName.propertyName" />
    Now in version 1.0 i wrote:
    Application app = facesContext.getApplication();
    errorAplicacion = (ErrorAplicacion)app.createValueBinding("#{beanName}").
    getValue(facesContext);
    How should i update this value in application scope to be used in the jsp ?
    I use in jsp:
    <h:output_text value="#{BeanName.beanProperty}"/>
    But i receive in logs:
    Expression BeanName.beanProperty does not follow the syntax #{...}
    And the result is null
    Thanks a lot
    German

    If you are quoting your 1.0 code literally, you've got a case mismatch between "#{beanName}" when you create the value binding expression and "#{BeanName}" in the JSP page. As with most things in Java, the names are case sensitive.
    Craig McClanahan

  • 300 requests per hour reading from Application scope Good/Bad idea

    I am saving some html in application scope & reading with
    <cflock readonly.
    Will it be a problem if more than 5 requests are made per
    second?
    Does deadlocks occurs with readonly-cflock?
    Thanks

    While creating/changing application scope variables in a
    lock, I think there must be an exclusive lock. You must be careful
    not to set any shared variable such as application inside a read
    only cflock tag.
    I also would suggest to check the usage of Application.cfc
    and onApplicationStart method. You can set application default
    variables and constants in onApplicationStart method in your
    Application.cfc.

  • Application scope problem in a JSP

    Hi,
    I try to store an object with the following code :
    getServletContext().setAttribute("application", app);
    Later I want to access this object from a JSP with :
    <jsp:useBean id="application" scope="application" class="de.skillworks.SWApp"/>
    that dosn't work !? I can not debug my application because the jsp is initializing my app object new. When I try in my JSP :
    SWApp app = (SWApp)pageContext.getServletContext().getAttribute("application");
    it works fine. I get my object which I have store in my servlet.
    In a Tomcat environment my code is working just the Jdeveloper has a problem with it.
    null

    Andy -
    The web-to-go server has difficulty dealing with sessions. Testing in Tomcat is a good alternative, and this is resolved in Oracle9i JDeveloper.
    Hope this helps,
    Lynn

  • CreateJaznUser: import oracle.security.jazn.oc4j.JAZNUserManager not found

    Hello!
    I need to create a function that could allow Application users to change their passwords.I use a JAZN authentication in the application. So, I decided to analyze contents of the CreateJaznUser application first. But compilation of this application breaks by the next error:
    import oracle.security.jazn.oc4j.JAZNUserManager not found
    Could you advise me, what an additional libraries I must add to the CreateJaznUser application and where can I download them from?
    Thanks in advance.

    OID 3.0.1.0 is the latest product release to public. I did add the Install data to allow it to work. I see the data in OID but when I connect with jazn I get error.
    java -jar jazn.jar -shell
    JAZN:> ls
    realms policy
    JAZN:> cd realms
    JAZN:> ls
    String index out of range: 32
    JAZN:> cd ../policy
    JAZN:> ls
    JAZN:> exit
    JAZN:>
    It does not error on policy dirictory but it does on the realm side. If I watch the tcp packets it is working.

  • Action method called in standalone OC4j but not OAS

    I am setting up a test environment on Solaris x86 machine and have run into an odd issue concerning an action method being called which seems to be an issue for Oracle Application Server (OAS) but not an issue for stand alone OC4J.
    The application is using Java 5, Spring 2.5, Java Servlet 2.3, Struts 2, iBatis 2.2, Sitemesh, and Display Tag to name some of the parts that are in play.
    The platform is a Sun Fire X2100 server running Solaris 10 OS (64-bit). The application server version is 10.1.3 (Solaris x86, 64-bit) connecting to Oracle database server 10.2.0.2.0 (Solaris x86, 32-bit). The stand alone OC4J that I used for comparison was 10.1.3.4.0 (also run under the same Solaris machine but not while the application server was running).
    Going from one JSP that contains a list of items ("authority ids" in this case) to another JSP which displays detailed information about one item (chosen by clicking on a hyperlink in the list), it appears that the setter action method (which sets the 'sid' property) does not get called under OAS so the page displays empty fields. Same code running under the stand alone OC4J, the setter method does get called and the fields are populated on the details page. In both cases, both deployments are hitting the same database and the data is successfully retrieved from the database (into the action class). In both cases, the parameter that is set by this action method is present in the URL for the detail page.
    Snippet of code from the JSP that loads the authority ID list (and passes the sid in the URL):
    <display:table name="authorityIdList" cellspacing="0" cellpadding="0" requestURI=""
        defaultsort="1" id="authorityIdTypes" pagesize="25" class="table" export="true">
        <s:url id="editurl" action="editAuthorityId" includeContext="false">
          <s:param name="redirectUrl" value="%{returnUrl}"/>
        </s:url>
        <display:column property="fieldName" escapeXml="true" sortable="true" titleKey="authorityIdType.fieldName"; style="width: 34%" url="${editurl}"
          media="html csv xml excel pdf" paramId="sid" paramProperty="sid"/>Snippet from the authority ID detail form where the sid should be populated:
    <tr style="display: none"><td>
          <s:hidden key="sid"/>
            <s:hidden name="redirectUrl"/>
        </td></tr>Snippet from the action class that contains the setter for the sid property:
      public Integer getSid() {
            return sid;
      public void setSid(Integer sid) {
            this.sid = sid;
      }Snippet from the resulting html page for the list includes the sid for each item in the list.
    <td style="width: 34%">DODAAC</td>
    <td style="width: 25%">DODAAC</td></tr>
    <tr class="even">
    <td style="width: 34%">DODAAN</td>
    <td style="width: 25%">DODAAN</td></tr></tbody></table>Under the stand alone OC4J, the setter method is called, so the sid is populated (and the item detail data from the action is retrieved and displayed).
    Snippet from the resulting detail html page from the stand alone OC4J:
        <tr style="display: none"><td>
             <input type="hidden" name="sid" value="1" id="saveAuthorityId_sid"/>
            <input type="hidden" name="redirectUrl" value="http://system01:8888/MyApp/admin/authorityIdTypes.html"; id="saveAuthorityId_redirectUrl"/>
        </td>Notice that the sid value as well as the redirectUrl value are populated under standalone OC4J.
    Under OAS, the setter method is not called, so the sid is not set (and none of the other item detail fields are populated).
    Snippet from the resulting detail html page from OAS:
       <tr style="display: none"><td>
             <input type="hidden" name="sid" value="" id="saveAuthorityId_ sid"/>
            <input type="hidden" name="redirectUrl" value="" id="saveAuthorityId_redirectUrl"/>
        </td>Notice that the sid value as well as the redirectUrl value are empty under OAS.
    Any ideas on what I need to change in OAS configuration to make this work under OAS (if this is a configuration issue)?

    I found another case that may be clearer.
    A confirmation page on the application server shows that the redirect url is not being populated:
    <form id="confirmation" name="confirmation" onsubmit="return true;" action="/MyApp/admin/confirmation.html" method="post"><table class="wwFormTable">
         <input type="hidden" name="redirectUrl" value="" id="confirmation_redirectUrl"/>
       <tr>
        <td colspan="2"><div align="right"><input type="submit" id="confirmation_continue" name="method:proceed" value="Continue"/>
    </div></td>
    </tr>
    </table></form>Same code running on the standalone OC4j does populate the redirect URL:
    <form id="confirmation" name="confirmation" onsubmit="return true;" action="/MyApp/admin/confirmation.html" method="post"><table class="wwFormTable">
         <input type="hidden" name="redirectUrl" value="http://system01:8888/MyApp/admin/users.html" id="confirmation_redirectUrl"/>
       <tr>
        <td colspan="2"><div align="right"><input type="submit" id="confirmation_continue" name="method:proceed" value="Continue"/>
    </div></td>
    </tr>
    </table></form>So it appears that the application server is having problems passing parameters to pages.
    I have been digging through Oracle documentation, but I haven't found any clues on how to fix the issue.
    Any help would be appreciated.
    Thanks,
    - David

  • Accessing Application Scope from an EJB

    I'm not sure of the best way of doing this:
    The set up:
    We have a rather large J2EE application that is composed of only servlets and JSPs at the moment (When the application began development EJB was in its infancy and not feasible for the development of the app). Some of the new deployments of the app involve distributed webserver over 4 JVMs and 2 machines. When a user connects the servers load balancing decides which particular JVM they should be connected to. We perform large data caching into the servlet application scope to avoid having to access the database every time a change is made by a user to certain tables in our database. The data caches are stored in hashtables in the servlet application scope.We seem to have no way to determine what other JVMs are running or which JVM a user is currently connected to.
    The problem:
    Apparently the application scope is for a particular JVM. This means that when a user makes a change to a data cache the change doesn't effect users in the other 3 JVMs of the application, only the users who, due to load balancing, happened to be connected to the same JVM as the one where the change was made.
    Our possible solution:
    We were thinking that we could set up a queue (such as MQSeries from IBM) and any time a change is made to one of these data caches put a message on the stack saying that the particular table had been updated. Then a MDB would be listening asynchronously and digest the message from the Queue and recache the tables from the database.
    So here are my questions:
    1. Would this work? Would putting a MDB in the EJB Container give each JVM the MDB in the first place, or would this mean it would pick one of the JVMs to deploy the MDB on and still not fix our problem.
    2. If this does work, how do I access the hashtables stored in the Servlet Application scope from the MDB. I can't seem to find any method available to the MDB (or any EJBs for that matter) that can access the servlets Application scope.
    3. Is this the best way to do this? Or is there a better way to share data between seperate JVMs that I don't have a URL to (It's all ambiguous and handled by the server as to which JVM actually gets the connection.)
    Just in case this is needed:
    We are running IBM WebSphere 5 Application Server and the database could be anything from DB2 to Oracle.
    Thanks in advance for any possible help.

    You wont get any api for directly accessing Servlet application objects from any ejb. I dont think MDB either solves your problem directly. Indirectly you can place a request to some servlet (should be there for each JVM and web application ) and update your application scope variable. I would suggest you to cache the data in database if the size of cache is large. otherwise any open caching tools may help you.

  • A struct in the application scope will be lost / damaged

    Hello,
    we have a strange problem with our CFMX 7,0,2, perhaps
    somebody can help?
    In the application.cfm a xml-file will be loaded, parsed and
    saved as a struct in an application variable. This will take place
    only if the struct isn't defined. We set the application variable
    exclusive by cflock. After some times, the struct or an element of
    the struct will be lost. At this time, we get "Null Pointer
    Exceptions".
    java.lang.NullPointerException
    at coldfusion.xml.XmlNodeMap.size(XmlNodeMap.java:656)
    at coldfusion.runtime.Struct.StructCount(Struct.java:172)
    at coldfusion.runtime.CFPage.StructCount(CFPage.java:4133)
    Some questions:
    - Why is the struct / the elements in the application scope
    are lost? The application timeout is set to 2days, and other
    application variables aren't lost.
    - Why will cftry / cfcatch not work in this case?
    What can we do?
    Kind regards
    Karl-Heinz

    you can use the isDefined function in the onRequestStart
    function in Application.cfc
    I have never had an application scoped variable / object get
    lost or damaged in the way that you're describing.
    are you loading it in the onApplicationStart function of
    Application.cfc ? that would be a good place to do it.
    oh, actually, I did have a contractor who assigned the
    application name dynamically, I think the name contained the
    current date so each time the date would change the application
    would change - you might want to make sure that is not happening to
    you.

Maybe you are looking for