Problems with deploying JSF project from Netbeans to Tomcat - java

Googled everything, but can't find solution for my problem.
When i'm trying to deploy my project to Tomcat, i have such errors in Tomcat log:
SEVERE: Error configuring application listener of class com.sun.faces.config.ConfigureListener
java.lang.NoClassDefFoundError: javax/servlet/ServletRequestListener
I tried to deploy it from fresh Netbeans 6.8 to fresh Tomcat 6.0.26, but the problem is still there.
Servlet-api.jar is in the tomcat/lib folder. Tried to replace it with the newest, but problem is still there.
No compilation errors. Everything is correct.
Problem started suddenly. No code changes, no new jars added.
Help?
UPD: contents of WEB-INF/lib:
hibernate3.jar
hibernate-testing.jar
quartz-1.7.2.jar
quartz-all-1.7.2
servlet-api-2.5-20081211

java.lang.NoClassDefFoundError: javax/servlet/ServletRequestListener
The javax.servlet.ServletRequestListener is newly introduced since Servlet 2.4 API. That your environment cannot seem to find it can be caused by two things:
Either the web.xml is declared as Servlet 2.3 or older which forces the server to Servlet 2.3 compliance mode, or the server in question doesn't support Servlet 2.4 at all.
Classpath is really, really messed up. You should never put/change/remove libraries in JRE/lib, JRE/lib/ext or Tomcat/lib without understanding what you're doing. You should never put appserver-specific libraries in Webapp/WEB-INF/lib because that doesn't make any sense.
To fix 1, ensure that your web.xml is declared as at least Servlet 2.4. Preferably the newest which the server can support. Tomcat 6.0 supports Servlet 2.5, so declare web.xml accordingly.
To fix 2, cleanup the classpath of all pollution. Invest some more time to learn more about the phenomeon "classpath". Handle it with care.

Tomcat doesn't ship with JSF libraries, so you have to include those in WEB-INF/lib. From the listing above it is obvious that your are missing those. For JSF2 go here.
Moreover you do not need servlet-api in WEB-INF/lib, it is a provided library.

Related

BEA-160228 LoggerFactory Logback LoggerContext. Either remove Logback... Weblogic springboot

I really lost the way here, i'm trying to deploy a springboot application, when I try to upload .war file in a weblogic 12c returns BEA-160228 with error message in title here is my pom.xml:
https://bitbucket.org/snippets/CPernillo/6eg5oe
I've tried a lot of solutions that I found on forums even here in stack but nothing seems to work for me like disable spring-boot-starter-logging (as you can see in pom.xml), add a weblogic.xml to my webapp/WEB-INF folder (here it is):
https://bitbucket.org/snippets/CPernillo/yed5oA
Please stack-experts, help me and thanks in advance.
Update 1
This project has sucessfully deployed in a dev server, without changing anything, the problem is production server.
Fixed!
I Answer only if in future somebody have to pass this bad luck:
Java versions in both weblogic where diferent, spring 2.0.3.REALEASE only supports java 8, so, production server has jdk 7, client's sysadmins gonna have a long night migrating all old projects to jdk 8.

javax.servlet.jsp.tagext.TagLibraryValidator error while executing a web project [duplicate]

This question already has answers here:
How to install JSTL? The absolute uri: http://java.sun.com/jstl/core cannot be resolved
(20 answers)
Closed last month.
I followed the guide in this link to install JSTL but I got the following error when I tried to launch my JSP page:
java.lang.NoClassDefFoundError: javax/servlet/jsp/tagext/TagLibraryValidator
The taglib declaration is:
<%#taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
I installed JSTL 1.1 under /WEB-INF/lib in Tomcat webapps and tried to do the same in my project, but it didn't work. I also tried version 1.2 of JSTL and still the same message. How is this caused and how can I solve it?
I had a similar problem, I am using Tomcat 10. I was getting this error using Apache NetBeans 12.3 IDE.
I added the following libraries:
jakarta.servlet.jsp.jstl-api-2.0.0.jar
jakarta.servlet.jsp.jstl-2.0.0 (1).jar
My code is running fine now.
link to see where I added them
The javax.servlet.jsp.tagext.TagLibraryValidator class is introduced in JSP 2.0. This error can thus have the following possible causes:
You are not running a JSP 2.0 compatible serlvetcontainer. For example, Tomcat 4.x or 5.0. You need at least Tomcat 5.5 or better, 6.0, or even better, 7.0. Just the latest version.
You have cluttered the /WEB-INF/lib with arbitrarily downloaded jsp-api.jar or j2ee.jar files or whatever contains the JSP API, which originates from a completely different servletcontainer make/version which in turn was actually not JSP 2.0 compliant. Get rid of those libraries. You don't need them. If you did this to workaround compilation errors, then you did it the wrong way. They should end up in compiletime classpath, not in the runtime classpath. See also How do I import the javax.servlet API in my Eclipse project?
I had the same problem. Use the WildFly server latest one. This resolved my the same issue.
Download all the required jar files from here. While adding the jar files, don't include the jakarta.servlet-api-5.0.0.jar file, which is already included in the Tomcat10.0
This will work not only for the basic JSTL functions, but also for iterations using tags such as <c:forEach>
I too am having a similar problem. Except mine is for NoClassDefFoundError: javax/servlet/jsp/tagext/TryCatchFinally. I'm in the process of converting my web app to jakarta EE. I tried using the jars mentioned above and it didn't clear the error. After ripping the app to nothing, I found that the maven dependencies for SpringFramework 5.2.3 do not support Jakarta EE. I'll have to wait until Spring releases 6.0.0 of their framework. :-{

javax.el.PropertyNotFoundException: Property 'toArray' not found on type org.hibernate.collection.internal.PersistentSet

