You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Kushagra Bindal <bi...@gmail.com> on 2019/12/20 12:28:47 UTC

Exception while starting tomcat version 9.0.29

Hi,

We are working on upgrading our tomcat version from 8.5.24 to 9.0.29. In
this process, while starting one of our services we found that while
starting catalina.out is having some exception.

Note: This exception we are getting before start of tomcat.

20-Dec-2019 09:52:08.516 INFO [main]
org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The APR based
Apache Tomcat Native library which allows optimal performance in production
environments was not found on the java.library.path:
[/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib]
20-Dec-2019 09:52:09.099 INFO [main]
org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler
["http-nio-8080"]
20-Dec-2019 09:52:09.125 INFO [main]
org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler
["ajp-nio-8009"]
20-Dec-2019 09:52:09.127 INFO [main]
org.apache.catalina.startup.Catalina.load Server initialization in [1,231]
milliseconds
20-Dec-2019 09:52:09.144 WARNING [main]
org.apache.tomcat.jdbc.pool.DataSourceFactory.getObjectInstance
org.apache.catalina.UserDatabase is not a valid class name/type for this
JNDI factory.
20-Dec-2019 09:52:09.145 SEVERE [main]
org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans
Unexpected error creating MBeans
        java.lang.NullPointerException
                at
org.apache.naming.NamingContextBindingsEnumeration.nextElementInternal(NamingContextBindingsEnumeration.java:129)
                at
org.apache.naming.NamingContextBindingsEnumeration.next(NamingContextBindingsEnumeration.java:71)
                at
org.apache.naming.NamingContextBindingsEnumeration.next(NamingContextBindingsEnumeration.java:34)
                at
org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:127)
                at
org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans(GlobalResourcesLifecycleListener.java:101)
                at
org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.lifecycleEvent(GlobalResourcesLifecycleListener.java:76)
                at
org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
                at
org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:423)
                at
org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:366)
                at
org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:923)
                at
org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
                at
org.apache.catalina.startup.Catalina.start(Catalina.java:633)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
                at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
                at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                at java.lang.reflect.Method.invoke(Method.java:498)
                at
org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:343)
                at
org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:474)
20-Dec-2019 09:52:09.146 INFO [main]
org.apache.catalina.core.StandardService.startInternal Starting service
[Catalina]
20-Dec-2019 09:52:09.146 INFO [main]
org.apache.catalina.core.StandardEngine.startInternal Starting Servlet
engine: []
20-Dec-2019 09:52:09.148 SEVERE [main]
org.apache.catalina.realm.CombinedRealm.startInternal Failed to start
[org.apache.catalina.realm.UserDatabaseRealm] realm
        org.apache.catalina.LifecycleException: No UserDatabase component
found under key [UserDatabase]
                at
org.apache.catalina.realm.UserDatabaseRealm.startInternal(UserDatabaseRealm.java:215)
                at
org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
                at
org.apache.catalina.realm.CombinedRealm.startInternal(CombinedRealm.java:245)
                at
org.apache.catalina.realm.LockOutRealm.startInternal(LockOutRealm.java:115)
                at
org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
                at
org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:902)
                at
org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
                at
org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
                at
org.apache.catalina.core.StandardService.startInternal(StandardService.java:421)
                at
org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
                at
org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:930)
                at
org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
                at
org.apache.catalina.startup.Catalina.start(Catalina.java:633)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
                at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
                at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                at java.lang.reflect.Method.invoke(Method.java:498)
                at
org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:343)
                at
org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:474)

Below is the server.xml file details.


------------------------------------------------------------------------------------------------------------------

<?xml version='1.0' encoding='utf-8'?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<!-- Note:  A "Server" is not itself a "Container", so you may not
     define subcomponents such as "Valves" at this level.
     Documentation at /docs/config/server.html
 -->
<Server port="8005" shutdown="SHUTDOWN">
  <Listener className="org.apache.catalina.startup.VersionLoggerListener" />
  <!-- Security listener. Documentation at /docs/config/listeners.html
  <Listener className="org.apache.catalina.security.SecurityListener" />
  -->
  <!--APR library loader. Documentation at /docs/apr.html -->
  <Listener className="org.apache.catalina.core.AprLifecycleListener"
SSLEngine="on" />
  <!-- Prevent memory leaks due to use of particular java/javax APIs-->
  <Listener
className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
  <Listener
className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
  <Listener
