You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Tamás Barta <ba...@gmail.com> on 2020/11/10 18:18:58 UTC

Tomcat - Sentry configuration problem

Hi,

I tried to configure Sentry with Tomcat but I failed. I would like to use
the Java Logging appender. I guess I have to add sentry jars to bootstrap
jars, so I created setenv.sh with this content:

jackson-core-2.8.10.jar
sentry-1.7.29.jar
slf4j-api-1.7.24.jar

Of course I set logging.properties and sentry system properties too. It
works (I see Sentry entries in server database), but the web application
won't work anymore. Deploying fails with this error message:

10-Nov-2020 19:05:06.846 INFO [localhost-startStop-1]
org.apache.catalina.startup.HostConfig.deployWAR Deploying web application
archive
[/opt/tomcat/apache-tomcat-8.5.23/webapps/ReplicationService-0.0.1-SNAPSHOT.war]
10-Nov-2020 19:05:07.096 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
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

If I remove setenv.sh then the application itself works, but Sentry
doesn't. Do you have any idea why configuring Sentry jars cause this
problem? Why Servlet API won't be found for the app?

Thanks, Tamás

Re: Tomcat - Sentry configuration problem

Posted by Martin Grigorov <mg...@apache.org>.
On Wed, Nov 11, 2020 at 3:16 PM Tamás Barta <ba...@gmail.com> wrote:

