Error while starting Tomcat 8.5.14

2017-06-02 Thread Neha Munjal
Hi,

We have been trying to start Apache Tomcat 8.5.14 (JDK version 8.0_121-b13)
and land into the following error:

#

# A fatal error has been detected by the Java Runtime Environment:

#

#  SIGSEGV (0xb) at pc=0x7fafaa9ad123, pid=590, tid=0x7fb095cdc700

#

# JRE version: Java(TM) SE Runtime Environment (8.0_121-b13) (build
1.8.0_121-b13)

# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.121-b13 mixed mode
linux-amd64 compressed oops)

# Problematic frame:

# C  [libapr-1.so.0+0x25123]  apr_threadkey_private_set+0x3

#

# Core dump written. Default location: /opt/tomcat-8.5.14/bin/core or
core.590

#

# An error report file with more information is saved as:

# /tmp/hs_err_pid590.log


The log dump indicates the following problem:


Also, saw the following internal exceptions in the log dump:

Internal exceptions (10 events):

Event: 0.372 Thread 0x7f4d5400b800 Exception  (0x0003bfa226c0) thrown at
[/HUDSON3/workspace/8-2-build-linux-amd64/jdk8u121/8372/hotspot/src/share/vm/runtime/sharedRuntime.cpp,
line 605]

Event: 0.382 Thread 0x7f4d5400b800 Exception  (0x0003bfa48cb0) thrown at
[/HUDSON3/workspace/8-2-build-linux-amd64/jdk8u121/8372/hotspot/src/share/vm/runtime/sharedRuntime.cpp,
line 605]

Event: 0.392 Thread 0x7f4d5400b800 Exception  (0x0003bfa58800) thrown at
[/HUDSON3/workspace/8-2-build-linux-amd64/jdk8u121/8372/hotspot/src/share/vm/runtime/sharedRuntime.cpp,
line 605]

Event: 0.548 Thread 0x7f4d5400b800 Exception  (0x0003bec64a18) thrown
at
[/HUDSON3/workspace/8-2-build-linux-amd64/jdk8u121/8372/hotspot/src/share/vm/classfile/systemDictionary.cpp,
line 210]

Event: 0.556 Thread 0x7f4d5400b800 Exception  (0x0003bec89a98) thrown
at
[/HUDSON3/workspace/8-2-build-linux-amd64/jdk8u121/8372/hotspot/src/share/vm/classfile/systemDictionary.cpp,
line 210]

Event: 0.633 Thread 0x7f4d5400b800 Exception 
(0x0003beddd558) thrown at
[/HUDSON3/workspace/8-2-build-linux-amd64/jdk8u121/8372/hotspot/src/share/vm/prims/methodHandles.cpp,
line 1146]

Event: 0.635 Thread 0x7f4d5400b800 Exception 
(0x0003bedeb068) thrown at
[/HUDSON3/workspace/8-2-build-linux-amd64/jdk8u121/8372/hotspot/src/share/vm/prims/methodHandles.cpp,
line 1146]