className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />

  <!-- Global JNDI resources
       Documentation at /docs/jndi-resources-howto.html
  -->
  <GlobalNamingResources>
    <!-- Editable user database that can also be used by
         UserDatabaseRealm to authenticate users
    -->
    <Resource name="UserDatabase" auth="Container"
              type="org.apache.catalina.UserDatabase"
              description="User database that can be updated and saved"
              factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
 url="jdbc:postgresql://<<DBServer>>:5444/<<DBName>>?targetServerType=master&amp;currentSchema=common"
              pathname="conf/tomcat-users.xml" />
  </GlobalNamingResources>

  <!-- A "Service" is a collection of one or more "Connectors" that share
       a single "Container" Note:  A "Service" is not itself a "Container",
       so you may not define subcomponents such as "Valves" at this level.
       Documentation at /docs/config/service.html
   -->
  <Service name="Catalina">

    <!--The connectors can use a shared executor, you can define one or
more named thread pools-->
    <!--
    <Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
        maxThreads="150" minSpareThreads="4"/>
    -->


    <!-- A "Connector" represents an endpoint by which requests are received
         and responses are returned. Documentation at :
         Java HTTP Connector: /docs/config/http.html (blocking &
non-blocking)
         Java AJP  Connector: /docs/config/ajp.html
         APR (HTTP/AJP) Connector: /docs/apr.html
         Define a non-SSL/TLS HTTP/1.1 Connector on port 8080
    -->
    <Connector port="8080" protocol="HTTP/1.1"
          server=""
               connectionTimeout="20000"
               redirectPort="8443" />
    <!-- A "Connector" using the shared thread pool-->
    <!--
    <Connector executor="tomcatThreadPool"
               port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
    -->
    <!-- Define a SSL/TLS HTTP/1.1 Connector on port 8443
         This connector uses the NIO implementation that requires the JSSE
         style configuration. When using the APR/native implementation, the
         OpenSSL style configuration is required as described in the
APR/native
         documentation -->
    <!--
    <Connector port="8443"
protocol="org.apache.coyote.http11.Http11NioProtocol"
               maxThreads="150" SSLEnabled="true" scheme="https"
secure="true"
               clientAuth="false" sslProtocol="TLS" />
    -->

    <!-- Define an AJP 1.3 Connector on port 8009 -->
    <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />


    <!-- An Engine represents the entry point (within Catalina) that
processes
         every request.  The Engine implementation for Tomcat stand alone
         analyzes the HTTP headers included with the request, and passes
them
         on to the appropriate Host (virtual host).
         Documentation at /docs/config/engine.html -->

    <!-- You should set jvmRoute to support load-balancing via AJP ie :
    <Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">
    -->
    <Engine name="Catalina" defaultHost="localhost">

      <!--For clustering, please take a look at documentation at:
          /docs/cluster-howto.html  (simple how to)
          /docs/config/cluster.html (reference documentation) -->
      <!--
      <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
      -->

      <!-- Use the LockOutRealm to prevent attempts to guess user passwords
           via a brute-force attack -->
      <Realm className="org.apache.catalina.realm.LockOutRealm">
        <!-- This Realm uses the UserDatabase configured in the global JNDI
             resources under the key "UserDatabase".  Any edits
             that are performed against this UserDatabase are immediately
             available for use by the Realm.  -->
        <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
               resourceName="UserDatabase"/>
      </Realm>

      <Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true">

        <!-- SingleSignOn valve, share authentication between web
applications
             Documentation at: /docs/config/valve.html -->
        <!--
        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
        -->

        <!-- Access log processes all example.
             Documentation at: /docs/config/valve.html
             Note: The pattern used is equivalent to using pattern="common"
-->
        <Valve className="org.apache.catalina.valves.AccessLogValve"
directory="${install.dir}/${tomcat.log.dir}"
               prefix="localhost_access_log" suffix=".txt"
               pattern="%h %l %u %t &quot;%r&quot; %s %b" />


      </Host>
    </Engine>
  </Service>
</Server>


------------------------------------------------------------------------------------------------------------------


Please help in resolving the issue.
-- 
Regards,
Kushagra Bindal

Re: Exception while starting tomcat version 9.0.29

Posted by Kushagra Bindal <bi...@gmail.com>.
Thanks Olaf.. It worked..

On Fri, Dec 20, 2019 at 6:51 PM Olaf Kock <to...@olafkock.de> wrote:

