aspose file tools*
The moose likes JBoss/WildFly and the fly likes Need to access Java methods and javascript functions in a WAR file from another WAR Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Need to access Java methods and javascript functions in a WAR file from another WAR" Watch "Need to access Java methods and javascript functions in a WAR file from another WAR" New topic
Author

Need to access Java methods and javascript functions in a WAR file from another WAR

Baranidharan Ramakoti
Greenhorn

Joined: Aug 14, 2007
Posts: 19
I am having two WAR Files.

The first one contains a javascript and some utility Java methods along with the View Layer JSP.

Second one contains only the Web UI with some business logic for User Interface.

Both the WAR files are there in the same server.

I need to access the Java utility methods and javascript that is present in the first WAR from the second WAR file.

I cannot add the first WAR as a project reference in the second WAR and put it as a single WAR, as the requirement is strictly to deploy each WAR file separately

Can I use context path and access the Java Utility functions? is it possible to use the same method for getting the Javascript functions?

Can anyone suggest any method to access the Javascript functions and Java methods in the first WAR File?


Thanks,
Barani
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10048
    
163

Doesn't look anything specific to JBoss. Servlets forum perhaps is a better place, but i don't understand what you mean by "need to access". What kind of access? You have want to refer to the java classes packaged in a different war file? If yes, then why not package those classes in a jar and then include them in both WAR1 and WAR2?

I'll let this thread stay here for sometime, because i am not sure where this one fits best.


[My Blog] [JavaRanch Journal]
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5823
    
    7

Baranidharan Ramakoti wrote:I need to access the Java utility methods and javascript that is present in the first WAR from the second WAR file

This is not possible - code external to a WAR file cannot view anything within that WAR file (in your case, the first WAR cannot use anything that is in the second WAR).

You will have to do as Jaikiran suggests:
Jaikiran wrote: package those classes in a jar and then include them in both WAR1 and WAR2


JBoss In Action
 
Don't get me started about those stupid light bulbs.
 
subject: Need to access Java methods and javascript functions in a WAR file from another WAR