This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JBoss/WildFly and the fly likes Possible to deploy a partially-expldoed WAR file? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Possible to deploy a partially-expldoed WAR file?" Watch "Possible to deploy a partially-expldoed WAR file?" New topic
Author

Possible to deploy a partially-expldoed WAR file?

Dave Alvarado
Ranch Hand

Joined: Jul 02, 2008
Posts: 436
Hi,

I'm using JBoss 5.1 AS on Mac 10.5.6 (Java 1.6). Is it possible to have a partially-exploded WAR deployment -- that is, have the WAR file, but then have the web.xml and/or jboss-web.xml live outside of it?

Thanks for your feedback, - Dave
m lk
Greenhorn

Joined: Dec 01, 2009
Posts: 1
Hi....

I am a stranger to SCJP.
Tell me some ideas to complete the certification succesfully.
Thank you....
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9962
    
163

m lk wrote:Hi....

I am a stranger to SCJP.
Tell me some ideas to complete the certification succesfully.
Thank you....

"m lk",

Please do not hijack threads. The right place for your question is here http://www.coderanch.com/forums/f-24/Programmer-Certification-SCJP. So please create a new thread in that forum. Also, please click on the "My Private Messages" link on top of this page, for a message from JavaRanch.


[My Blog] [JavaRanch Journal]
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9962
    
163

Dave Alvarado wrote:Is it possible to have a partially-exploded WAR deployment -- that is, have the WAR file, but then have the web.xml and/or jboss-web.xml live outside of it?

Thanks for your feedback, - Dave


No. As per the specification, the web.xml and the jboss-web.xml have their standard locations, which is within the WEB-INF of the .war.

What exactly are you trying? Maybe there's a different way of achieving that.
Dave Alvarado
Ranch Hand

Joined: Jul 02, 2008
Posts: 436
This relates to an older thread I had posted but the problem I'm trying to solve is I want to be able to use the same WAR file across dev/test/production environments but have different environment entries (<env-entry>) per each environment. Problem is, right now the only place I can see where to put these entries is the web.xml file, but then that would mean I would have a different WAR for each environment, which I want to avoid.

- Dave
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9962
    
163

You mean this one? http://www.coderanch.com/t/472412/JBoss/Strategy-configuring-app-differently-based

problem is, right now the only place I can see where to put these entries is the web.xml file, but then that would mean I would have a different WAR for each environment, which I want to avoid


With the approach suggested in that other thread, you will just have one web.xml for all environments, with something like this:


Then each environment would set the correct value as:

QA env (either through command line or within the run.bat/run.sh scripts):



Dev env (either through command line or within the run.bat/run.sh scripts):
Dave Alvarado
Ranch Hand

Joined: Jul 02, 2008
Posts: 436
That was a good suggestion but the team here does not want to alter the way we start our JBoss server and are also weary about other applications having access to those values. Do you know of a way that can be more file-based? I had come across something online called "GlobalNamingResources", which is supposed to be part of the server.xml JBoss configuration, but when I try and add it to mine I get XML validation errors. Sure wish this page -- http://www.jboss.org/file-access/default/members/jbossweb/freezone/docs/latest/config/globalresources.html -- would have had a bigger example.

- Dave
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9962
    
163

Dave Alvarado wrote:and are also weary about other applications having access to those values.

Do you know of a way that can be more file-based? I had come across something online called "GlobalNamingResources", which is supposed to be part of the server.xml JBoss configuration, but when I try and add it to mine I get XML validation errors. Sure wish this page -- http://www.jboss.org/file-access/default/members/jbossweb/freezone/docs/latest/config/globalresources.html -- would have had a bigger example.



I haven't looked at those configs, but it clearly states that:

These resources are listed in the server's global JNDI resource context.


Which means that other applications can access those values too. Isn't that what you are trying to avoid?
Dave Alvarado
Ranch Hand

Joined: Jul 02, 2008
Posts: 436
You are correct that I would like to avoid that ideally, but so I'm clear, when they say,

"server's global JNDI resource context"

is that referring to the server.xml file or the "GlobalNamingResources" element? Also, they go on to say that

The resources defined in this element are not visible in the per-web-application contexts unless you explicitly link them with <ResourceLink> elements

So doesn't that mean I can determine which applications have access to the environment variables and which do not?

Thanks for all your help, - Dave
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9962
    
163

I can see, how the explanation in that doc can be confusing. So here's what it's all about:

- The server has a "global" JNDI space which is accessible to applications within that server as well as outside that server (those are known as remote clients)
- Once any resource (/entry) is added to this "global" JNDI space, that resource becomes available to all the applications on that server.
- There also a "per-component"/"per-app" JNDI space on the server. Any resource (/entry) that needs to be added here, will have to be configured in the web.xml (or such similar metadata files).
- It's usually recommended that resources in the "global" JNDI space be accessed through a redirection from the "per-component"/"per-app" JNDI space. What this means is, if there's a resource at the global JNDI name "someglobaljndiname", then instead of looking it up using:


it's better to bind it to the per-app JNDI space (for ex: "somealias") and access it as follows:


The reason for doing this, isn't in the scope of this thread (however, we can discuss if you would want the details)

- The "per-app" namespace is not accessible outside the application. So "somealias" can't be accessed from outside the application, where it's configured. However, the "someglobaljndiname" will still be accessible from all other apps.

So the bottom line is - anything that goes in the global JNDI namespace, is available for all apps.

Dave Alvarado
Ranch Hand

Joined: Jul 02, 2008
Posts: 436
That was an outstanding explanation. Thanks. Although adding the entries would apply at a global level, I would like to do the proof of concept. However, when I add



as a child element of either the "<Server>" or '<Service name="jboss.web">' elements within my server.xml file, I get this error when I try and deploy my web application ...



Any ideas where I would add the "GlobalNamingResources" element? - Dave
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Possible to deploy a partially-expldoed WAR file?
 
Similar Threads
choosing the context a war is deployed to
Deployement problem
Trying to deploy a war file with datasources to JBoss
Starting Java App with no internet connection?
Putting/retrieving objects in JNDI with JBoss