> Hi,
>
> > Why do you use 1.7.29 ?
>
> Because our company has a Sentry server supports this version of clients.
>
> > Do you specify this class name in logging.properties ? Is
> this class in 1.7.29 ?
>
> Yes and yes. If I add sentry jars to classpath, sentry works well.
> Exceptions are sent to the server and visible in web interface.
>
> > You just need to add it as a normal Maven dependency.
>
> Maven dependency is needed only If I would like to use Sentry in code. But
> I don't.
>
> > If you need to really put it on the bootstrap.
>
> When I say bootstrap I mean Tomcat bootstrap:
> https://tomcat.apache.org/tomcat-8.0-doc/class-loader-howto.html
> Which is standard java classpath, I see.
>
> BTW if I add jars to java bootclasspath, I got the same error.
>
> Just a very interesting test: if I add an empty JAR (no class files in it)
> file to setenv.sh (no Sentry jars at all) that I got the same error.
> It seems that adding an empty jar to classpath case this classloading
> problem :(
>

I've just tested this on 10.0.0-M9

Using CATALINA_BASE:   /home/martin/devel/apache-tomcat-10.0.0-M9
Using CATALINA_HOME:   /home/martin/devel/apache-tomcat-10.0.0-M9
Using CATALINA_TMPDIR: /home/martin/devel/apache-tomcat-10.0.0-M9/temp
Using JRE_HOME:        /home/martin/devel/jdk-15
Using CLASSPATH:
:/home/martin/devel/apache-tomcat-10.0.0-M9/empty.jar:/home/martin/devel/apache-tomcat-10.0.0-M9/bin/bootstrap.jar:/home/martin/devel/apache-tomcat-10.0.0-M9/bin/tomcat-juli.jar
Using CATALINA_OPTS:
NOTE: Picked up JDK_JAVA_OPTIONS:
 --add-opens=java.base/java.lang=ALL-UNNAMED
--add-opens=java.base/java.io=ALL-UNNAMED
--add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED

$ cat bin/setenv.sh
export CLASSPATH=$CLASSPATH:$CATALINA_BASE/empty.jar

$ ll empty.jar
-rw-r----- 1 martin martin 22 ное 11 15:48 empty.jar

$ jar --list -f empty.jar


There is no problem with loading this empty jar and there are no class
loading issues either.



>
> Regards, Tamas
>
>
>
>
>
>
> On Wed, Nov 11, 2020 at 12:33 PM Martin Grigorov <mg...@apache.org>
> wrote:
>
> > Hi,
> >
> > On Wed, Nov 11, 2020 at 11:20 AM Tamás Barta <ba...@gmail.com>
> wrote:
> >
> > > 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 haven't used Sentry before so I just looked it up.
> > https://docs.sentry.io/platforms/java/usage/ says that the current
> version
> > is 3.1.1. Why do you use 1.7.29 ? There is no io.sentry.jul.SentryHandler
> > class in 3.1.1. Do you specify this class name in logging.properties ? Is
> > this class in 1.7.29 ?
> > There is nothing about "bootstrap" on
> > https://docs.sentry.io/platforms/java/usage/ or at
> > https://docs.sentry.io/platforms/java/guides/spring-boot/. You just need
> > to
> > add it as a normal Maven dependency.
> > If you need to really put it on the bootstrap path then you need to use
> > -Xbootclasspath:...
> > By using CLASSPATH=$CLASSPATH:... you actually *append* jars to the
> > classpath, while you sound like you need to *prepend* to it.
> >
> >
> > >
> > > 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 <mg...@apache.org>
> > > wrote:
> > >
> > > > Hi,
> > > >
> > > > On Wed, Nov 11, 2020 at 10:36 AM Tamás Barta <ba...@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 <
> > > > > chris@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-unsubscribe@tomcat.apache.org
> > > > > > For additional commands, e-mail: users-help@tomcat.apache.org
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>

Re: Tomcat - Sentry configuration problem

Posted by Tamás Barta <ba...@gmail.com>.
Hi,

> Why do you use 1.7.29 ?

Because our company has a Sentry server supports this version of clients.

> Do you specify this class name in logging.properties ? Is
this class in 1.7.29 ?

Yes and yes. If I add sentry jars to classpath, sentry works well.
Exceptions are sent to the server and visible in web interface.

> You just need to add it as a normal Maven dependency.

Maven dependency is needed only If I would like to use Sentry in code. But
I don't.

> If you need to really put it on the bootstrap.

When I say bootstrap I mean Tomcat bootstrap:
https://tomcat.apache.org/tomcat-8.0-doc/class-loader-howto.html
Which is standard java classpath, I see.

BTW if I add jars to java bootclasspath, I got the same error.

Just a very interesting test: if I add an empty JAR (no class files in it)
file to setenv.sh (no Sentry jars at all) that I got the same error.
It seems that adding an empty jar to classpath case this classloading
problem :(

Regards, Tamas






On Wed, Nov 11, 2020 at 12:33 PM Martin Grigorov <mg...@apache.org>
wrote:

> Hi,
>
> On Wed, Nov 11, 2020 at 11:20 AM Tamás Barta <ba...@gmail.com> wrote:
>
> > 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 haven't used Sentry before so I just looked it up.
> https://docs.sentry.io/platforms/java/usage/ says that the current version
> is 3.1.1. Why do you use 1.7.29 ? There is no io.sentry.jul.SentryHandler
> class in 3.1.1. Do you specify this class name in logging.properties ? Is
> this class in 1.7.29 ?
> There is nothing about "bootstrap" on
> https://docs.sentry.io/platforms/java/usage/ or at
> https://docs.sentry.io/platforms/java/guides/spring-boot/. You just need
> to
> add it as a normal Maven dependency.
> If you need to really put it on the bootstrap path then you need to use
> -Xbootclasspath:...
> By using CLASSPATH=$CLASSPATH:... you actually *append* jars to the
> classpath, while you sound like you need to *prepend* to it.
>
>
> >
> > 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 <mg...@apache.org>
> > wrote:
> >
> > > Hi,
> > >
> > > On Wed, Nov 11, 2020 at 10:36 AM Tamás Barta <ba...@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 <
> > > > chris@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-unsubscribe@tomcat.apache.org
> > > > > For additional commands, e-mail: users-help@tomcat.apache.org
> > > > >
> > > > >
> > > >
> > >
> >
>

Re: Tomcat - Sentry configuration problem

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

On Wed, Nov 11, 2020 at 11:20 AM Tamás Barta <ba...@gmail.com> wrote:

> 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 haven't used Sentry before so I just looked it up.
https://docs.sentry.io/platforms/java/usage/ says that the current version
is 3.1.1. Why do you use 1.7.29 ? There is no io.sentry.jul.SentryHandler
class in 3.1.1. Do you specify this class name in logging.properties ? Is
this class in 1.7.29 ?
There is nothing about "bootstrap" on
https://docs.sentry.io/platforms/java/usage/ or at
https://docs.sentry.io/platforms/java/guides/spring-boot/. You just need to
add it as a normal Maven dependency.
If you need to really put it on the bootstrap path then you need to use
-Xbootclasspath:...
By using CLASSPATH=$CLASSPATH:... you actually *append* jars to the
classpath, while you sound like you need to *prepend* to it.


>
> 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 <mg...@apache.org>
> wrote:
>
> > Hi,
> >
> > On Wed, Nov 11, 2020 at 10:36 AM Tamás Barta <ba...@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 <
> > > chris@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-unsubscribe@tomcat.apache.org
> > > > For additional commands, e-mail: users-help@tomcat.apache.org
> > > >
> > > >
> > >
> >
>

Re: Tomcat - Sentry configuration problem

Posted by Tamás Barta <ba...@gmail.com>.
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 <mg...@apache.org>
wrote:

> Hi,
>
> On Wed, Nov 11, 2020 at 10:36 AM Tamás Barta <ba...@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 <
> > chris@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-unsubscribe@tomcat.apache.org
> > > For additional commands, e-mail: users-help@tomcat.apache.org
> > >
> > >
> >
>

Re: Tomcat - Sentry configuration problem

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

On Wed, Nov 11, 2020 at 10:36 AM Tamás Barta <ba...@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 <
> chris@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-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >
> >
>

Re: Tomcat - Sentry configuration problem

Posted by Tamás Barta <ba...@gmail.com>.
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
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 <
chris@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-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: Tomcat - Sentry configuration problem

Posted by Christopher Schultz <ch...@christopherschultz.net>.
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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Tomcat - Sentry configuration problem

Posted by Tamás Barta <ba...@gmail.com>.
Hi,

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.

Thanks, Tamás






On Tue, Nov 10, 2020 at 9:23 PM Christopher Schultz <
chris@christopherschultz.net> wrote:

> Tamás,
>
> On 11/10/20 13:18, Tamás Barta wrote:
> > Hi,
> >
> > I tried to configure Sentry with Tomcat but I failed. I would like to use
> > the Java Logging appender. I guess I have to add sentry jars to bootstrap
> > jars, so I created setenv.sh with this content:
> >
> > jackson-core-2.8.10.jar
> > sentry-1.7.29.jar
> > slf4j-api-1.7.24.jar
>
> That's not a valid .sh script. Can you be more specific about what you
> did with setenv.sh?
>
> > Of course I set logging.properties and sentry system properties too. It
> > works (I see Sentry entries in server database), but the web application
> > won't work anymore. Deploying fails with this error message:
> >
> > 10-Nov-2020 19:05:06.846 INFO [localhost-startStop-1]
> > org.apache.catalina.startup.HostConfig.deployWAR Deploying web
> application
> > archive
> >
> [/opt/tomcat/apache-tomcat-8.5.23/webapps/ReplicationService-0.0.1-SNAPSHOT.war]
> > 10-Nov-2020 19:05:07.096 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
>
> Did you use MAven to build your project? Did it pull-in any dependencies
> such as the servlet-api into your application? That shouldn't happen
> (Tomcat prevents other JAR files from replacing certain classes,
> including anything in javax.servlet.*) but it might cause some errors.
>
> > If I remove setenv.sh then the application itself works, but Sentry
> > doesn't. Do you have any idea why configuring Sentry jars cause this
> > problem? Why Servlet API won't be found for the app?
>
> I think we're going to need to see what's in your setenv.sh.
>
> -chris
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: Tomcat - Sentry configuration problem

Posted by Christopher Schultz <ch...@christopherschultz.net>.
Tamás,

On 11/10/20 13:18, Tamás Barta wrote:
> Hi,
> 
> I tried to configure Sentry with Tomcat but I failed. I would like to use
> the Java Logging appender. I guess I have to add sentry jars to bootstrap
> jars, so I created setenv.sh with this content:
> 
> jackson-core-2.8.10.jar
> sentry-1.7.29.jar
> slf4j-api-1.7.24.jar

That's not a valid .sh script. Can you be more specific about what you 
did with setenv.sh?

> Of course I set logging.properties and sentry system properties too. It
> works (I see Sentry entries in server database), but the web application
> won't work anymore. Deploying fails with this error message:
> 
> 10-Nov-2020 19:05:06.846 INFO [localhost-startStop-1]
> org.apache.catalina.startup.HostConfig.deployWAR Deploying web application
> archive
> [/opt/tomcat/apache-tomcat-8.5.23/webapps/ReplicationService-0.0.1-SNAPSHOT.war]
> 10-Nov-2020 19:05:07.096 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

Did you use MAven to build your project? Did it pull-in any dependencies 
such as the servlet-api into your application? That shouldn't happen 
(Tomcat prevents other JAR files from replacing certain classes, 
including anything in javax.servlet.*) but it might cause some errors.

> If I remove setenv.sh then the application itself works, but Sentry
> doesn't. Do you have any idea why configuring Sentry jars cause this
> problem? Why Servlet API won't be found for the app?

I think we're going to need to see what's in your setenv.sh.

-chris

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