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.
Related
I am running a web application using Tomcat, JDK8 and Netbeans IDE (using ANT for build and IVY for dependency management).
I currently place JARs that need to be available to the JRE (servlet-api.jar, jsp-api.jar, el-api.jar, tomcat-dbcp.jar) in JAVA_HOME/jre/lib/ext.
I'm upgrading to a new JDK version (JDK17), which no longer has the JRE extensions folder. I'm wondering where I should place these JARs.
According to this post (and others I've seen), it is better practice to use a dependency manager and add these jars to your classpath anyway.
I currently use IVY to manage my dependencies and have customized my ANT build to add run-time dependencies to the WEB-INF/lib folder of the built WAR file.
However, I do not need the JARs I listed above to be available to my application at runtime, I need them to be available to the JRE. That is, I do not want the JARs (servlet-api.jar, etc.) to be in WEB-INF/lib of my built WAR file.
How can I do this?
Sharpening my final questions:
How can I make certain JARs/dependencies available to the JRE in Netbeans in my development environment?
How can I make certain JARs/dependencies available to the JRE in the built WAR file used on my production environment?
Am I correct in saying that these JARs need to be available to the JRE? All of the posts I've seen discuss compile-time vs run-time dependencies but it seems the case I'm describing is a different category of dependency. Is this correct?
I currently place JARs that need to be available to the JRE (servlet-api.jar, jsp-api.jar, el-api.jar, tomcat-dbcp.jar) in JAVA_HOME/jre/lib/ext.
That's not the best way to do things. See Is putting external jars in the JAVA_HOME/lib/ext directory a bad thing?
Note that the jre/lib/ext mechanism has been removed from newer versions of Java, so this will not work anymore if you use a newer version of Java. (This has been removed in JDK 9).
However, I do not need the JARs I listed above to be available to my application at runtime, I need them to be available to the JRE.
Why?
That is, I do not want the JARs (servlet-api.jar, etc.) to be in WEB-INF/lib of my built WAR file. How can I do this?
Why not? Putting the dependencies that your application needs in WEB-INF/lib is the normal thing to do in Java web applications. Why do you want to do things the non-standard way?
But: Some JAR files, such as servlet-api.jar, jsp-api.jar and el-api.jar are not supposed to be included in your application. Those JAR files define standard Java EE / Jakarta EE APIs and will be provided to your application at runtime by the application server (Tomcat, etc.) that you deploy your WAR file in.
You can add those JAR files as dependencies using Maven with provided scope, which means they will be used while compiling, but won't be packaged into your application.
Am I correct in saying that these JARs need to be available to the JRE?
No, those JARs do not need to be available to the JRE. JAR files that contain standard APIs will be provided by your Java EE / Jakarta EE container at runtime. Other JAR files should be included in your application in WEB-INF/lib.
I am facing this exception on tomcat server startup.
Here I am using javax.servlet-api-4.0.1.jar in my project, and I included this for runtime also.
But when I deploy my application into tomcat 8.5, tomcat picks the older jar servlet-api from its /lib folder.
I know this method setSessionTimeout is included in servlet 4.0, but how will I direct tomcat to pick jar from my project's WEB-INF/lib folder instead of tomcat/lib.
I tried to place servlet-api-4.0 jar into tomcat/lib and deleting older jar, then project starts properly. But is it the correct way? Can't tomcat pick the latest jar from my project's lib directory.
Please help.
Do not bring your own servlet API jar.
You claim you're using Tomcat 8.5, which implements servlet spec 3.1. Bringing along a newer jar will not magically make it implement this newer spec.
If you want 4.0, use Tomcat 9. And don't bring your own servlet API. The version that ships with Tomcat is perfectly fine. Depending on the way you build, you need some version of it at build time, but you do not package it for runtime use (e.g. Maven calls it "provided", in gradle I see "compile" or "compileOnly")
I'm trying to deploy WAR file into JBoss 7.
I placed the WAR file in the standalone/deployments folder.
while starting the server I’m getting ClassNotFoundError.
I believe Since the jars are not part of the WAR file and not placed in the WEB_INF/lib folder so I need to add them externally.
I read so many tutorials but I just can’t understand how it works.
So my question is how I simply add JAR files to the JBoss classpath.
If you want to add any jars that are not part of WebApp but are still needed to be loaded, one approach would trying to copy the jars at following location:
$JAVA_HOME/jre/lib/ext.
The JBOSS server should point to this java installation and this might resolve your issue.
This might be one way.
JBOSS 7 uses module based loading, hence most of the jars will be loaded if module is included in standalone.xml.
You will need to check in JBoss Release notes if third party modules can be loaded.
Ok I solved it by creating new module and by adding the module dependency in the MANIFEST of my jar.
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.
I am creating a web application using Eclipse (3.4), and m2eclipse. I am using the deploy goal but often prefer to use the run goal for the use of the embedded tomcat in the maven tomcat plugin. I added the xalan jar to the endorsed dir as I had problems with the xalan that is in the rt.jar.
It works fine on deployment, but I can't find a way to define the endorsed dir in the embedded tomcat as well.
The best for me is to have any solution in the project level (POM.xml) so that any other developer can enjoy running the application on an embedded tomcat.
Any idea?
Thanks,
Ronen.
This is not really a solution per se, but I would avoid using the endorsed dir, and make my own jar with the xalan version you want, with the package rewritten. This is employed by many open source projects because of the clash with the shipped xalan. There is a tool for jar rewriting, but I have forgotten its name and my google-foo seems to be lacking...