>
> On 20.12.19 13:28, Kushagra Bindal wrote:
> > Hi,
> >
> > We are working on upgrading our tomcat version from 8.5.24 to 9.0.29. In
> > this process, while starting one of our services we found that while
> > starting catalina.out is having some exception.
> >
> > Note: This exception we are getting before start of tomcat.
> >
> > 20-Dec-2019 09:52:09.144 WARNING [main]
> > org.apache.tomcat.jdbc.pool.DataSourceFactory.getObjectInstance
> > org.apache.catalina.UserDatabase is not a valid class name/type for this
> > JNDI factory.
> > 20-Dec-2019 09:52:09.145 SEVERE [main]
> > org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans
> > Unexpected error creating MBeans
> >         java.lang.NullPointerException
> >                 at
> >
> org.apache.naming.NamingContextBindingsEnumeration.nextElementInternal(NamingContextBindingsEnumeration.java:129)
> >                 at
> >
> org.apache.naming.NamingContextBindingsEnumeration.next(NamingContextBindingsEnumeration.java:71)
> > ...
> > 20-Dec-2019 09:52:09.148 SEVERE [main]
> > org.apache.catalina.realm.CombinedRealm.startInternal Failed to start
> > [org.apache.catalina.realm.UserDatabaseRealm] realm
> >         org.apache.catalina.LifecycleException: No UserDatabase component
> > found under key [UserDatabase]
> > ...
> >
> > Below is the server.xml file details.
> >
> >
> >
> ------------------------------------------------------------------------------------------------------------------
> >
> > ...
> >     <Resource name="UserDatabase" auth="Container"
> >               type="org.apache.catalina.UserDatabase"
> >               description="User database that can be updated and saved"
> >               factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
> >
> url="jdbc:postgresql://<<DBServer>>:5444/<<DBName>>?targetServerType=master&amp;currentSchema=common"
> >               pathname="conf/tomcat-users.xml" />
> >   </GlobalNamingResources>
> > ...
> >
> >
> Phew, that server.xml would have been so much more readable if you'd
> removed all the commented xml before posting.
>
> Anyway, I've shortened the log and server.xml in my quote to what I
> assume is the cause for the error message. The stock server.xml contains
> a MemoryUserDatabaseFactory, while it looks like your declaration is for
> a generic JDBC connection.
>
>     <Resource name="UserDatabase" auth="Container"
>               type="org.apache.catalina.UserDatabase"
>               description="User database that can be updated and saved"
>               factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
>               pathname="conf/tomcat-users.xml" />
>
> From the top of my head I can't give you the right class name to use,
> but knowing this cause might put you on the right track.
>
> Olaf
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

-- 
Regards,
Kushagra Bindal
+91-9013792807

Re: Exception while starting tomcat version 9.0.29

Posted by Olaf Kock <to...@olafkock.de>.
On 20.12.19 13:28, Kushagra Bindal wrote:
> Hi,
>
> We are working on upgrading our tomcat version from 8.5.24 to 9.0.29. In
> this process, while starting one of our services we found that while
> starting catalina.out is having some exception.
>
> Note: This exception we are getting before start of tomcat.
>
> 20-Dec-2019 09:52:09.144 WARNING [main]
> org.apache.tomcat.jdbc.pool.DataSourceFactory.getObjectInstance
> org.apache.catalina.UserDatabase is not a valid class name/type for this
> JNDI factory.
> 20-Dec-2019 09:52:09.145 SEVERE [main]
> org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.createMBeans
> Unexpected error creating MBeans
>         java.lang.NullPointerException
>                 at
> org.apache.naming.NamingContextBindingsEnumeration.nextElementInternal(NamingContextBindingsEnumeration.java:129)
>                 at
> org.apache.naming.NamingContextBindingsEnumeration.next(NamingContextBindingsEnumeration.java:71)
> ...
> 20-Dec-2019 09:52:09.148 SEVERE [main]
> org.apache.catalina.realm.CombinedRealm.startInternal Failed to start
> [org.apache.catalina.realm.UserDatabaseRealm] realm
>         org.apache.catalina.LifecycleException: No UserDatabase component
> found under key [UserDatabase]
> ...
>
> Below is the server.xml file details.
>
>
> ------------------------------------------------------------------------------------------------------------------
>
> ...
>     <Resource name="UserDatabase" auth="Container"
>               type="org.apache.catalina.UserDatabase"
>               description="User database that can be updated and saved"
>               factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
>  url="jdbc:postgresql://<<DBServer>>:5444/<<DBName>>?targetServerType=master&amp;currentSchema=common"
>               pathname="conf/tomcat-users.xml" />
>   </GlobalNamingResources>
> ...
>
>
Phew, that server.xml would have been so much more readable if you'd
removed all the commented xml before posting.

Anyway, I've shortened the log and server.xml in my quote to what I
assume is the cause for the error message. The stock server.xml contains
a MemoryUserDatabaseFactory, while it looks like your declaration is for
a generic JDBC connection.

    <Resource name="UserDatabase" auth="Container"
              type="org.apache.catalina.UserDatabase"
              description="User database that can be updated and saved"
              factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
              pathname="conf/tomcat-users.xml" />

From the top of my head I can't give you the right class name to use,
but knowing this cause might put you on the right track.

Olaf




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