Re: 'for each' statements are only available if source level is 1.5 or greater
Christopher Schultz <[email protected]>
| Newsgroups | gmane.comp.jakarta.tomcat.user |
|---|---|
| Message-ID | <[email protected]> |
Mark, On 12/14/25 12:54 AM, Mark Foley wrote: > OK, I've given up on my initial approach to getting Apache Tomcat 10.1.13 to > run. I'e wiped the 10.1.13 directory and re-installed from the tarfile > (originally downloaded from tomcat.apache.org). > > I added the following to context.xml: > > <Resources allowLinking="true" /> Which context.xml did you modify? You should leave all files alone in the Tomcat installation. You should only be changing files in your application. > Why? Because many of the jsp files are linked to a common source. This is good information to have. Can you be very specific about that symlinks you have? Not just where they point, but what their sources are? Like /foo/bar/baz points to /a/b/c. > I added the following to web.xml: > > <security-constraint> > <web-resource-collection> > <web-resource-name>Include files</web-resource-name> > <description>No direct access to include files.</description> > <url-pattern>/include/*</url-pattern> > <http-method>POST</http-method> > <http-method>GET</http-method> > </web-resource-collection> > > <!--web-resource-collection> > <web-resource-name>tmp files</web-resource-name> > <description>No direct access to tmp files.</description> > <url-pattern>/tmp/*</url-pattern> > <http-method>POST</http-method> > <http-method>GET</http-method> > </web-resource-collection--> > > <auth-constraint> > <description>No direct browser access to include files.</description> > <role-name>NobodyHasThisRole</role-name> > </auth-constraint> > </security-constraint> > > I added the following to server.xml: > > <Connector protocol="AJP/1.3" > address="127.0.0.1" > port="8009" > redirectPort="8443" > maxParameterCount="1000" > secretRequired="false" > /> > > The 'secretRequired' thing was from notes on a previous, successful 10.1.13 deployment. Just confirming: you are using Apache httpd with mod_jk or mod_proxy_ajp as a reverse proxy in front of Tomcat? > I removed from server.xml: > > xmlValidation="false" xmlNamespaceAware="false" > <Logger className="org.apache.catalina.logger.FileLogger" ... /> > > This got rid of the catalina.out warning messages on those lines. > > I added the following to server.xml. Again, from previous notes: > > <Realm className="org.apache.catalina.realm.MemoryRealm" /> > > I configured only one local hostname in server.xml: > > <Host name="www.horeb-wright3.org" appBase="webapps" > unpackWARs="true" autoDeploy="true"> > > <Alias>horeb-wright3.org</Alias> > > <Context path="" docBase="horeb-wright3" reloadable="false"> > <WatchedResource>/WEB-INF/web.xml</WatchedResource> > <WatchedResource>/style.css</WatchedResource> > </Context> Not recommended, but okay. If you have <Context> in conf/server.xml and also the file is in the webapps/ directory, then you will deploy the application TWICE. Once on / (becasue you d <Context path="">, and once on /horeb-wright3 because you have autoDeploy="true" and a directory called webapps/horeb-wright3). This may be multiplying all of your error messages by 2 in the log file. It's not really dangerous, just confusing and wasteful. If you can get away without putting <Context> in conf/server.xml, then I would recommend that you remove it. If you want to deploy an application on / then re-name the diretory horeb-wright3 to be ROOT (case-sensitive). > </Host> > > I also installed tomcat-connectors 1.2.50 in /usr/lib64/httpd/modules/mod_jk.so. Okay I guess you are using mod_jk then :) > I then started tomcat and got numerous errors in catalina.out. > > Now, the jsp programs in webapps/horeb-wright3 were all created and running under > apache 8.5.11. I do know that lots of javax stuff was replaced by jakarta. So, if > I can get the right jakarta lib references into these jsp programs I might be out > of the woods. Tomcat can migrate your application for you, automatically. In the Tomcat 10.1.x deployment, put your application into webapps-javaee/ instead of webapps/ Tomcat will auto-replace the Java EE imports with Jakarta EE imports during the deployment. Then you don't have to modify your original application just to test it with Tomcat 10.1. > Below seem to me the most important log messages. There are several exceptions > listed, but one that occurs frequently is ClassNotFoundException: > jakarta.websocket.server.ServerEndpoint. That is conccerning. It suggests to me that your Tomcat installation is broken. But you just reinstalled everything. > A web search on this error gives: > > "If using Tomcat 10+, update your code and dependencies to use > jakarta.websocket.* imports." > > However, searching all the "page imports", "include files" in index.jsp I find > nothing with the string "websocket". > > There are several javax imports: > > page import="javax.naming.Context, javax.naming.NamingException" > page import="javax.sql.DataSource, > javax.imageio.ImageIO" Those haven't changed. It's only the JavaEE ones that have changed. > > Is there a classdef I can import to resolve this exception? > > Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/horeb-wright3]] > Caused by: java.lang.TypeNotPresentException: Type jakarta.websocket.server.ServerEndpoint not present > Caused by: java.lang.ClassNotFoundException: jakarta.websocket.server.ServerEndpoint > Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/common]] > Caused by: java.lang.TypeNotPresentException: Type jakarta.websocket.server.ServerEndpoint not present > Caused by: java.lang.ClassNotFoundException: jakarta.websocket.server.ServerEndpoint > Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[www.horeb-wright3.org].StandardContext[]] > Caused by: java.lang.TypeNotPresentException: Type jakarta.websocket.server.ServerEndpoint not present > Caused by: java.lang.ClassNotFoundException: jakarta.websocket.server.ServerEndpoint > Caused by: org.apache.catalina.LifecycleException: A child container failed during start > Caused by: java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[www.horeb-wright3.org].StandardContext[]] > Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[www.horeb-wright3.org].StandardContext[]] > Caused by: java.lang.TypeNotPresentException: Type jakarta.websocket.server.ServerEndpoint not present > Caused by: java.lang.ClassNotFoundException: jakarta.websocket.server.ServerEndpoint > Caused by: java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: A child container failed during start > Caused by: org.apache.catalina.LifecycleException: A child container failed during start > Caused by: java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[www.horeb-wright3.org].StandardContext[]] > Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[www.horeb-wright3.org].StandardContext[]] > Caused by: java.lang.TypeNotPresentException: Type jakarta.websocket.server.ServerEndpoint not present > Caused by: java.lang.ClassNotFoundException: jakarta.websocket.server.ServerEndpoint Is there any more to that stack trace? -chris