Ulf Dittmer wrote:Were you hoping that "{exlir." would print the attribute? That's wrong in several ways; try "${exlir}" instead.
I'll refrain from commenting on the JSP XML syntax, which has been out of fashion for many years.
SEVERE: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/restPostMan]]
at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:878)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:846)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1332)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1322)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:145)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:871)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:241)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:428)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:912)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.startup.Catalina.start(Catalina.java:795)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:347)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:478)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/restPostMan]]
at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:440)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:198)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1332)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1322)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:145)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:871)
... 21 more
Caused by: java.lang.NoClassDefFoundError: retrofit2/Converter$Factory
at java.base/java.lang.Class.getDeclaredFields0(Native Method)
Ulf Dittmer wrote:"<servlet-class>package controller.restController</servlet-class>" is wrong; remove the "package" part. Also note that class names should start with an uppercase letter.
Mappings never contain the context name.
Also note that "restPostMan" is the name of the servlet, not "restController" (which the form action uses).
We don't know what you have in WEB-INF/lib and TOMCAT_HOME/lib, but apparently not the class retrofit2.Converter. So you need to add whatever jar file contains that. Build tools like Maven and Gradle can handle dependency management for you.
tangara goh wrote:I already have it in my pom. Now I added into TOMCAT_HOME/lib again as well as the WEB-INF/lib, it is still giving me the same error.
Ulf Dittmer wrote:
tangara goh wrote:I already have it in my pom. Now I added into TOMCAT_HOME/lib again as well as the WEB-
Tell us how you checked which jar file that class in is, and show us how that jar file is in one of those directories.
Seeing that you seem to run Tomcat inside of an IDE, I can easily picture the jar file not ending up in the correct runtime directory.
Please see attached.
And snippet of my pom
<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>
Tell us how you checked which jar file that class in is, and show us how that jar file is in one of those directories.
Ulf Dittmer wrote:That screenshot, rather pointedly, does NOT contain the jar file in which the class retrofit2.Converter lives. I'll ask again:
Tell us how you checked which jar file that class in is, and show us how that jar file is in one of those directories.
Tell us how you checked which jar file that class is in
Ulf Dittmer wrote:I'll ask yet again, hoping that you will actually do it this time:
Tell us how you checked which jar file that class is in
Because the converter-gson jar file does NOT contain the missing class.
If you want help you need to pay attention to what people are telling you.
Education won't help those who are proudly and willfully ignorant. They'll literally rather die before changing.
Ulf Dittmer wrote:You shouldn't download anything from the Maven site, you should let Maven do this. That is what dependency management systems are for.
I have no way of knowing whether some file on your disk is broken or incomplete. What I do know is that the "converter-gson" dependency simply does not contain the class retrofit2.Converter. That is why I keep asking how you have made sure that it does. Because it doesn't, and it baffles me how you might have gotten that idea.
and i updated it, cleaned and installed it so many times
why would i still need to install the jars manually ?
why would i still need to install the jars manually ?
SEVERE: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]]
at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:878)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:846)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1332)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1322)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:145)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:871)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:241)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:428)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:912)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.startup.Catalina.start(Catalina.java:795)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:347)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:478)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]]
at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:440)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:198)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1332)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1322)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:145)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:871)
... 21 more
Caused by: java.lang.NoClassDefFoundError: jakarta/servlet/jsp/JspFactory
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:467)
at org.apache.catalina.startup.WebappServiceLoader.loadServices(WebappServiceLoader.java:235)
at org.apache.catalina.startup.WebappServiceLoader.load(WebappServiceLoader.java:206)
at org.apache.catalina.startup.ContextConfig.processServletContainerInitializers(ContextConfig.java:1834)
at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1299)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:987)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:304)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4797)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
... 27 more
and it is quite strange that i already have jakarta.servlet.jsp.jstl it is still complaing i need jakarta/servlet/jsp/JspFactory
Ulf Dittmer wrote:
and it is quite strange that i already have jakarta.servlet.jsp.jstl it is still complaing i need jakarta/servlet/jsp/JspFactory
That sentence does not make sense. JSP and JSTL are different things. JSP is built into a servlet container, whereas JSTL needs to be added.
There seems to be a disconnect between the libraries you compile against, and the libraries (meaning, the Tomcat version) that you run the code on. I advise not to use the IDE for this, but to use a standalone Tomcat for running your code. That way you will know exactly what version of the libraries is used.
Now, when I run the server on standalone,
Ulf Dittmer wrote:The error message does indicate that not all jar files are where they should be, or that some jar files are the wrong versions. If you post the contents of TOMCAT_HOME/lib and WEB-INF/lib, maybe we can help you.
Education won't help those who are proudly and willfully ignorant. They'll literally rather die before changing.
Tim Holloway wrote:
Ulf Dittmer wrote:The error message does indicate that not all jar files are where they should be, or that some jar files are the wrong versions. If you post the contents of TOMCAT_HOME/lib and WEB-INF/lib, maybe we can help you.
And, again, DO NOT put application JAR files into TOMCAT_HOME/lib. That includes application library JARs!!!
tangara goh wrote:The content of Tomcat Lib is quite huge. Is it possible to attached a compressed file here?
I tried to attempt the stand alone Tomcat and I can't find any tutorial that can guide me how to operate a Tomcat server without IDE.
I got a reply from SO
Ulf Dittmer wrote:
tangara goh wrote:The content of Tomcat Lib is quite huge. Is it possible to attached a compressed file here?
What we would need to see is not the files, but the list of files - in text, NOT as a screenshot.
I tried to attempt the stand alone Tomcat and I can't find any tutorial that can guide me how to operate a Tomcat server without IDE.
Start here: https://tomcat.apache.org/tomcat-10.1-doc/setup.html
I got a reply from SO
Oh, you are also asking this elsewhere, without mentioning this here? And probably without mentioning it there? Thus duplicating effort and wasting people's time? You've been here long enough to know that that's unfriendly behaviour. I just lost interest in helping you. Good bye.
Er I need an answer fast so I do hope you understand
Ulf Dittmer wrote:OK, that looks like a pretty clean Tomcat, except for converter-gson-2.9.0.jar. That's part of your web app, and belongs into WEB-INF/lib, together with the other dependencies (like Retrofit).
Ulf Dittmer wrote:Actually, jakarta.servlet.jsp-api-3.1.1.jar looks suspicious. Wasn't there a jsp-api.jar file initially? Mucking around with Tomcat's internal files is a recipe for desaster.
Ulf Dittmer wrote:
Ulf Dittmer wrote:OK, that looks like a pretty clean Tomcat, except for converter-gson-2.9.0.jar. That's part of your web app, and belongs into WEB-INF/lib, together with the other dependencies (like Retrofit).
Actually, jakarta.servlet.jsp-api-3.1.1.jar looks suspicious. Wasn't there a jsp-api.jar file initially? Mucking around with Tomcat's internal files is a recipe for desaster.
|java.lang.RuntimeException: Error scanning entry org/apache/taglibs/standard/tlv/JstlSqlTLV$Handler.class from jar file:///C:/Users/abc/xxx/abc-workSpace/restPostMan/src/main/webapp/WEB-INF/lib/jakarta.servlet.jsp.jstl-3.0.1.jar
Stephan van Hulst wrote:I'm only speculating here, but it's very likely that the names of these files changed with Tomcat 10, since Tomcat 10 moved from Java EE to Jakarta EE.
Stephan van Hulst wrote:
Tangara Goh, you really should not be changing ANY of the files in your Tomcat installation unless you understand exactly what you're doing and why you're doing it. Simply adding libraries to Tomcat just because your application is complaining about it is a BAD idea.
Education won't help those who are proudly and willfully ignorant. They'll literally rather die before changing.
Fire me boy! Cool, soothing, shameless self promotion:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
|