Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NPEx on unboxing null Boolean in FilterDefDecorator.isAsyncSupported #22406

Closed
glassfishrobot opened this issue Jan 20, 2018 · 2 comments · Fixed by #22871
Closed

NPEx on unboxing null Boolean in FilterDefDecorator.isAsyncSupported #22406

glassfishrobot opened this issue Jan 20, 2018 · 2 comments · Fixed by #22871

Comments

@glassfishrobot
Copy link

Environment Details

  • GlassFish Version (and build number): GlassFish Server Open Source Edition 5.0 (build 25)
  • JDK version: openjdk version "1.8.0_151"
  • OS: Fedora, 4.14.13-300.fc27.x86_64
  • Database: none

Problem Description

Currently: Request ends with HTTP 500 due to NullPointerException.

WEB module deployed in EAR can not configure WebFilter for CDI Conversation Filter (as described in weld docs).
The same WEB module deployed as separate war works fine.

As in
https://github.com/javaee/glassfish/blob/168ce449c4ea0826842ab4129e83c4a700750970/appserver/web/web-glue/src/main/java/com/sun/enterprise/web/deploy/FilterDefDecorator.java#L116-L118
decoree.isAsyncSupported returns null.
Looks like https://github.com/javaee/glassfish/blob/2dcc0e6fe0990da170385fca6fd0145dd82886bc/appserver/web/weld-integration/src/main/java/org/glassfish/weld/WeldDeployer.java#L528-L534 is not setting this property and FilterDefDecorator is not prepared for such case.

Expected: Request completes being successfully WebFiltered.

Can be reproduced easily.

Similar described at clone project: payara/Payara#1905.

Stack trace:

    java.lang.NullPointerException
    at com.sun.enterprise.web.deploy.FilterDefDecorator.isAsyncSupported(FilterDefDecorator.java:121)
    at org.apache.catalina.core.ApplicationFilterConfig.isAsyncSupported(ApplicationFilterConfig.java:180)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:225)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:652)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:591)
    at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)
    at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:371)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:238)
    at com.sun.enterprise.v3.services.impl.ContainerMapper.call(ContainerMapper.java:463)
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:168)
    at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:206)
    at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:180)
    at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:242)
    at org.glassfish.grizzly.filterchain.ExecutorResolver.execute(ExecutorResolver.java:119)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
    at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
    at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:539)
    at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access00(WorkerThreadIOStrategy.java:56)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run(WorkerThreadIOStrategy.java:137)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool.doWork(AbstractThreadPool.java:593)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool.run(AbstractThreadPool.java:573)
    at java.lang.Thread.run(Thread.java:748)

Steps to reproduce

  1. Build project referenced below in Sample code section.
  2. Deploy produced war/target/weld_filter_npex-war-1-SNAPSHOT.war.
  3. Navigate to context war was deployed at (/weld_filter_npex-war-1-SNAPSHOT).
  4. Observe welcome page.
  5. Deploy produced ear/target/weld_filter_npex-ear-1-SNAPSHOT.ear.
  6. Navigate to context ear's web module was deployed at (/weld_filter).
  7. Instead of Welcome page observe HTTP Status 500 - Internal Server Error.

Sample code

https://github.com/pzygielo/glassfish/tree/filter_weld_issue

Impact of Issue

For application deployed as EAR it is not possible to configure filter chain that includes CDI Conversation Filter.

@glassfishrobot
Copy link
Author

@pzygielo
Copy link
Contributor

Edit: updated for local project files +current GF version +current stack trace +sample code location

Environment Details

* GlassFish Version (and build number): GlassFish Server Open Source Edition  5.1.0
* JDK version: openjdk version "1.8.0_212"
* OS: Fedora, 5.1.11-300.fc30.x86_64
* Database: none

Problem Description

Currently: Request ends with HTTP 500 due to NullPointerException.

WEB module deployed in EAR can not configure WebFilter for CDI Conversation Filter (as described in weld docs).
The same WEB module deployed as separate war works fine.

As in

public boolean isAsyncSupported() {
return decoree.isAsyncSupported();
}

decoree.isAsyncSupported returns null (thus NPEx on unboxing).
Looks like
if (WELD_CONVERSATION_FILTER_NAME.equals(displayName)) {
ServletFilterDescriptor ref = new ServletFilterDescriptor();
ref.setClassName(WELD_CONVERSATION_FILTER_CLASS);
ref.setName(WELD_CONVERSATION_FILTER_NAME);
wDesc.addServletFilter(ref);
break;
}
is not setting this property and FilterDefDecorator is not prepared for such case.

Expected: Request completes being successfully WebFiltered.

Can be reproduced easily.

Similar described at clone project: payara/Payara#1905.

Stack trace:

java.lang.NullPointerException
	at com.sun.enterprise.web.deploy.FilterDefDecorator.isAsyncSupported(FilterDefDecorator.java:93)
	at org.apache.catalina.core.ApplicationFilterConfig.isAsyncSupported(ApplicationFilterConfig.java:139)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:184)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:167)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:215)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:119)
	at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:611)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:550)
	at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:75)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:114)
	at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:332)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:199)
	at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:439)
	at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:144)
	at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:182)
	at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:156)
	at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:218)
	at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:95)
	at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:260)
	at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:177)
	at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:109)
	at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:88)
	at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:53)
	at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:515)
	at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:89)
	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:94)
	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:33)
	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:114)
	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:569)
	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:549)
	at java.lang.Thread.run(Thread.java:748)

Steps to reproduce

1. Build project referenced below in _Sample code_ section.
2. Deploy produced `war/target/weld_filter_npex-war-1-SNAPSHOT.war`.
3. Navigate to context `war` was deployed at (`/weld_filter_npex-war-1-SNAPSHOT`).
4. Observe welcome page.
5. Deploy produced `ear/target/weld_filter_npex-ear-1-SNAPSHOT.ear`.
6. Navigate to context ear's web module was deployed at (`/weld_filter`).
7. Instead of Welcome page observe `HTTP Status 500 - Internal Server Error`.

Sample code

https://github.com/pzrep/gf_22406

Impact of Issue

For application deployed as EAR it is not possible to configure filter chain that includes CDI Conversation Filter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants