You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2021/07/30 06:21:54 UTC

[Bug 65476] New: Examples web application fails to start with Java 8 (NullPointerException at ExamplesConfig)

https://bz.apache.org/bugzilla/show_bug.cgi?id=65476

            Bug ID: 65476
           Summary: Examples web application fails to start with Java 8
                    (NullPointerException at ExamplesConfig)
           Product: Tomcat 9
           Version: unspecified
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Examples
          Assignee: dev@tomcat.apache.org
          Reporter: knst.kolinko@gmail.com
  Target Milestone: -----

Testing release candidates for Tomcat 9.0.51 and 10.0.9,
the examples web application fails to start when running with Java 8 (8u292).

Trying to access http://localhost:8080/examples/ results in error 404 and in an
NullPointerException in a log file.

See
https://markmail.org/message/rbgoaevos2f556sr
https://markmail.org/message/fnn57hj2zqeilmaf

The error goes away if I use Java 11 (11.0.11) or Java 16 (16.0.1).


Stacktrace for Tomcat 10.0.9 is the following:

[[[
org.apache.catalina.startup.HostConfig.deployDirectory Error deploying
web application directory [C:\Program Files\Apache Software
Foundation\Tomcat 10.0\webapps\examples]
    java.lang.IllegalStateException: Error starting child
        at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:729)
        [... - well-known, skipping]
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:476)
    Caused by: org.apache.catalina.LifecycleException: Failed to start
component
[StandardEngine[Catalina].StandardHost[localhost].StandardContext[/examples]]
        at
org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:440)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:198)
        at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:726)
        ... 37 more
    Caused by: java.lang.NullPointerException
        at
websocket.ExamplesConfig.getAnnotatedEndpointClasses(ExamplesConfig.java:60)
        at org.apache.tomcat.websocket.server.WsSci.onStartup(WsSci.java:111)
        at
org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5168)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
        ... 38 more
]]]

Source code of ExamplesConfig:
https://github.com/apache/tomcat/blob/10.0.9/webapps/examples/WEB-INF/classes/websocket/ExamplesConfig.java#L54

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 65476] Examples web application fails to start with Java 8 (NullPointerException at ExamplesConfig)

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65476

--- Comment #5 from Mark Thomas <ma...@apache.org> ---
I had just reached the same conclusion.

That changes was not intended to change the logic. Looking now...

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 65476] Examples web application fails to start with Java 8 (NullPointerException at ExamplesConfig)

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65476

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 65476] Examples web application fails to start with Java 8 (NullPointerException at ExamplesConfig)

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65476

Remy Maucherat <re...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|                            |All

--- Comment #1 from Remy Maucherat <re...@apache.org> ---
I did build with Java 8.

With Java 8 in that case, we have Class.getPacakge() that returns null (!).
With Java 11 it is not null, so it does not fail. The Class.getName() value is
fine (websocket.echo.EchoAnnotation in that case).

I don't see what there is to fix here, so far ...

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 65476] Examples web application fails to start with Java 8 (NullPointerException at ExamplesConfig)

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65476

--- Comment #6 from Mark Thomas <ma...@apache.org> ---
I see this issue. Will have a fix shortly...

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 65476] Examples web application fails to start with Java 8 (NullPointerException at ExamplesConfig)

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65476

--- Comment #3 from Mark Thomas <ma...@apache.org> ---
Scratch that. The Eclipse IDE UI is being unhelpful. It was showing the 10.1.x
branch history when I was working with 10.0.x.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 65476] Examples web application fails to start with Java 8 (NullPointerException at ExamplesConfig)

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65476

--- Comment #2 from Mark Thomas <ma...@apache.org> ---
It looks like some Java 11 stuff got back-ported that shouldn't have. Not sure
how I managed that...

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 65476] Examples web application fails to start with Java 8 (NullPointerException at ExamplesConfig)

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65476

--- Comment #4 from Remy Maucherat <re...@apache.org> ---
Ok, this is caused by d873f31ca0f64ba1f8c757b6e123196c3bc3de77 which apparently
only changes something for Java 8 [no idea why]. If the packages aren't defined
in the CL than it's normal that getPackage returns null and that explians the
behavior.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org