Karen,

On 3/2/23 00:24, Karen Goh wrote:
I have forwarded you that SO URL to showed you that the scope
provided needed to add it in but after you pointed out I realised it
is wrong. Nope. I am not using jetty run. I right click on Eclipse
run on server.
Maybe I'm getting confused by what is copy/paste from your (unreferenced) sources and what is your own words. Your posts are difficult to interpret.

So, the latest happening is that I got an advice from another SO user
to put in the jar from Download jakarta.servlet.jsp-api JAR file with
all dependencies I tried to exploded the jar to see if it contains
all the dependencies I need but all i could find is byte code
.class.
JAR files typically only contain .class files. If you see a file in there with the class name + ".class" then that's where the class is. If you are providing a JAR file which contains jakarta/servlet/jsp/JspFactory.class then you are making a mistake and need to remove that file from your application.

Download jakarta.servlet.jsp-api JAR file with all dependencies
>
Download jakarta.servlet.jsp-api JAR file ✓ With dependencies ✓
Documentation ✓ Source code >
and Tomcat is able to run.  Only thing is that the index.jsp doesn't
show up. It only show localhost:8080/webclientv1/ and the browser
appears moving like waiting.
This is different than ClassNotFoundException. Unless this is the behavior of the client while the log file shows "ClassNotFoundException".

But, still I got to sort out the dependencies cos I need them for CICD.

Could you advise me what is the full set of dependencies I need ?

Tomcat should provide jakarta.servlet.jsp-api and so you do not need it. If you want to add JSTL to use that in your JSPs then you need only the JSTL library and any of its dependencies (but not JSP-API, which is provided by Tomcat).

-chris

     On Thursday, March 2, 2023 at 01:51:56 AM GMT+8, Christopher Schultz 
<ch...@christopherschultz.net> wrote:
Karen,

On 3/1/23 10:21 AM, Karen Goh wrote:
   hi Chris,
I am following advice from ClassNotFoundException: javax.servlet.jsp.JspFactory
ClassNotFoundException: javax.servlet.jsp.JspFactory

I have a maven-based app that I copied exactly and tried to run mvn jetty:run 
And now getting this error:Cau...

    where it says scope provided must be added
Anwyay, I have removed the scope and the jars that are put in the lib folder in 
WEB-INF, it is no use.
The same error still persists.
I removed <scope>provided<scope> on all the Jakarat ee replated dependencies as 
shown in the pom just now.
Hope you could advise me now.
Tks.

If you are using jetty:run then you are probably not using Tomcat. >:|

-chris

       On Wednesday, March 1, 2023 at 10:19:18 PM GMT+8, Christopher Schultz 
<ch...@christopherschultz.net> wrote:
  Karen,

On 3/1/23 09:09, Karen Goh wrote:
Hello experts,
I need desperate help to fix this java.lang.ClassNotFoundException: 
jakarta.servlet.jsp.JspFactory
Here are my dependencies which I have installed but still Tomcat will still 
purge out the ClassNotFound error :
<dependencies>
             <dependency>
                 <groupId>com.fasterxml.jackson.core</groupId>
                 <artifactId>jackson-databind</artifactId>
                 <version>2.13.3</version>
             </dependency>
             <!-- 
https://mvnrepository.com/artifact/com.squareup.retrofit2/retrofit -->
             <dependency>
                 <groupId>com.squareup.retrofit2</groupId>
                 <artifactId>retrofit</artifactId>
                 <version>2.9.0</version>
             </dependency>
             <dependency>
                 <groupId>com.squareup.retrofit2</groupId>
                 <artifactId>converter-gson</artifactId>
                 <version>2.9.0</version>
             </dependency>
             <!-- https://mvnrepository.com/artifact/com.google.code.gson/gson 
-->
             <dependency>
                 <groupId>com.google.code.gson</groupId>
                 <artifactId>gson</artifactId>
                 <version>2.10.1</version>
             </dependency>
             <!-- 
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>3.0.0</version>
                 <scope>provided</scope>
             </dependency>
             <!-- 
https://mvnrepository.com/artifact/jakarta.platform/jakarta.jakartaee-web-api -->
             <dependency>
                 <groupId>jakarta.platform</groupId>
                 <artifactId>jakarta.jakartaee-web-api</artifactId>
                 <version>10.0.0</version>
                 <scope>provided</scope>
             </dependency>
                 <dependency>
                 <groupId>jakarta.servlet</groupId>
                 <artifactId>jakarta.servlet-api</artifactId>
                 <version>6.0.0</version>
                 <scope>provided</scope>
             </dependency>
             <dependency>
                 <groupId>org.glassfish.web</groupId>
                 <artifactId>jakarta.servlet.jsp.jstl</artifactId>
                 <version>3.0.1</version>
                 <scope>provided</scope>
             </dependency>
             <dependency>
             <groupId>jakarta.el</groupId>
             <artifactId>jakarta.el-api</artifactId>
             <version>5.0.0</version>
             <scope>provided</scope>
         </dependency>
I have even attached the jar - jakarta.servlet.jsp.jstl-3.0.1.jar
jakarta.servlet.jsp.jstl-api-3.0.0.jarto the lib folder.
Java 17, Eclipse on Windows 10.
I am not sure how to tackle this problem, as I need to get an assignment 
done.Would appreciate advice from this group.Tks.

Your POM shows both jstl artifacts as "provided" meaning they won't be
downloaded and bundled into your application. I think you actually need
to allow those to be downloaded as they are not provided by Tomcat (I
think! I'm no JSTL expert).

But Tomcat definitely ships with a copy of
jakarta.servlet.jsp.JspFactory so if you are adding a JAR which contains
that class, you are likely causing a conflict.

Tomcat really should be prohibiting that class from being provided by an
application, but maybe you have put it somewhere that is confusing the JVM.

Which lib/ folder did you put those JARs into?

-chris

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to