Ok..I have solved my problem. I added a little bit to my MVC framework to handle web-app context forwarding.
 
As for your questions, you can use JNDI to share data between app servers. How exactly, I don't know..I read or someone told me that it can be done. EJB's are done in this  manner, and I'd imagine you can do it from servlets. I don't have the API in front of me, but look to see if there is a setAttribute() or something for JNDI. I think the Context or InitialContext classes have these methods. Other than that, each web-app has its own "memory" space in a single JVM. J2EE allows one (or more) EAR files to run in one application server on one JVM, and in each EAR file you can have one (or more) web apps running (and EJBs, etc). Each EAR I believe is a completely separate application, and each web-app in that ear is separate from other web-apps in that ear or in other ears deployed in the same JVM. Again, I think JNDI and perhaps the JVM Context are the only ways to share data between apps running in the same JVM. Although, if your working in a clusterable environment, I wouldn't program your app to expect data from within the same JVM. EJB 2.0 has added "local" EJBs so that if the app server sees the EJB being retrieved is in the same JVM, it can return a local reference and avoid the network hit.
 
As for deploying in one app server..I think that depends. First, what is your hardware limit? Second, does it make sense to deploy them in one server? For example, in my case, I am deploying 3 separate but somewhat related web-apps. It needs to be possible that a link from one web-app can traverse into another web-app. Therefore, it is absolutely required for me to deploy the 3 web-apps in the same container. Each can be clustered as needed. Infact, I only need to cluster the /inside web-app, as its the only one that really uses the session state. The /outside is mostly static, and the /admin is related to internal employees that is not necessary to cluster.  Infact, the /admin site can run completely on its own, but I can provide a connector from my /inside site to the /admin site should the logged in user have the right priveleges to access it.
 
HTH.
 
-----Original Message-----
From: Casey Helbling [mailto:[EMAIL PROTECTED]]
Sent: Monday, August 06, 2001 2:31 PM
To: Orion-Interest
Subject: Sharing Data Between web-apps and Appservers

 
Can you point me to where the spec talks about sharing data between web-apps.  We are dealing with some of the same issues also.  I didnt dig deep enough into the spec but was under the impression that there was ways to pass the data between apps.  I may be completely wrong.  What about between appservers?
 
Is it a good idea generally to try to deploy all your web-apps in one appserver or should you use multiple (instances) of the appservers.  I guess this is really more of a J2EE question than an orion question .... but maybe someone wants to give it a whirl.
 
Thanks.

Casey Helbling
 
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Duffey, Kevin
Sent: Monday, August 06, 2001 2:41 PM
To: Orion-Interest
Subject: RE: What happened to this mailing list???

Hi all,
 
Deploying 3 web-apps in one application in Orion; Outside, Inside and Admin. Outside is mostly static, with a login section. The login section takes the user to the Inside app by calling into it via a /inside/Login.do?command=Login (using the popular Struts MVC syntax). This all works.  Using Struts MVC (and even with my own), it appears that when trying to forward to a different web-app context, its not possible. At least not yet..could be my code. In MVC, the ControllerServlet running in one context, tries to forward to a resource. Almost always this is in the same servlet-context (web-app) as the ControllerServlet. In my case, I want a user to log out, which takes them to the outside index.jsp page again. The normal RequestDispatcher() is part of the Inside web-app context, so when it tries to forward to a /index.jsp, I would think the / would indicate the context to forward to. This doesn't appear to work. So then I tried using the ServletContext.getContext(url) call where the url is the same as the forwarding resource. Thus, to forward from any web-app to the outside "root" index.jsp page, I do something like:  getServletContext().getContext("/index.jsp").getRequestDispatcher("/index.jsp").forward(request, response);  This gets the right ServletContext of the root app. I have tested this by creating an object and setting it as an attribute in the /index.jsp, and in the ControllerServlet I get the ServletContext and look up the attribute (before trying to forward), and it finds it. So when using that ServletContext and trying to forward, its still not finding the page. I continue to get 404 not found errors.
 
My question is..is it possible to forward from one web-app to another? It appears to work when I go from the / to the /inside context just fine (at least it appears that on the JSP page using a href or form action url path of /inside/Action.do, it does work by calling into the /inside web-app). I can't imagine that deploying multiple web-apps limits you to not even forwarding to another web-app. I do know you can't share any data between web-apps, but being able to jump from one web-app to another via links and via forwarding should work..shouldn't it? The API isn't exactly clear on this..but I will look at it again.
 
Thanks.
 

Reply via email to