File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JBoss and the fly likes Two ear, one application Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Products » JBoss
Reply Bookmark "Two ear, one application" Watch "Two ear, one application" New topic
Author

Two ear, one application

try catch
Greenhorn

Joined: Jul 14, 2004
Posts: 3
Hi All!!!
My company has already an application deployed as an ear. My boss has order me to develop an extension to this application. The problem is that he want this extension to be deployed as a separate ear but the first ear and the extension ear must appear as a single app to the client, wich must share the session context of the user. Is this possible? And if it is, there is someone may help me?

Thanks in advance!!
Nathaniel Stoddard
Ranch Hand

Joined: May 29, 2003
Posts: 1258
Wow. Beats me. Which server are you deploying to?


Nathaniel Stodard<br />SCJP, SCJD, SCWCD, SCBCD, SCDJWS, ICAD, ICSD, ICED
Scott Duncan
Ranch Hand

Joined: Nov 01, 2002
Posts: 363
If they are on the same server instance (e.g. running on the same virtual machine) you may have a shot at this (I have never tried it). The problem with something like this:

(The call in webapp2)

ServletContext ct = getServletContext().getContext("webapp1");
AnyObj obj = (AnyObj)ct.getAttribute("anyObj");

is that it will undoubtedly throw a ClassCastException since the 'anyObj' was loaded by the webapp1 class loader.

You may be able to specify classpath to this class on the JBoss start up command line or something like that. You'll have to try and let us know.

If they are running on different instances, your only option is to use an EJB.


No more rhymes! I mean it!<br /> <br />Does anybody want a peanut?
try catch
Greenhorn

Joined: Jul 14, 2004
Posts: 3
Thank to everybody for the replies!
I've resolved my problem and now I want to let you know the solution.

1. I've declared a login module in the file jboss-home/server/myserver/conf/login-config.xml. This module let me autenticate users against an Oracle db.

2. I've put in the jboss.xml file of any application will be part of my SSO environment, the element:
<security-domain>jaas:/MyDbModule</security-domain>

3. I've declared the sercurity constaint for every ejb-jar.xml, web.xml of all the applications partecipating in the SSO environment.

4. Enabling SSO in Tomcat 4.1 embedded in JBoss 3.2.3. This is realized, adding this simple element :

<Valve className="org.jboss.web.tomcat.security.SecurityAssociationValve"/>
<!-- SSO -->
<Valve className="org.jboss.web.tomcat.tc4.authenticator.SingleSignOn" debug="2"/>

in the file jboss-home/server/myserver/deploy/jbossweb-tomcat41.sar/META-INF/jboss-service.xml

5. The most important step wich has make me loss among two days, is the definition of a virtual host. With this step we also must declare that an application is part of a virtual domani in wich is activated the SSO. Only with this definition of belongig to a specified virtual domain, the SSO for an application is activated. To declare a virtual host, is quite simple. We must add the follow element next the <host> or <engine> element:
<Engine name="MainEngine" defaultHost="localhost">
<Logger className="org.jboss.web.tomcat.Log4jLogger" verbosityLevel="debug" category="org.jboss.web.localhost.Engine"/>
<Host name="localhost">
<Alias>sitWebApp</Alias>

next, for every application wich must belong to this virutal host (for wich we have activated SSO), we must declare, in the jboss-web.xml file, the follow element:

<virtual-host>sitWebApp</virtual-host>

in this way, for all the application belongig to sitWebApp, we will have the principal propagated (also in the ejb layer) in a manner that the statement:

sessionContext.getCallerPrincipal().getName()
return the name of the user autenticated in any of the application belonging to the sitAppWeb virtual domain.

Excuse me for my poor english (I'm italian). I hope (but I don't think it) this explanation was be sufficently clear.
If it didn't, please ask me!

Bye... Nico!
 
IntelliJ Java IDE
 
subject: Two ear, one application
 
Threads others viewed
websphere problems
Jar in the build path of web and EJB application
Best packaging and deployment strategy for web applications
CMP serialializable error, need your help!
deploy web query
IntelliJ Java IDE