javax.servlet.http.HttpServlet" was not found - java

i have maven project with spring restful service oracle and hibernate and jpa, i am new in maven and spring development, and i got some bad error i can not find the answer and tried a lot but still got same error i am sharing me error below help:
The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path
web.xml
<%# page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>

you need to add javax.servlet-api dependency into you project pom.xml, you can find it below, you can also change the version of javax.servlet-api:
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
after Adding javax.servlet-api you need to add runtime, goto select project properties. you can refer below image.

Related

JasperException while using JSTL [duplicate]

I don't know what I've done incorrectly, but I can't include JSTL. I have jstl-1.2.jar, but unfortunately I get exception:
org.apache.jasper.JasperException: The absolute uri: http://java.sun.com/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application
at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:51)
at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:409)
at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:116)
at org.apache.jasper.compiler.TagLibraryInfoImpl.generateTLDLocation(TagLibraryInfoImpl.java:315)
at org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:148)
at org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:429)
at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:492)
at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1439)
at org.apache.jasper.compiler.Parser.parse(Parser.java:137)
at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:255)
at org.apache.jasper.compiler.ParserController.parse(ParserController.java:103)
at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:170)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:332)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:312)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:299)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:586)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
at java.lang.Thread.run(Thread.java:619)
I have:
pom.xml
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
web.xml
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">
index.jsp
<%# taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<html>
<head></head>
<body></body>
</html>
org.apache.jasper.JasperException: The absolute uri: http://java.sun.com/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application
That URI is for JSTL 1.0, but you're actually using JSTL 1.2 which uses URIs with an additional /jsp path (because JSTL, who invented EL expressions, was since version 1.1 integrated as part of JSP 2.0 (released way back in 2001!) in order to share/reuse the EL logic in plain JSP too).
So, fix the taglib URI accordingly based on JSTL 1.2 documentation:
<%# taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
Further you need to make absolutely sure that you do not throw multiple different versioned JSTL JAR files together into the runtime classpath. This is a pretty common mistake among Tomcat users. The problem with Tomcat is that it does not offer JSTL out the box and thus you have to manually install it. This is not necessary in normal Jakarta EE servers. See also What exactly is Java EE?
In your specific case, your pom.xml basically tells you that you have jstl-1.2.jar and standard-1.1.2.jar together. This is wrong. You're basically mixing JSTL 1.2 API+impl from Oracle with JSTL 1.1 impl from Apache. You should stick to only one JSTL implementation and the API version must match the impl version.
Installing JSTL on Tomcat 10.1.x
In case you're already on Tomcat 10.1.x (the second Jakartified version, with jakarta.* package instead of javax.* package, but the first version with the updated jakarta.tags.* namespace URNs instead of http://java.sun.com/jsp/jstl/* namespace URLs), use JSTL 3.0 via this sole dependency using the default Maven scope of compile (because Tomcat doesn't provide it out the box!):
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>jakarta.servlet.jsp.jstl</artifactId>
<version>3.0.1</version>
</dependency>
Note that the API dependency is already transitively included via this impl dependency, so you do not need to explicitly declare it.
Non-Maven users can achieve the same by dropping the following two physical files in /WEB-INF/lib folder of the web application project (do absolutely not drop standard*.jar or any loose .tld files in there! remove them if necessary).
jakarta.servlet.jsp.jstl-3.0.1.jar (this is the JSTL 3.0.1 impl of EE4J)
jakarta.servlet.jsp.jstl-api-3.0.0.jar (this is the JSTL 3.0 API)
As said, the namespace URIs have been changed to become URNs instead of URLs. JSTL core is since JSTL version 3.0 available via an easier to remember namespace URI in URN format:
<%# taglib prefix="c" uri="jakarta.tags.core" %>
See also JSTL 3.0 documentation.
Installing JSTL on Tomcat 10.0.x
In case you're on Tomcat 10.0.x (the first Jakartified version, with jakarta.* package instead of javax.* package), use JSTL 2.0 via this sole dependency using the default Maven scope of compile (because Tomcat doesn't provide it out the box!):
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>jakarta.servlet.jsp.jstl</artifactId>
<version>2.0.0</version>
</dependency>
Note that the API dependency is already transitively included via this impl dependency, so you do not need to explicitly declare it.
Non-Maven users can achieve the same by dropping the following two physical files in /WEB-INF/lib folder of the web application project (do absolutely not drop standard*.jar or any loose .tld files in there! remove them if necessary).
jakarta.servlet.jsp.jstl-2.0.0.jar (this is the JSTL 2.0 impl of EE4J)
jakarta.servlet.jsp.jstl-api-2.0.0.jar (this is the JSTL 2.0 API)
Installing JSTL on Tomcat 9-
In case you're not on Tomcat 10 yet, but still on Tomcat 9 or older, use JSTL 1.2 via this sole dependency (this is compatible with Tomcat 9 / 8 / 7 / 6 / 5 but not older) using the default Maven scope of compile (because Tomcat doesn't provide it out the box!):
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>jakarta.servlet.jsp.jstl</artifactId>
<version>1.2.6</version>
</dependency>
Note that the API dependency is already transitively included via this impl dependency, so you do not need to explicitly declare it.
Non-Maven users can achieve the same by dropping the following two physical files in /WEB-INF/lib folder of the web application project (do absolutely not drop standard*.jar or any loose .tld files in there! remove them if necessary).
jakarta.servlet.jsp.jstl-1.2.6.jar (this is the JSTL 1.2 impl of EE4J)
jakarta.servlet.jsp.jstl-api-1.2.7.jar (this is the JSTL 1.2 API)
Installing JSTL on normal JEE server
In case you're actually using a normal Jakarta EE server such as WildFly, Payara, TomEE, GlassFish, WebSphere, OpenLiberty, WebLogic, etc instead of a barebones servletcontainer such as Tomcat, Jetty, Undertow, etc, then you do not need to explicitly install JSTL at all. Normal Jakarta EE servers already provide JSTL out the box. In other words, you don't need to add JSTL to pom.xml nor to drop any JAR/TLD files in webapp. Solely the provided scoped Jakarta EE coordinate is sufficient:
<dependency>
<groupId>jakarta.platform</groupId>
<artifactId>jakarta.jakartaee-api</artifactId>
<version><!-- 10.0.0, 9.1.0, 9.0.0, 8.0.0, etc depending on your server --></version>
<scope>provided</scope>
</dependency>
Make sure web.xml version is right
Further you should also make sure that your web.xml is declared conform at least Servlet 2.4 and thus not as Servlet 2.3 or older. Otherwise EL expressions inside JSTL tags would in turn fail to work. Pick the highest version matching your target container and make sure that you don't have a <!DOCTYPE> anywhere in your web.xml as that would otherwise still trigger Servlet 2.3 modus. Here's a Servlet 6.0 (Tomcat 10.1.x) compatible example:
<?xml version="1.0" encoding="UTF-8"?>
<web-app
xmlns="https://jakarta.ee/xml/ns/jakartaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_6_0.xsd"
version="6.0">
<!-- Config here. -->
</web-app>
And here's a Servlet 5.0 (Tomcat 10.0.x) compatible example:
<?xml version="1.0" encoding="UTF-8"?>
<web-app
xmlns="https://jakarta.ee/xml/ns/jakartaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_5_0.xsd"
version="5.0">
<!-- Config here. -->
</web-app>
And here's a Servlet 4.0 (Tomcat 9) compatible example:
<?xml version="1.0" encoding="UTF-8"?>
<web-app
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
version="4.0">
<!-- Config here. -->
</web-app>
See also:
JSTL core taglib documentation (for the right taglib URIs)
EL expressions not evaluated in JSP
How to configure pom.xml for Tomcat 10+ or Tomcat 9-
#BalusC is completely right, but If you still encounter this exception, it means that something you have done wrong. The most important information you will find is on the SO JSTL Tag Info page.
Basically this is a summary of what you need to do to deal with this exception.
Check the servlet version in web.xml: <web-app version="2.5">
Check if JSTL version is supported for this servlet version: Servlet version 2.5 uses JSTL 1.2 or Servlet version 2.4 uses JSTL 1.1
Your servlet container must have the appropriate library, or you must include it manually in your application. For example: JSTL 1.2 requires jstl-1.2.jar
What to do with Tomcat 5 or 6:
You need to include appropriate jar(s) into your WEB-INF/lib directory (it will work only for your application) or to the tomcat/lib (will work globally for all applications).
The last thing is a taglib in your jsp files. For JSTL 1.2 correct one is this:
<%# taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
I found another reason for this type of error: in my case, someone set the conf/catalina.properties setting tomcat.util.scan.StandardJarScanFilter.jarsToSkip property to * to avoid log warning messages, thereby skipping the necessary scan by Tomcat. Changing this back to the Tomcat default and adding an appropriate list of jars to skip (not including jstl-1.2 or spring-webmvc) solved the problem.
Download jstl-1.2.jar
Add this directive to your page: <%# taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
Paste the JAR file in your WEB-INF/lib folder. This should work. (It
worked for me.)
jstl-1.2.jar --> <%# taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
jstl-1.1.jar --> <%# taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
also please check for the dependency jars that you have added javax.servlet.jar and javax.servlet.jsp.jstl-1.2.1.jar or not in your WEB-INF/lib folder. In my case these two solved the issue.
Add the jstl-1.2.jar into the tomcat/lib folder.
With this, your dependency error will be fixed again.
I just wanted to add the fix I found for this issue. I'm not sure why this worked. I had the correct version of jstl (1.2) and also the correct version of servlet-api (2.5)
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
I also had the correct address in my page as suggested in this thread, which is
<%# taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
What fixed this issue for me was removing the scope tag from my xml file in the pom for my jstl 1.2 dependency. Again not sure why that fixed it but just in case someone is doing the spring with JPA and Hibernate tutorial on pluralsight and has their pom setup this way, try removing the scope tag and see if that fixes it. Like I said it worked for me.
An answer for the year 2021
The question is still very popular, but all the answers are seriously outdated. All Java EE components were split off into various Jakarta projects and JSTL is no different. So here are the correct Maven dependencies as of today:
<dependency>
<groupId>jakarta.servlet.jsp.jstl</groupId>
<artifactId>jakarta.servlet.jsp.jstl-api</artifactId>
<version>1.2.7</version>
</dependency>
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>jakarta.servlet.jsp.jstl</artifactId>
<version>1.2.6</version>
</dependency>
Yes, the versions and groupIds do not match, but that's a quirk of the project's current state.
The most possible solutions for 2022
1 - Missing Libarires: download the library jstl/1.2 and Java Servlet API » 4.0.1
2 - Add these libraries to your project and also into the tomcat/lib folder.
3 - Add: <%# taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> first line of the page.
4 - if you are using maven add the following into pom.xml file :
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
I have mentioned that the Maven dependency in the pom.xml is wrong. It should be
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
Just had similar problem in Eclipse
fixed with:
rightclick on project->Properties->Deployment Assembly->add Maven Dependencies
something kicked it out before,
while I was editing my pom.xml
I had all needed jar files, taglib uri and web.xml was ok
I had disabled MAVEN and Spring tools completely. And I had to add the following jar's for making my environment work right.
spring-aop-4.0.3.RELEASE.jar
spring-beans-4.0.3.RELEASE.jar (tough to find this fix, other org.springframework<3.versions> just did not work.
spring-context-4.0.3.RELEASE.jar
spring-core-4.0.3.RELEASE.jar
spring-expression-4.0.3.RELEASE.jar
spring-web-4.0.3.RELEASE.jar
spring-webmvc-4.0.3.RELEASE.jar
jstl-1.2.jar
The worst of all was jstl-api-1.2.jar and javax-servlet.jsp.jst-api-1.2.1.jar. They just did not work.
jstl-1.2.jar worked well.
If you use Spring boot, consider to remove server.tomcat.additional-tld-skip-patterns=*.jar from Application.properties if there is any
All of the answers in this question helped me but I thought I'd add some additional information for posterity.
It turned out that I had a test dependency on gwt-test-utils which brought in the gwt-dev package. Unfortunately gwt-dev contains a full copy of Jetty, JSP, JSTL, etc. which was ahead of the proper packages on the classpath. So even though I had proper dependencies on the JSTL 1.2 it would loading the 1.0 version internal to gwt-dev. Grumble.
The solution for me was to not run with test scope so I don't pick up the gwt-test-utils package at runtime. Removing the gwt-dev package from the classpath in some other manner would also have fixed the problem.
If using Tomcat 10:
Download
jakarta.servlet.jsp.jstl-2.0.0.jar
jakarta.servlet.jsp.jstl-api-2.0.0.jar
Place in /WEB-INF/lib folder.
Don't forget to restart Tomcat!
This workedfor me
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
I had the same issue , I am using eclipse, just in case others experience the same issue:
In eclipse double click the tomcat server,
stop the server
untick the "server modules without publishing"
start the server.
Resolved same problem in Netbeans 12.3 and Tomcat 9.0:
1.Write in pom.xml:
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId><version>1.2</version>
</dependency>
2.Add jstl-1.2.jar in project.
3.Install manually artifact(Choose jstl-1.2.jar - downloaded from the Internet )
2023 version
Nothing else worked for me except adding the below to pom.xml:
PS: I do realize that version 2.0.0 of jakarta.servlet.jsp.jstl contains some vulnerability, please use caution.
<!-- https://mvnrepository.com/artifact/jakarta.servlet.jsp.jstl/jakarta.servlet.jsp.jstl-api -->
<dependency>
<groupId>jakarta.servlet.jsp.jstl</groupId>
<artifactId>jakarta.servlet.jsp.jstl-api</artifactId>
<version>2.0.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.glassfish.web/jakarta.servlet.jsp.jstl -->
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>jakarta.servlet.jsp.jstl</artifactId>
<version>2.0.0</version>
</dependency>
Resolved similar problem in IBM RAD 7.5 by selecting:
Projects properties
Project Facets
JSTL check-box

Using custom Tag files in JSP with Spring Boot

I have a Spring Boot project and I'm trying to make the following call in a JSP file:
<%# taglib prefix="tagz" tagdir="/WEB-INF/tags" %>
<tagz:utils tabs="true"/>
The tags folder is in -
\src\main\resources\WEB-INF\tags
The JSP files folder is in -
\src\main\resources\META-INF\resources\WEB-INF\jsp
I also defined the application.properties file to include:
spring.mvc.view.prefix=/WEB-INF/jsp/
spring.mvc.view.suffix=.jsp
If I try to put the tags folder in any other classpath than Intellij is showing an error that It cannot identify the call in the editor.
The JSP page is presented properly if I remove the taglib call.
My pom.xml is of course has these dependencies:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>1.5.4.RELEASE</version>
<exclusions>
<exclusion>
<artifactId>spring-boot-starter-tomcat</artifactId>
<groupId>org.springframework.boot</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<version>8.5.15</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>3.0-alpha-1</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
I get the following error:
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing
this as a fallback.
Sun Jun 25 16:12:47 IDT 2017 There was an unexpected error
(type=Internal Server Error, status=500). /WEB-INF/jsp/main.jsp
(line: [11], column: [4]) No tag [utils] defined in tag library
imported with prefix [tagz]
I think It has to do with configuration of static files in Spring Boot but I tried to add
spring.resources.static-
locations=classpath:/resources/static/,classpath:/resources/,classpath:/static/,classpath:/public/,classpath:/WEB-INF/tags/,classpath:/WEB-INF/
spring.mvc.static-path-pattern=/resources/**
Nothing seems to work.
I should mention that these taglibs are working properly!
<%# taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%# taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
Any help?
So after a lot of trail and error I now put all my JSP files inside of path:
webapp/WEB-INF/jsp
Tags files inside of:
webapp/WEB-INF/tags
And Tlds files inside of:
webapp/WEB-INF/tld
When you call the tag/tld files you inside of the JSPs you need to refer them to relative path e.g:
<%# taglib prefix="ui" tagdir="/WEB-INF/tags/ui" %>
You will also need to define a Facet in project structure. If you don't have it define that means that you need to generate it by adding "web framework" to your project. It will generate web.xml and you need to put it under webapp/WEB-INF and edit it in project Facets manaully.
Hope this will help anyone who sees this post.

cannot find tag library descriptor for spring framework in maven eclipse project

The following three lines at the top of documents.jsp throw "cannot find tag library descriptor for ..." errors in the spring framework application from this tutorial, which uses eclipse and maven:
<%# taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%# taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%# taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
My understanding is that the maven plugin for eclipse should manage the download of these libraries automatically, so I checked to make sure that the following are included in pom.xml:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<properties>
<org.springframework.version>3.0.2.RELEASE</org.springframework.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
So how do I fix my application to enable the required dependencies to be available? I want to avoid having to do it manually, because I was under the impression that maven should manage this. Is there some way that I need to manipulate maven? The application apparently worked when it was tested for the tutorial.
EDIT:
I converted my eclipse project to a maven project and then right clicked on the eclipse project and chose Maven>Update Project. This did nothing to fix the error that still remains from my original posting above, but it also added the following new error:
Missing artifact javax.transaction:jta:jar:1.0.1B
Which is now thrown by the second line of pom.xml, which reads as follows:
<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
SECOND EDIT:
When I try to run as..run on server, I get the following error in a dialog box:
'Publishing to Tomcat v7.0 Server at localhost...' has encountered a problem.
Error reading file D:\mypath\.m2\repository\javax\transaction\jta\1.0.1B\jta-1.0.1B.jar
D:\mypath\.m2\repository\javax\transaction\jta\1.0.1B\jta-1.0.1B.jar (The system cannot find the file specified)
I even set "update Maven projects on startup" in Window>preferences>Maven and then closed and restarted eclipse, but the problem persists.
I passed for this same issue where I receive the message
"cannot find tag library descriptor for ..."
I solved putting spring-webmvc inside of my war. This error happened when spring-webmvc were in server folder.
I suggest you see how do you're packaging your war.

Can not find the tag library descriptor for "http://java.sun.com/jsp/jstl/core"

I'm trying to use JSTL, but I get the following error:
Can not find the tag library descriptor for "http://java.sun.com/jsp/jstl/core"
How is this caused and how can I solve it?
Use taglib definition in your JSP or better include it in every page by the first line.
<%# taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
There's also fix jstl-1.2 dependency in your project. Also use servlet specification at least 2.4 in your web.xml.
The maven dependencies are (maven is a open source development tool)
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.1.2</version>
<scope>compile</scope>
</dependency>
In the web.xml start writing
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
EDIT:
I'd like to add a note that #informatik01 has mentioned in the comment about newer version of JSTL libraries available from Maven repository: JSTL version 1.2.1 API and JSTL 1.2.1 .
I had the same problem even after I added jar files for jstl and standard. For me, it resolved after I added a Targeted runtime for my project.
Go to Project Properties > Targeted Runtimes and select the server you are using (Tomcat 7.0 for me).
create a libs folder in the inside WEB-INF directory and add jstl, standard jars as below.
You may try to make the folder which include jsp-s become the source folder of eclipse, that solved the same problem of mine. As below:
open project's properties.(right click project, then choose the Properties)
choose Java Build Path, select the Source tab, click Add Folder and choose the folder including your jsp-s, OK
in your pom.xml just add
<!-- jstl -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
and try run
mvn eclipse:eclipse -Dwtpversion=2.0
will solve the problem
You just need to include the standard.jar file in your project build path.
I have similar issue, why should we add external jar files when we are using maven?
I have already included jstl maven dependency then also I encounter error "Can not find the tag library descriptor for "http://java.sun.com/jsp/jstl/core"".
Then I include following dependency then error get solve, without including any single external jar file.
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
As per snapshot the main reason for error is that you are not defining c.tld in lib folder causes such error.
This lib content information about taglib

Can not find the tag library descriptor of springframework

I'm trying to follow the example of spring JPetStore but I get an error in the JSP pages in the line that references the lib tag spring:
Can not find the tag library descriptor for "http://www.springframework.org/tags"
<%# taglib prefix="spring" uri="http://www.springframework.org/tags" %>
What is the URL of this library?
Is there any way to avoid the direct dependence on this URL?
Thanks in advance
I know it's an old question, but the tag library http://www.springframework.org/tags is provided by spring-webmvc package. With Maven it can be added to the project with the following lines to be added in the pom.xml
<properties>
<spring.version>3.0.6.RELEASE</spring.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
Without Maven, just add that jar to your classpath. In any case it's not necessary to refer the tld file directly, it will be automatically found.
Download the Spring dependency jar
Place it to the lib folder path is /WEB-INF/lib/spring.jar
Then open the web.xml and the sample code is:
<taglib>
<taglib-uri>/WEB-INF/spring.tld</taglib-uri>
<taglib-location>/WEB-INF/spring.tld</taglib-location>
</taglib>
Then the taglib is indicated where the jar file locates in ur system.
<%# taglib prefix="spring" uri="/WEB-INF/spring.tld" %>
Removing the space between # and taglib did the trick for me: <%# taglib prefix="spring" uri="http://www.springframework.org/tags" %>
If you are using maven use this dependency:
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-taglibs</artifactId>
<version>3.1.4.RELEASE</version>
</dependency>
The TLD should be located in the spring.jar. Your application won't have any dependency on that URL. It's just used as a unique name to identify the tag library. They could just as well have made the URI "/spring-tags", but using URLs is pretty common place.
you have to add the dependency for springs mvc
tray adding that in your pom
<!-- mvc -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>3.1.2.RELEASE</version>
</dependency>
I had the same issue with weblogic 12c and maven I initially while deploying from eclipse (kepler) (deploying from the console gave no errors).
The other solutions given on this page didn't help.
I extracted the spring.tld spring-form.tld files of the spring-webmvc jar (which I found in my repository) in the web\WEB-INF folder of my war module;
I did a fresh build; deployed (from eclipse) into weblogic 12c, tested the application and the error was gone;
I removed the spring.tld spring-form.tld files again and after deleting; rebuilding and redeploying the application the error didn't show up again.
I double checked whether the files were gone in the war and they were indeed not present.
hope this helps others with a similar issue...
I finally configured RAD to build my Maven-based project, but was getting the following exception when I navigate to a page that uses the Spring taglib:
JSPG0047E: Unable to locate tag library for uri
http://www.springframework.org/tags at
com.ibm.ws.jsp.translator.visitor.tagfiledep.TagFileDependencyVisitor.visitCustomTagStart(TagFileDependencyVisitor.java:76)
...
The way I had configured my EAR, all the jars were in the EAR, not in the WAR’s WEB-INF/lib. According to the JSP 2.0 spec, I believe tag libs are searched for in all subdirectories of WEB-INF, hence the issue. My solution was to copy the tld files and place under WEB-INF/lib or WEB-INF.. Then it worked.
If you want direct link:
https://github.com/spring-projects/spring-framework/blob/master/spring-webmvc/src/main/resources/META-INF/spring-form.tld
Or from repos:
JCenter : link
Maven Central : link
And if you need as Gradle dependency:
compile 'org.springframework:spring-webmvc:4.1.6.RELEASE
More information about spring-form:
http://docs.spring.io/spring/docs/current/spring-framework-reference/html/spring-form.tld.html
Here is another case.
We have several portlets in different portlet application war and all of them use spring. So in order to reduce size of each war, we have created shared libraries for spring jars in the WebSphere Portal server.
However, I came across the same issue as above of not having the spring form tags being referred from the jsp files.
In order to resolve, I have copied the spring-form.tld file into the WEB-INF/ directory and redeployed the war and it worked.
Hope it helps for anyone having a similar issue as mine.
This problem normally appears while copy pasting the tag lib URL from the internet. Usually the quotes "" in which the URL http://www.springframework.org/tags is embedded might not be correct. Try removing quotes and type them manually. This resolved the issue for me.
I was using Spring-Boot, For me cut-paste of below in Pom.xml worked. May be file wasnt in sync.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
Core dependencies for tag library:
> <dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-taglibs</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-rest</artifactId>
</dependency>
add external jar of jstl-standard.jar as the external jar by right click on JRE system libraries under configure build path -> build path.
it worked for me!!

Categories

Resources