I use server glassfish and maven, I have many wars deploy and each one have their libraries. Many of them use same libraries and I want to extract this libraries out of the war. I try to put them in a folder /lib of the server and put provided scope on the dependency of the war, but this don't work fine because the server ask for more libraries and i have problem with other wars. Also I try with scope system but doesn´t work.
I was searching a solution in Internet and only find skinny wars.
¿There are a way to do it?
If I will create a ear with the commoms libraries could I referenced them from a war (or packaging the war in other ear)?
Thanks you very much.
Yes, if you create an EAR and but the WAR libraries into it, they could reference any library in the EAR's lib folder.
Why don't you package your .war files into an .ear and add shared libraries to the lib of the EAR project?
Related
I am currently working on an EAR application which has a WEB project and EJB project in it.
To work on eclipse with local set up i do so many build path setups and all.
All these buildpaths show up in .classpath of the project.
Now when i export the EAR and deploy on Server everything works on server.
My doubt is how does server know about my local system paths which are present in .classpath of my project.
Does it mean .classpath has no significance at runtime?
Please explain.
.classpath file is eclipse specific, it will not be bundled with the EAR. Eclipse uses it to set the classpath for the project.
An EAR has a well defined structure and Servlet container understands that structure, using it's knowledge it prods around in the EAR file and extracts classes to load in the runtime.
Obviously server doesn't have any knowledge of your local environment. An EAR (or WAR or JAR) file is a simple archive file (with some specification or the file order and all). You can unzip it using any utility (something like 7zip). Check the structure of the packed EAR, that will give you a better understanding of what goes to your server.
I have a web application which consist of JSP pages, Servlet and Consumes Web Services.
It also references apache axis and excel libraries.
Now I want to deploy my application directly in Weblogic server
How do i do that.Whcih archive shud i make WAR or JAR??
ALso how to ensures that it covers all the referenced libraries.
I have made my application in Jdeveloper, but I dont want to deploy it using Jdevelper..
I would package my solution as a .war file, containing all dependent .jar files.
That way your solution is self-contained. You can deploy to an app server containing other apps with their own versions of your libraries (dependent or developed). If you put the dependent jars directly into the app server (as you can do), then you're forcing those versions on all applications deployed, and that could well cause you grief.
The downside is that your developed .war file can become sizable. It's not normally a major problem, and I wouldn't worry about it until it's identified as an issue.
A JAR-file cannot contain a JAR-file, so that option is out. Since you mention JSPs and servlets a WAR would seem the appropriate option, although an EAR with a WAR and several JARs could also be a way forward...
Cheers,
Consider a WAR with your JAR files in WEB-INF/lib. Or, create an EAR with APP-INF/lib folder.
I really apologize if this is a silly question.
I have a tomcat server running on a unix machine. I want to use the HTTPClient library. Does it come pre-bundled with tomcat or do you need to install it?
If people say to just add it to your class path. Should I download the source or the binary from here:
http://hc.apache.org/downloads.cgi
Once downloaded is there a way to auto install it using a .tar.gz as I think I have done this in the past. If not is it just a case of putting the folder on the drive and adding it to the classpath?
TIA
Each web application is supposed to package its own dependencies inside the deployable WAR file. It is an ill-advised practice to extend Tomcat's global library with any library an application might need.
On the WAR building front, the common practice you should stick to is not to manage dependencies on your own; it quickly turns into a nightmare. Configure your project with Maven , which will both manage the dependencies and build the WAR for you.
Just look for httpclient....jar file in the Tomcat directory. If there is none there, then put it inside the lib directory :)
You should download the appropriate jar file. It contains portable library code. Once placed in the classpath, Tomcat will find it. Tomcat directory has a lib subdirectory. This is global classpath part for all web applications.
I would like to get a help from you all. The below is the issue I am currently facing with.
I have added a reference of WAR shared library in weblogic-application.xml of EAR file.
In EAR, I do have a ejb module which has "library-directory" tag in application.xml. I want ejb module to refer jar files in shared library but it looks for jar files in lib folder of EAR.
In lib folder of EAR, jar files are not available but the jars are available in WAR shared library.
How to resolve this issue and make the ejb module of EAR refer the jars of WAR shared library.
Please add a comment if the problem is not completely understandable.
Many thanks in advance for your help!
Try defining the jars you need as modules in application.xml. Something like:
<module>
<java>pathToWarLib/needed.jar</java>
</module>
I have a java web project in eclipse and want to define a tomcat server.
It seems that in the tomcat server I must define again my classpath. How can I tell tomcat to just use the classpath from my project (shouldn't this be obvious?).
Unfortunately my jars are scattered all around and it is an headache to add them one by one to my tomcat configuration and maintain this.
Here you go :
Run -> Run Configurations... -> Classpath
You don't have to tell tomcat to look for jars scattered all around the places. This can be easily taken care by eclipse. Configure your eclipse build path properly. Create Libraries (in eclipse) and group jar together. Try to export the war and check if eclipse is packaging all the required jars in WEB-INF/lib.
No, Tomcat and web apps have a pretty well-defined CLASSPATH. You shouldn't have to specify anything if you package your app properly:
All the packages and .class files in WEB-INF/classes are in CLASSPATH.
So are all the JARs in WEB-INF/lib
You should figure out how to put your JARs in the right place - that's WEB-INF/lib of your WAR file. Maybe Ant or Maven can help you.