Re: 'for each' statements are only available if source level is 1.5 or greater

Mark Foley <[email protected]>
Newsgroups gmane.comp.jakarta.tomcat.user
Organization Novatec Software Engineering, LLC
Message-ID <[email protected]>
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" />

Why? Because many of the jsp files are linked to a common source.

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.

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>
      </Host>

I also installed tomcat-connectors 1.2.50 in /usr/lib64/httpd/modules/mod_jk.so.

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.

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. 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"

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

Thanks --Mark
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.