Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Errors in Eclipse but not Netbeans exact same project(Errors in jsp file)
Errors in Eclipse but not Netbeans exact same project [message #1842989] Thu, 08 July 2021 19:31 Go to next message
Jim Whitaker is currently offline Jim WhitakerFriend
Messages: 26
Registered: October 2020
Junior Member
I have one project in eclipse, and same exact project in netbeans (I sync / mirror).

I have several errors in eclipse like:

javax.servlet cannot be resolved to a type

Multiple annotations found at this line:
	- javax.servlet cannot be resolved 
	 to a type


And happening in this code segment:
        <c:set var="surl" value="${pageContext.request.requestURL}" />

        <c:choose>
            <c:when test="${pageContext.request.queryString != null}">
                <c:set var="squy" value="${pageContext.request.queryString}" />
            </c:when>
            <c:otherwise>
                <c:set var="squy" value="t1=${t11}&page=${pageno}" />
            </c:otherwise>
        </c:choose>


        <%--<c:set var="squy" value="${pageContext.request.queryString}" />--%>
        <c:set var="sqm" value="?" />
        <%--${surl}${sqm}${squy}--%>
        <c:set var="surl2" value='${surl}${sqm}${squy}' />
        <%--${surl2}--%>
        <c:set var="sessvar" value="${surl2}" scope="session" />


But the project runs fine, no build errors, etc. I have in the lib folder:
jakarta.activation-2.0.0.jar
jakarta.el-api-4.0.0.jar
jakarta.servlet.jsp.jstl-2.0.0.jar
jakarta.servlet.jsp.jstl-api-2.0.0.jar
jakarta.servlet-api-5.0.0-M1.jar
jakarta.xml.bind-api-3.0.0.jar


Am I missing some? If so I have no idea where to get them.

And in the pom I have:
				<dependency>
					<groupId>org.glassfish.web</groupId>
					<artifactId>jakarta.servlet.jsp.jstl</artifactId>
					<version>2.0.0</version>
				</dependency>


That came from a stackoverflow post. I am using tomee however. Is there something I need that I am unaware of. And this is a jakarta ee 9 project.

Using the following: io.github.hantsy maven-archetype-jakartaee9

All runs and builds are fine. Any help appreciated.

Also those jstl's I included I got from a github page, I cannot find any instructions on downloading jstl libraries from any jakarta site that's needed with examples.

To add please see this issue:

https://github.com/eclipse-ee4j/jstl-api/issues/54

I am in the same situation, I am having to hunt for what I can find using Google. I cannot find any tutorials or examples of how to install the jstl tags or what jars I need or even where they go.

Project works, but I'd still like to setup fully correctly.

[Updated on: Fri, 09 July 2021 00:43]

Report message to a moderator

Re: Errors in Eclipse but not Netbeans exact same project [message #1843002 is a reply to message #1842989] Sat, 10 July 2021 04:19 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4303
Registered: July 2009
Senior Member

Jakarta EE 9 uses new "jakarta" package names, not "javax", so you wouldn't have javax.servlet in the IDE if you're using it. Of course,
without knowing which version of Eclipse this is, what server you're using, or which files indicate a problem finding javax.servlet, there's
no way to know if not finding it is actually a problem or not.


Nitin Dahyabhai
Eclipse Web Tools Platform

[Updated on: Sat, 10 July 2021 04:21]

Report message to a moderator

Re: Errors in Eclipse but not Netbeans exact same project [message #1843008 is a reply to message #1843002] Sat, 10 July 2021 17:22 Go to previous messageGo to next message
Jim Whitaker is currently offline Jim WhitakerFriend
Messages: 26
Registered: October 2020
Junior Member
Nitin DahyabhaiFriend Thanks for answering. Eclipse Version: 2021-06 (4.20.0). A jakarta ee 9 project. I even took all references out of pom to jstl. I downloaded
jakarta.servlet.jsp.jstl-2.0.0.jar from https://jakarta.ee/specifications/tags/2.0/ placed it in WEB-INF\lib. I even changed preferences to ignore these jstl errors,
but they still show up.

However the project builds fine and runs in server Tomee (apache-tomee-webprofile-9.0.0-M7) perfect. No errors running the project on server.
I think Eclipse must have a bug with jslt. I have this also in the jsp file:

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="x" uri="http://java.sun.com/jsp/jstl/xml" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>


No errors show up in bean classes or servlets. Just those on the jsp jstl..
That's why I asked am I missing a jar, or is it a bug in eclipse. Netbeans shows no errors. I even made a war, deployed to Tomee, ran perfect.

[Updated on: Sat, 10 July 2021 17:25]

Report message to a moderator

Re: Errors in Eclipse but not Netbeans exact same project [message #1843009 is a reply to message #1843008] Sat, 10 July 2021 19:54 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4303
Registered: July 2009
Senior Member

You're not missing a jar or anything. It's the JSP EL handling happening behind the scenes that's not properly adapted to
the newer package names. Retry it with WTP 3.23M1/2021-09M1.


Nitin Dahyabhai
Eclipse Web Tools Platform
Re: Errors in Eclipse but not Netbeans exact same project [message #1843010 is a reply to message #1843009] Sat, 10 July 2021 21:41 Go to previous messageGo to next message
Jim Whitaker is currently offline Jim WhitakerFriend
Messages: 26
Registered: October 2020
Junior Member
I tried searching in market place, tried from here https://projects.eclipse.org/projects/webtools/releases/3.23, clicked link to here https://marketplace.eclipse.org/content/eclipse-java-ee-developer-tools-0 then here.
I dragged it over, but only 3.22 shows installed. How do I install the one above.

[Updated on: Sat, 10 July 2021 21:42]

Report message to a moderator

Re: Errors in Eclipse but not Netbeans exact same project [message #1843011 is a reply to message #1843010] Sat, 10 July 2021 23:09 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4303
Registered: July 2009
Senior Member

Technically it's out on Friday. You could try to install features from https://download.eclipse.org/webtools/downloads/drops/R3.23.0/S-3.23.0.M1-20210710223640/repository/
and force Eclipse to consider the site's contents for updating along the way.

If the messages about javax.servlet also appear in the Problems View, you would need to invoke validation again for them to be cleared up.


Nitin Dahyabhai
Eclipse Web Tools Platform
Re: Errors in Eclipse but not Netbeans exact same project [message #1843014 is a reply to message #1843011] Sun, 11 July 2021 02:31 Go to previous messageGo to next message
Jim Whitaker is currently offline Jim WhitakerFriend
Messages: 26
Registered: October 2020
Junior Member
Wouldn't install yet, I will wait til it's released. Thanks
Re: Errors in Eclipse but not Netbeans exact same project [message #1843156 is a reply to message #1843014] Fri, 16 July 2021 17:21 Go to previous messageGo to next message
Jim Whitaker is currently offline Jim WhitakerFriend
Messages: 26
Registered: October 2020
Junior Member
I got the WTP 3.23M1/2021-09M1 installed, it took care of most errors, but still get warning like:
A problem was encountered using TagExtraInfo class org.apache.taglibs.standard.tei.ForEachTEI for 'c:forEach'


So I am guessing that it's just an Eclipse problem, the project builds and runs perfect.

[Updated on: Fri, 16 July 2021 17:21]

Report message to a moderator

Re: Errors in Eclipse but not Netbeans exact same project [message #1843159 is a reply to message #1843156] Fri, 16 July 2021 19:14 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4303
Registered: July 2009
Senior Member

Yes, specifically the known problem in bug 571273. The changes to the parameter and return types under Jakarta EE 9 mean that the translation mechanism behind the editor and validation has to be updated.

Nitin Dahyabhai
Eclipse Web Tools Platform

[Updated on: Fri, 16 July 2021 19:15]

Report message to a moderator

Re: Errors in Eclipse but not Netbeans exact same project [message #1856209 is a reply to message #1843159] Mon, 28 November 2022 02:35 Go to previous messageGo to next message
panda mkk is currently offline panda mkkFriend
Messages: 23
Registered: April 2022
Junior Member
Is this problem fixed? I still have this problem in the latest version of 2022-09 eclipse
Re: Errors in Eclipse but not Netbeans exact same project [message #1856303 is a reply to message #1856209] Thu, 01 December 2022 18:42 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4303
Registered: July 2009
Senior Member

No, it is not yet fixed.

Nitin Dahyabhai
Eclipse Web Tools Platform
Re: Errors in Eclipse but not Netbeans exact same project [message #1856308 is a reply to message #1856303] Thu, 01 December 2022 22:31 Go to previous messageGo to next message
NGUENA ZEBS HAUPUR FAUST is currently offline NGUENA ZEBS HAUPUR FAUSTFriend
Messages: 1
Registered: December 2022
Junior Member
Before continuing, I have 2 questions for you:
what version of java are you using? and did you install the Apache tomcat software from the APACHE Foundation??

the version of java must respond to the specificity of Tomcat, that is to say your server.
Re: Errors in Eclipse but not Netbeans exact same project [message #1856698 is a reply to message #1856308] Fri, 23 December 2022 09:03 Go to previous messageGo to next message
panda mkk is currently offline panda mkkFriend
Messages: 23
Registered: April 2022
Junior Member
I seem to have similar problems in 2022-12. I don't know whether our problems are the same, because I don't have this problem in 2022-03

Error messages like this
javax.servlet cannot be resolved to a type
The superclass "javax.servlet.http.HttpServlet", determined from the Dynamic Web Module facet version (2.5), was not found on the Java Build Path
javax.servlet cannot be resolved to a type

https://www.eclipse.org/forums/index.php?t=getfile&id=42798&
Re: Errors in Eclipse but not Netbeans exact same project [message #1856912 is a reply to message #1856698] Mon, 09 January 2023 07:51 Go to previous messageGo to next message
Sanjeev Rao is currently offline Sanjeev RaoFriend
Messages: 2
Registered: January 2023
Junior Member
I think the problem is that you are trying to use the JSTL (JSP Standard Tag Library) in your project, but the JSTL jars are not in your classpath, so the classes cannot be found by the compiler.

To fix this, you need to add the JSTL jars to your classpath. You can either add them to the lib folder of your project, or add them to the classpath of your project in your build tool (e.g. Maven or Gradle).

To add the JSTL jars using Maven, you can add the following dependency to your pom.xml file:

<dependency>
  <groupId>jakarta.servlet</groupId>
  <artifactId>jakarta.servlet-api</artifactId>
  <version>5.0.0-M1</version>
</dependency>

<dependency>
  <groupId>jakarta.servlet.jsp</groupId>
  <artifactId>jakarta.servlet.jsp-api</artifactId>
  <version>5.0.0-M1</version>
</dependency>

<dependency>
  <groupId>jakarta.servlet.jsp.jstl</groupId>
  <artifactId>jakarta.servlet.jsp.jstl-api</artifactId>
  <version>2.0.0</version>
</dependency>

<dependency>
  <groupId>org.glassfish.web</groupId>
  <artifactId>jakarta.servlet.jsp.jstl</artifactId>
  <version>2.0.0</version>
</dependency>


Make sure to run mvn clean install after adding these dependencies to your pom.xml file to download and install the jars.

Alternatively, you can download the JSTL jars from a Maven repository and add them to your classpath manually.

Once you have the jars, you can add them to your classpath by placing them in the lib folder of your project, or by adding them as dependencies in your build tool.

I hope this helps! Let me know if you have any more questions.
Re: Errors in Eclipse but not Netbeans exact same project [message #1856923 is a reply to message #1856698] Mon, 09 January 2023 17:01 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4303
Registered: July 2009
Senior Member

Your Dynamic Web facet version is 2.5, meaning you are targeting Servlet 2.5. Was that your intention? You targeted runtime doesn't seem to have the APIs expected from a Servlet 2.5 container.

Nitin Dahyabhai
Eclipse Web Tools Platform

[Updated on: Mon, 09 January 2023 17:36]

Report message to a moderator

Re: Errors in Eclipse but not Netbeans exact same project [message #1856961 is a reply to message #1856923] Wed, 11 January 2023 06:30 Go to previous messageGo to next message
panda mkk is currently offline panda mkkFriend
Messages: 23
Registered: April 2022
Junior Member
How do I set the default version of Dynamic Web? I know that you can choose a version when creating a new project, but I import a maven project (there is no eclipse setting file in this project, and the default version is not set). The default version after import is 2.5, but I need 5.0. I know how to change the dynamic Web of project to 5.0, but how to change the default value so that the default version is 5.0 after the project is imported?Now, I need to manually modify this version after each import
Re: Errors in Eclipse but not Netbeans exact same project [message #1856982 is a reply to message #1856961] Wed, 11 January 2023 16:07 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4303
Registered: July 2009
Senior Member

I'm not sure. Do the deployment descriptors in it, or anything else, refer to 5.0?

Nitin Dahyabhai
Eclipse Web Tools Platform
Re: Errors in Eclipse but not Netbeans exact same project [message #1856993 is a reply to message #1856982] Thu, 12 January 2023 05:53 Go to previous messageGo to next message
panda mkk is currently offline panda mkkFriend
Messages: 23
Registered: April 2022
Junior Member
project\.settings\org.eclipse.wst.common.project.facet.core.xml
There is such xml in the setting file of the project, where the jst.web records Dynamic Web version 2.5
But this setting file does not exist in my maven project,It is automatically generated after importing eclipse
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
  <fixed facet="wst.jsdt.web"/>
  <installed facet="java" version="11"/>
  <installed facet="jst.web" version="2.5"/>
  <installed facet="wst.jsdt.web" version="1.0"/>
</faceted-project>


[Updated on: Thu, 12 January 2023 05:55]

Report message to a moderator

Re: Errors in Eclipse but not Netbeans exact same project [message #1857004 is a reply to message #1856993] Thu, 12 January 2023 14:11 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4303
Registered: July 2009
Senior Member

So nothing there before import? Not the version number in a web.xml file, or 5.0 API dependencies?

Nitin Dahyabhai
Eclipse Web Tools Platform
Re: Errors in Eclipse but not Netbeans exact same project [message #1857016 is a reply to message #1857004] Fri, 13 January 2023 01:49 Go to previous messageGo to next message
panda mkk is currently offline panda mkkFriend
Messages: 23
Registered: April 2022
Junior Member
web.xml look like this
<?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">


pom.xml 's dependency
In fact, the jakarta.servlet version is 6.0
        <dependency>
            <groupId>jakarta.servlet</groupId>
            <artifactId>jakarta.servlet-api</artifactId>
        </dependency>
        <dependency>
            <groupId>jakarta.servlet.jsp</groupId>
            <artifactId>jakarta.servlet.jsp-api</artifactId>
        </dependency>

        <!-- Required only for Tomcat. If run on other J2EE server,
            remove this dependency and use provided tag libraries. -->
        <dependency>
            <groupId>jakarta.servlet.jsp.jstl</groupId>
            <artifactId>jakarta.servlet.jsp.jstl-api</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.glassfish.web</groupId>
            <artifactId>jakarta.servlet.jsp.jstl</artifactId>
            <scope>runtime</scope>
        </dependency>
Re: Errors in Eclipse but not Netbeans exact same project [message #1857060 is a reply to message #1857016] Sun, 15 January 2023 21:29 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4303
Registered: July 2009
Senior Member

Maybe it's a copy/paste mistake, but there are no version numbers in those dependency elements.

Nitin Dahyabhai
Eclipse Web Tools Platform
Re: Errors in Eclipse but not Netbeans exact same project [message #1857066 is a reply to message #1857060] Mon, 16 January 2023 02:35 Go to previous messageGo to next message
panda mkk is currently offline panda mkkFriend
Messages: 23
Registered: April 2022
Junior Member
The version of my web.xml web-app is 6.0
Servlet version is also 6.0
Tomcat used is 10.1

I'm not sure what is the relationship between the three versions of web-app,servlet and dynamic web module
I guess the version of dynamic web module I should use may be 6.0...I don't know whether there is a 6.0 dynamic web module
But I think there seems to be a problem with Eclipse's recognition of the dynamic web module version. When my web.xml version is set to 3.0,4.0 and 2.5, after importing, the dynamic web module can be set to the corresponding version
However, when my web.xml is set to 6.0, after importing the project, the dynamic web module version is set to 2.5...
Is Eclipse 2022-12 not supporting the 6.0 version, resulting in these errors?

Re: Errors in Eclipse but not Netbeans exact same project [message #1857067 is a reply to message #1857066] Mon, 16 January 2023 06:53 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4303
Registered: July 2009
Senior Member

It's a bit of both. Version 6 hasn't been added as a facet in WTP for 2022-12, and m2e-wtp isn't aware of 6.0, or even 5.0. I'm working
on the WTP side of it, but I can't predict if/when my PR on m2e-wtp will get merged. When both changes are merged and released,
the Maven import will make use of the referenced schema and/or version number in a web.xml if it's present, and the level of Servlet
API that's on the Java Build Path otherwise.


Nitin Dahyabhai
Eclipse Web Tools Platform
Re: Errors in Eclipse but not Netbeans exact same project [message #1857095 is a reply to message #1857067] Tue, 17 January 2023 01:47 Go to previous messageGo to next message
panda mkk is currently offline panda mkkFriend
Messages: 23
Registered: April 2022
Junior Member
In Eclipse 2022 - 12, if I want to use Servlet 6.0, I can only manually change the version of the dynamic web module to 5.0.This is a temporary solution
In addition, even in 2023-03, there may not be 6.0, so we need to wait for the release of WTP
Is my understanding right


Re: Errors in Eclipse but not Netbeans exact same project [message #1857096 is a reply to message #1857095] Tue, 17 January 2023 03:52 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4303
Registered: July 2009
Senior Member

Yes.

This is really disconnected from the question that started this thread.


Nitin Dahyabhai
Eclipse Web Tools Platform
Re: Errors in Eclipse but not Netbeans exact same project [message #1857097 is a reply to message #1857096] Tue, 17 January 2023 05:41 Go to previous messageGo to next message
panda mkk is currently offline panda mkkFriend
Messages: 23
Registered: April 2022
Junior Member
Yes, at first I didn't know that the dynamic web module is related to the servlet version I use
Nitin Dahyabhai Friend, thank you very much
Re: Errors in Eclipse but not Netbeans exact same project [message #1857099 is a reply to message #1857097] Tue, 17 January 2023 08:26 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4303
Registered: July 2009
Senior Member

The WTP changes will be in M2 on the 26th, and are in the CI builds now. I'm not sure what the build schedule is for me2-wtp, but
those changes were merged into their main branch.


Nitin Dahyabhai
Eclipse Web Tools Platform
Re: Errors in Eclipse but not Netbeans exact same project [message #1857101 is a reply to message #1857099] Tue, 17 January 2023 09:02 Go to previous message
panda mkk is currently offline panda mkkFriend
Messages: 23
Registered: April 2022
Junior Member
Thank you. I will try it when M2 is released
Previous Topic:Problems
Next Topic:Shortcuts don't work in Eclipse
Goto Forum:
  


Current Time: Tue Jan 31 08:30:50 GMT 2023

Powered by FUDForum. Page generated in 0.04334 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top