2

I'm starting a web development project with a new install of Eclipse for Web developers; I installed Eclipse 2020-06 and Tomcat 10. But evidently those are not compatible; the first example JSP I entered has an error saying that HTTPServlet is not on the path.

On looking further, I discovered that the servlet library pathnames have changed; used to be javax... and are now jakarta... I'm assuming that's the problem, though I don't have definite confirmation of that.

Should I be using a newer version of eclipse, or an older version of Tomcat? Or is there something else I should be using?

EDIT: also using Java 11.0

EDIT: version of eclipse was a typo -- 2022-06 is the actual version.

arcy
  • 12,845
  • 12
  • 58
  • 103
  • you should also add the jdk version that you are using... – Shoaeb Jun 26 '22 at 10:36
  • Thanks, should have thought of that. 11.0. – arcy Jun 26 '22 at 10:38
  • though the jdk version has nothing to do with the solution, specifying it is a good practice while asking questions.. – Shoaeb Jun 26 '22 at 10:53
  • Why install an old version of Eclipse? – Basil Bourque Jun 26 '22 at 15:20
  • 1
    Tomcat 10.0 was released a good 6 months after Eclipse 2020-06, which is now 2 years and 8 releases behind. You need a newer Eclipse release, like the current one: 2022-06. Whether you want to use Tomcat 9 or 10 is really up to you, and you haven't said why you should pick one over the other. – nitind Jun 26 '22 at 16:28
  • Sorry, all -- the version of eclipse was a typo -- 2022-06 is the actual version. – arcy Jun 29 '22 at 01:21

2 Answers2

3

So, you are assuming right... There is a breaking change in package name for tomcat 9 to tomcat 10 from javax.* to jakarta.* respectively....

To make your project to work,

Option 1 : You downgrade to tomcat Version that uses the package (javax).... For Eg. Tomcat 9

Option 2 : You Make changes in your codebase and change the package name to use jakarta and keep using tomcat 10 or above...

Shoaeb
  • 709
  • 7
  • 18
  • Yeah, except that I cannot change the package name -- I'm not sure where the package name is in the JSP support, but I'm certain I cannot change it. I imagine there's a JSP support package, possibly used in eclipse 2022-12, that does use the newer package name, but that seems to be a pre-stable release (not sure) and I was hoping for advice on whether going that way was better than downgrading Tomcat. – arcy Jun 26 '22 at 11:13
  • Not really a “downgrade” when switching from Tomcat 10.0 to Tomcat 9. They are equivalent products, with the only significant difference being the `jakarta.*` name change. – Basil Bourque Jun 26 '22 at 15:17
  • @arcy You’ll need to change the versions of related API, such as Servlet and JSP to match the version expected by Tomcat. See the [*Which version?*](https://tomcat.apache.org/whichversion.html) page on the Tomcat site. – Basil Bourque Jun 26 '22 at 15:23
  • There is no 2022-12 release or pre-release, yet, but 2022-06 will work with both releases of Tomcat. – nitind Jun 27 '22 at 14:47
1

Update to Eclipse 2022-06. It works with both versions, largely automatically.

nitind
  • 19,089
  • 4
  • 34
  • 43