Ear and war for jsf1.1 with tomahawk and ajsx4jsf - java

I am developing an application with ejb and jsf with tomahawk and ajax4jsf and jsf-api jsf-impl jars at WEB-inf/lib folder..
I have put other jars like iText and POI jars at ear root and it works fine with manifest in war pointing at the ear root..
Do i need to put jsf-api.jar at ear root?
What other jars should I put in WEB-INF/lib folder..(Should I put 'commons' jar in WEB-INF/lib or at EAR root..? )

It depends on your runtime environment, what libraries you need. What webserver/container do you use? Because of the different web- and application server, there are different libraries provided by the vendors. Sometimes you have to configure your own jars, sometimes not. I think with Apache Tomcat 7 you have to add the JSF files to your lib directory. But by using JBoss or Glassfish you don't need it, because they are Java EE 6 (Web Profile) certified. By the way, what JSF, EJB and a4j version do use? It looks like some old stuff. I guess you are using an application server, because of EJB. In that case you don't have to add the libraries of JSF and Apache Commons, because the AS will provide it usually.
I would recommend to create a Maven Project. It is not so difficult at all and you can define the libraries in one XML file.

Related

Deploying *.ear file onto Liferay (JBoss) - portlets not exposed

I'm trying to deploy .EAR on Liferay (running on JBoss), I put .EAR to JBoss deployments folder. My structure is:
lib (some libraries/modules)
META-INF
WAR (it contains all Liferay specific libraries from auto deploy)
JAR
According to console, deploy is correct. JAR is running (I have some methods with Timers and they are working properly). But I don't see any portlets from WAR that I can add, but according to console WAR is deployed. They are simply not exposed to Liferay. I know that the .EAR is like a closed structure.
I am wondering how to make portlets available to Liferay?
I would appreciate any ideas, thank you.
Currently there is no standard way to deploy portlets (WAR) inside EAR. Liferay won't detect them. Your WAR with portlets must be deployed separately.

How to Deploy Java EE Project which reference external JAR files in weblogic

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.

Glassfish JSF Jars

I downloaded the zip version of Glassfish 3.1.2.2 and unzip it in my local directory.
When I try to add the following glassfish directory as a runtime library, it says there is no glassfish runtime.
I checked out the folder and I think it is missing some jsf jar such as jsf-impl..
How do I set this up? DO I really need to download some 3rd party jsf implmentation jars?
Thanks
I checked out the folder and I think it is missing some jsf jar such as jsf-impl.
The two JARs jsf-api.jar and jsf-impl.jar have since Mojarra 2.1.6 been merged into a single JAR javax.faces.jar. This was done so to be in line with general Java EE Maven rules. See also issue 2028.

Shared libraries between wars

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?

WAR vs EAR for web application with no EJB?

I have a Java EE web application that does not make use of EJBs. I am targeting Jetty/Tomcat for deployment some of the time and thus need a WAR packaging. However, I am also target JBoss and Websphere some of the time.
My understanding is that full-blown Java EE application servers can take either EAR or WAR formats. When would I use one over the other and why? I understand they are both standard compressed file formats and I have read 10 different snippets that try to explain them (including this one), but am no closer to understanding the pros and cons of each.
If you have only web modules - use WAR file.
If you have different Java EE modules - use EAR. Though you can deliver only web modules in EAR - there is no point in doing this (and you will need to do more complex deployment configuration)
The crucial point is if you need anything provided in an EAR file (which may contain said WAR file). If so, then it makes sense to deploy as an EAR.
It can also wire up some of the configuration you need to do manually in Tomcat etc. A typical example is the URL bound to the web application, where you need to override the default heuristic with a container specific configuration file for a WAR, but you can put it directly in the EAR configuration file.
Also, during development WARs can frequently be hotdeployed directly in exploded form, where EARs must be unpacked and deployed. For Glassfish from Eclipse the difference is quite noticeable.
In J2EE application, modules are packaged as EAR, JAR and WAR based on their functionality
If You are using only Servlet, JSP, GIF and HTML files. Then use .WAR
WAR:(Web ARchive) Web modules which contain Servlet class files, JSP
Files, supporting files, GIF and HTML files are packaged as JAR file
with .war (web archive) extension.
If you are using different different JAVA EE modules like (EJB + Servlet, JSP, GIF and HTML files + Other technology). Then use .EAR
EAR: (Enterprise ARchive) All above files (.jar and .war) are packaged
as JAR file with .ear (enterprise archive) extension and deployed into
Application Server.

Categories