Event: 0.747 Thread 0x7f4d5400b800 Exception 
(0x0003be2cae58) thrown at
[/HUDSON3/workspace/8-2-build-linux-amd64/jdk8u121/8372/hotspot/src/share/vm/classfile/systemDictionary.cpp

Event: 1.256 Thread 0x7f4d5400b800 Implicit null exception at
0x7f4d45611af5 to 0x7f4d45611f8d

Event: 1.279 Thread 0x7f4d5400b800 Exception  (0x0003bc6a0b68) thrown
at
[/HUDSON3/workspace/8-2-build-linux-amd64/jdk8u121/8372/hotspot/src/share/vm/classfile/systemDictionary.cpp,
line 210]


Can somebody provide hints towards the issue?

Please note that APR based Apache Tomcat Native library 1.2.12 using APR
version 1.4.5 is used.


Thanks

Neha


Re: [External] Re: Security Headers Implementation in Tomcat 6.x version

2017-06-02 Thread Olaf Kock


Am 02.06.2017 um 07:43 schrieb Shaik, Mohammad N.:
> Hi Chris, > > My actual requirement was to implement 7 HTTP headers, out of 
> which
4 are implemented in "HttpHeaderSecurityFilter". The remaining 3 headers
(Content-Security-Policy, Public-Key-Pins, X-Robots-Tag) are not
addressed in any of the filters available in Tomcat 7, 8 & 9 versions. >
> Is there any way that we implement these 3 headers in Tomcat?
Sure. Look at the implementation for the 4 headers you found. Add three
more, recompile. Alternatively, add another filter just for your 3 headers.

As you're creating a solution for you exclusively, you may even
completely hard code the values and conditions you need. There's no need
for configuration or making it "ready for prime time" as nobody else
will use this code under different circumstances.

Or write your own servlet filter for the webapps you deploy (no need to
go app-server side when the webapps do what's required themselves). In
those servlet filters, set those headers under conditions that you
determine yourself.

Or (again, sorry) utilize httpd's mod_headers.

Olaf



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



Re: Custom Webapp loading..

2017-06-02 Thread Violeta Georgieva
Hi,

2017-06-01 18:26 GMT+03:00 Hassan Khan :
>
> Any pointers to the problem .. pls... Have extended webapploader and use

Instead of extending the class loader you might consider the new Web
Application Resources feature:
http://tomcat.apache.org/tomcat-8.5-doc/config/resources.html

Regards,
Violeta

> the below function for adding jar in tomcat 6... for tomcat 8.5 the jar
are
> loading but not getting included in the classpath somehow...
> /**
>  * reflectively add a jar to the classloader. This only works when
> called after super.start() has completed.
>  */
> private void addJar(final File jarRealFile) {
> try {
> final String jarPath = getFilePathRelativeToBase(jarRealFile);
> final JarFile jarFile = new JarFile(jarRealFile);
> final ClassLoader cl = getClassLoader();
> if (cl instanceof WebappClassLoader) {
> final WebappClassLoader wcl = (WebappClassLoader) cl;
> final Class clazz = WebappClassLoader.class;
> final Method addJar = clazz.getDeclaredMethod("addJar",
new
> Class[]{String.class, JarFile.class, File.class});
> addJar.setAccessible(true);
> addJar.invoke(wcl, jarPath, jarFile, jarRealFile);
> }
> log("added jar " + jarRealFile.getCanonicalPath());
> }
> catch (IOException e) {
> log("Exception accessing jar file: " + jarRealFile + ": " +
> e.getMessage());
> }
> catch (SecurityException e) {
> log("Exception finding method in WebappClassLoader to add jar
> file: " + jarRealFile + ": " + e.getMessage());
> }
> catch (NoSuchMethodException e) {
> log("Exception finding method in WebappClassLoader to add jar
> file: " + jarRealFile + ": " + e.getMessage());
> }
> catch (IllegalArgumentException e) {
> log("Exception calling method in WebappClassLoader to add jar
> file: " + jarRealFile + ": " + e.getMessage());
> }
> catch (IllegalAccessException e) {
> log("Exception calling method in WebappClassLoader to add jar
> file: " + jarRealFile + ": " + e.getMessage());
> }
> catch (InvocationTargetException e) {
> log("Exception calling method in WebappClassLoader to add jar
> file: " + jarRealFile + ": " + e.getMessage());
> }
> }
>
> Thanks
>
>
>
>
> On Wed, May 31, 2017 at 5:13 PM, Hassan Khan 
> wrote:
>
> > So the precise exception is Only a type can be imported. ABC resolves
to a
> > package..
> >
> > Stacktrace is :
> > at org.apache.jasper.compiler.DefaultErrorHandler.javacError(
> > DefaultErrorHandler.java:102)
> > at org.apache.jasper.compiler.ErrorDispatcher.javacError(
> > ErrorDispatcher.java:212)
> > at org.apache.jasper.compiler.JDTCompiler.generateClass(
> > JDTCompiler.java:457)
> > at org.apache.jasper.compiler.Compiler.compile(Compiler.java:377)
> > at org.apache.jasper.compiler.Compiler.compile(Compiler.java:349)
> > at org.apache.jasper.compiler.Compiler.compile(Compiler.java:333)
> > at org.apache.jasper.JspCompilationContext.compile(
> > JspCompilationContext.java:600)
> > at org.apache.jasper.servlet.JspServletWrapper.service(
> > JspServletWrapper.java:368)
> > at org.apache.jasper.servlet.JspServlet.serviceJspFile(
> > JspServlet.java:385)
> > at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:329)
> > at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
> > at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
> > ApplicationFilterChain.java:231)
> > at org.apache.catalina.core.ApplicationFilterChain.doFilter(
> > ApplicationFilterChain.java:166)
> > at org.apache.catalina.core.ApplicationDispatcher.invoke(
> > ApplicationDispatcher.java:728)
> > at org.apache.catalina.core.ApplicationDispatcher.doInclude(
> > ApplicationDispatcher.java:590)
> > at org.apache.catalina.core.ApplicationDispatcher.include(
> > ApplicationDispatcher.java:524)
> > at org.apache.jasper.runtime.JspRuntimeLibrary.include(
> > JspRuntimeLibrary.java:895)
> > at org.apache.jsp.iNexx.common._005fshinglesTop_jsp._
> > jspService(_005fshinglesTop_jsp.java:385) ==> JSP page called from the
> > main webapp referencing the modular apps
> >
> >
> >
> > On Wed, May 31, 2017 at 5:05 PM, Hassan Khan 
> > wrote:
> >
> >> Hi,
> >>
> >> We have a main webapp (Tomcat\Webapp) that has many modular webapps (
> >> (Tomcat\Webapp\app\) under it that can be removed and added by the
user.
> >> The main webapp has the service and connectors , but the modular
webapps
> >> do not need it.
> >>
> >> The problem is currently when the main webapp tries to access a jar in
> >> the modular webapps lib dir... we have a class not found exception..
that
> >> is why we need to load the jars from