Hi,

The ways you wrote is not usable, because they cause the following problem:

Handler error
java.lang.ClassNotFoundException: io.sentry.jul.SentryHandler
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:338)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        at
org.apache.juli.ClassLoaderLogManager.readConfiguration(ClassLoaderLogManager.java:582)
        at
org.apache.juli.ClassLoaderLogManager.readConfiguration(ClassLoaderLogManager.java:524)
        at
org.apache.juli.ClassLoaderLogManager.readConfiguration(ClassLoaderLogManager.java:322)
        at java.util.logging.LogManager$3.run(LogManager.java:399)
        at java.util.logging.LogManager$3.run(LogManager.java:396)
        at java.security.AccessController.doPrivileged(Native Method)
        at
java.util.logging.LogManager.readPrimordialConfiguration(LogManager.java:396)
        at java.util.logging.LogManager.access$800(LogManager.java:145)
        at java.util.logging.LogManager$2.run(LogManager.java:345)
        at java.security.AccessController.doPrivileged(Native Method)
        at
java.util.logging.LogManager.ensureLogManagerInitialized(LogManager.java:338)
        at java.util.logging.LogManager.getLogManager(LogManager.java:378)
        at java.util.logging.Logger.demandLogger(Logger.java:448)
        at java.util.logging.Logger.getLogger(Logger.java:502)
        at org.apache.juli.logging.DirectJDKLog.<init>(DirectJDKLog.java:67)
        at
org.apache.juli.logging.DirectJDKLog.getInstance(DirectJDKLog.java:187)
        at
org.apache.juli.logging.LogFactory.getInstance(LogFactory.java:117)
        at
org.apache.juli.logging.LogFactory.getInstance(LogFactory.java:141)
        at org.apache.juli.logging.LogFactory.getLog(LogFactory.java:196)
        at org.apache.catalina.startup.Bootstrap.<clinit>(Bootstrap.java:52)
10-Nov-2020 17:44:11.137 INFO [main]
org.apache.catalina.startup.VersionLoggerListener.log Server version:
 Apache Tomcat/8.5.23
10-Nov-2020 17:44:11.139 INFO [main]
org.apache.catalina.startup.VersionLoggerListener.log Server built:
 Sep 28 2017 10:30:11 UTC
...

The Sentry log handler must be in Boostrap jars, it must be loaded before
web application and before jars in $CATALINA_BASE/lib. If I am right, the
best way to do that is by setting it in setenv.sh.

I can't imagine how could it be possible without setting sentry jar the web
application works well, there is no problem, but if I add sentry-1.7.29.jar
to classpath then ServletContainerInitializer won't be found by Catalina.
This class is only in $CATALINA_BASE/lib/servlet-api.jar.

Thanks, Tamás

On Wed, Nov 11, 2020 at 9:46 AM Martin Grigorov <mgrigo...@apache.org>
wrote:

> Hi,
>
> On Wed, Nov 11, 2020 at 10:36 AM Tamás Barta <bartata...@gmail.com> wrote:
>
> > Hi,
> >
> > Now it is a Spring Boot web application project without embedded tomcat.
> > There is no library in war with javax.servlet api classes. There error is
> > the same:
> >
> > 11-Nov-2020 09:34:06.719 SEVERE [localhost-startStop-1]
> > org.apache.catalina.core.ContainerBase.addChildInternal
> > ContainerBase.addChild: start:
> >  org.apache.catalina.LifecycleException: Failed to start component
> >
> >
> [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/ReplicationService-0.0.1-SNAPSHOT]]
> > at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
> > at
> >
> >
> org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752)
> > at
> org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728)
> > at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
> > at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:988)
> > at
> >
> org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1860)
> > at
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
> > at java.util.concurrent.FutureTask.run(FutureTask.java:266)
> > at
> >
> >
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
> > at
> >
> >
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
> > at java.lang.Thread.run(Thread.java:748)
> > Caused by: java.lang.NoClassDefFoundError:
> > javax/servlet/ServletContainerInitializer
> > at java.lang.ClassLoader.defineClass1(Native Method)
> > at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
> > at
> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
> > at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
> > at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
> > at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
> > at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
> > at java.security.AccessController.doPrivileged(Native Method)
> > at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
> > at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
> > at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:338)
> > at java.lang.ClassLoader.loadClass(ClassLoader.java:411)
> > at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
> > at java.lang.Class.forName0(Native Method)
> > at java.lang.Class.forName(Class.java:348)
> > at
> >
> >
> org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1277)
> > at
> >
> >
> org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1119)
> > at java.lang.Class.forName0(Native Method)
> > at java.lang.Class.forName(Class.java:348)
> > at
> >
> >
> org.apache.catalina.startup.WebappServiceLoader.loadServices(WebappServiceLoader.java:188)
> > at
> >
> >
> org.apache.catalina.startup.WebappServiceLoader.load(WebappServiceLoader.java:159)
> > at
> >
> >
> org.apache.catalina.startup.ContextConfig.processServletContainerInitializers(ContextConfig.java:1622)
> > at
> >
> >
> org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1135)
> > at
> >
> >
> org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:775)
> > at
> >
> >
> org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:299)
> > at
> >
> >
> org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:94)
> > at
> >
> >
> org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5105)
> > at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
> > ... 10 more
> > Caused by: java.lang.ClassNotFoundException:
> > javax.servlet.ServletContainerInitializer
> >
>
> Definitely you mess up the classpath and there are none or more than one
> servlet-api.jar in the classpath.
>
> What happens if you put your sentry related jars in the .war file
> (/WEB-INF/lib/) ? I.e. add them as proper Maven dependencies
> Or if you put them in $CATALINA_BASE/lib ?
> Why did you go with editing setenv.sh in first place ?
>
>
> > at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
> > at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
> > at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:338)
> > at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
> > ... 38 more
> >
> > On Tue, Nov 10, 2020 at 11:28 PM Christopher Schultz <
> > ch...@christopherschultz.net> wrote:
> >
> > > Tamás,
> > >
> > > On 11/10/20 15:42, Tamás Barta wrote:
> > > > This is the content of setenv.sh:
> > > >
> > > > CLASSPATH=$CLASSPATH:$CATALINA_BASE/sentry/sentry-1.7.29.jar
> > > > CLASSPATH=$CLASSPATH:$CATALINA_BASE/sentry/slf4j-api-1.7.24.jar
> > > > CLASSPATH=$CLASSPATH:$CATALINA_BASE/sentry/jackson-core-2.8.10.jar
> > > >
> > > > The web application without this sentry configuration works well for
> > > ages.
> > > > But if I add the above configuration, it won't.
> > > >
> > > > Yes, it is a maven project, now I checked and I see that there are
> > Tomcat
> > > > jar-s in it:
> > > >
> > > > tomcat-annotations-api-8.5.23.jar  tomcat-embed-core-8.5.23.jar
> > > >   tomcat-embed-el-8.5.23.jar  tomcat-embed-websocket-8.5.23.jar
> > > > tomcat-jdbc-8.5.23.jar tomcat-juli-8.5.23.jar
> > > >
> > > > Maybe the problem is that Spring Boot application contains embed
> Tomcat
> > > > jars? This is very interesting that this extra Sentry jar in
> classpath
> > > > cause this problem.
> > >
> > > Wait... you are using Spring Boot and you are also using setenv.sh?
> > >
> > > I'm very confused.
> > >
> > > I wouldn't expect Sentry and its dependencies to cause a problem.
> > >
> > > -chris
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> > > For additional commands, e-mail: users-h...@tomcat.apache.org
> > >
> > >
> >
>

Reply via email to