I am using hashset.toArray()[x] to display a element in the jsf view, and this is working fine in my machine.
But when I move this on to test server, the above error is thrown.
Both machines are running tomcat 7.
what is causing this error?
The ability to invoke arbitrary non-property-related methods in EL is introduced in EL version 2.2 which goes hand in hand with Servlet 3.0. This feature didn't exist in older versions like Servlet 2.5 / EL 2.1.
So, if you deploy your webapp to a Servlet 3.0 compatible container with a Servlet 3.0 compatible web.xml root declaration, then it will work fine. However, if you deploy your webapp to a container of an older version, or with a web.xml which dictates an older version, or have dropped arbitrary container-specific JAR files of an older version inside webapp's /WEB-INF/lib or even server's own /lib, then this feature won't work.
Provided that you're absolutely positive that the test server is running Tomcat 7 and thus not Tomcat 6 or so, then that can only mean that the web.xml was been changed to dictate an older version, or that your webapp or server's /lib is littered with arbitrary container-specific JAR files such as jsp-api.jar, el-api.jar, etc which would only conflict with container's own libraries (this is often done by ignorant starters in order to workaround compilation errors they face in their IDE; which should have been solved differently).

HttpServlet cannot be resolved to a type .... is this a bug in eclipse? [duplicate]

This question already has answers here:
How do I import the javax.servlet / jakarta.servlet API in my Eclipse project?
(16 answers)
Closed 1 year ago.
Every thing was fine and i was able to run this JSP project,
suddenly some thing happened and mostly all my servlets getting unresolved error.
I know its because specific JAR file cant be found for compilation.. but my "buildpath" is fine and i didnt make any changes..
I am stuck in this situation...
Tried
cleaned project many times
removes and added JRE library
removed and added server(Tomcat 7.0.23)
You have to set the runtime for your web project to the Tomcat installation you are using; you can do it in the "Targeted runtimes" section of the project configuration.
In this way you will allow Eclipse to add Tomcat's Java EE Web Profile jars to the build path.
Remember that the HttpServlet class isn't in a JRE, but at least in an Enterprise Web Profile (e.g. a servlet container runtime /lib folder).
It means that servlet jar is missing .
check the libraries for your project.
Configure your buildpath download **
servlet-api.jar
** and import it in your project.
A simple solution for me was to go to Properties -> Java Build Path -> Order and Export, then check the Apache Tomcat library. This is assumes you've already set Tomcat as your deployment target and are still getting the error.
It happened for me also and the reason was selecting inappropriate combination of tomcat and Dynamic web module version while creating project in eclipse. I selected Tomcat v9.0 along with Dynamic web module version 3.1 and eclipse was not able to resolve the HttpServlet type. When used Tomcat 7.0 along with Dynamic web module version 7.0, eclipse was automatically able to resolve the HttpServlet type.
Related question Dynamic Web Module option in Eclipse
To check which version of tomcat should be used along with different versions of the Servlet and JSP specifications refer http://tomcat.apache.org/whichversion.html
None of the recommendations I found on the web resolved for me, not even the ones here in this conversation.
The only thing that did resolve was uninstalling Tomcat 10 and installing version 9, then the issue was gone. I took this (http://tomcat.apache.org/whichversion.html) into account, but that didn't seem to have anything to do with my issue.
I faced the same problem in eclipse with tomcat7 with the error javax.servlet cannot be resolved. If I select the server in targeted runtime mode and build project again, the error get's resolved.

Solving "loader constraints violated when linking [...] class" error in Java

I am new to Java and experiencing problems understanding exceptions thrown by the framework.
Right now, I am trying to implement a regular expression validator into an application consisting of Java 5 EE with myFaces 1.2 and Tobago running in an apache tomcat 5.5.
I followed a couple of tutorials (including the Java 5 EE tut from SUN) and came pretty far. However, when calling my jsp, I get the following error message:
java.lang.LinkageError: loader constraints violated when linking javax/faces/validator/Validator class
Can anyone explain to me what I need to do to solve this problem?
So far, it seems as if MyFaces 1.1.7 has a version conflict to TomCat 5.5. Both contain javax.* packages (one of them namely javax.faces.validator). The validator class has a different version in the packages. The corresponding MyFaces library is called myfaces-api-1.1.7.jar and the TomCat library is called javaee.jar.
The included javax packages in the myfaces lib is a subset of the packages from within the javaee lib. However... I cannot skip any of both, because the project will fail to start then.
Any tipps?
This is almost certainly caused by your application having its own copy of Validator (in one of its JAR files), and this is clashing with the server's own copy. Something this can cause a LinkageError.
Find out which of your WAR or EAR's JAR files contains that, and remove it (along with the rest of the javax.faces classes).
Sounds like a classpath problem. Check your classpath for two jars with conflicting versions (both containing the javax.faces.validator.Validator class)
According to the MyFaces homepage. Tomcat Config: Tomcat 5.5.x
Some users have reported problems when
using MyFaces with Tomcat 5.5.x. Here
is a short guide that will hopefully
help you not run into the same
problems :-)
If your are using the binary version
of MyFaces: MyFaces is packaged so
that it works with Tomcat 5.0.x so
the WEB-INF/lib/jsp-2.0.jar and
WEB-INF/lib/commons-el.jar JAR files must be removed from your
WAR files (including the examples).
If you are building from source: If
you want to build MyFaces from scratch
to work with Tomcat 5.5.x, you have to
set the property
tomcat.pre.5.5.version in the
$MYFACES_HOME/build/build.default.properties
file to the value false.
Perhaps you've got two conflicting versions of the same library available on your classpath. For example, you might have a jar file in WEB-INF/lib that's already provided in TOMCAT_HOME/lib. (el-api.jar is a common culprit, but there are other possibilities.)

Categories

Resources