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

SoapHandlers with EJB + Servlet based Webservices are flaky #1377

Closed
matthiasblaesing opened this issue Feb 10, 2017 · 2 comments · Fixed by #1609
Closed

SoapHandlers with EJB + Servlet based Webservices are flaky #1377

matthiasblaesing opened this issue Feb 10, 2017 · 2 comments · Fixed by #1609
Assignees
Labels
Type: Bug Label issue as a bug defect
Milestone

Comments

@matthiasblaesing
Copy link
Contributor

Description


Summary: When EJBs and Servlet based Webservice Endpoints are used, SoapHandlers are configured and EJBs are injected into the Servlet based endpoint, the SoapHandlers are not always configured/instantiated correctly. This results in EJB based Webservices without SoapHandlers.

Steps to reproduce

  1. Startpoint: Get Payara 4.1.1.164 and expand it
  2. Start payaradomain: bin/asadmin start-domain payaradomain
  3. Clone https://github.com/matthiasblaesing/SoapHandlerEJBAndServlet.git
  4. Build with maven: mvn package
  5. Deploy resulting war https://github.com/matthiasblaesing/SoapHandlerEJBAndServlet.git into started server with context root SoapHandlerEJBAndServletServlet

This is the flaky step: If it does not happen immediately undeply and repeat deployment until message is logged:

[2017-02-10T21:10:31.736+0100] [Payara 4.1] [SEVERE] [AS-WSJSR109IMPL-00106] [javax.enterprise.webservices] [tid: _ThreadID=132 _ThreadName=admin-thread-pool(6)] [timeMillis: 1486757431736] [levelValue: 1000] [[
Handler eu.doppel_helix.dev.soaphandlerejbandservlet.TestHandler instance injection failed: Error creating managed object for class: class eu.doppel_helix.dev.soaphandlerejbandservlet.TestHandler]]

  1. Open http://localhost:8080/Endpoint1EjbService/Endpoint1Ejb?Tester and run method

Only "Dependency2#dummy called" but not the "Handler was called" from the soap handler

  1. Open http://localhost:8080/SoapHandlerEJBAndServlet/api?Tester and run method

"Dependency1#dummy called" is logged to verify EJB injection works in principle

Expected Outcome

In step 5: The SoapHandler should always be correctly instantiated
In step 6: "Dependency2#dummy called" and "Handler was called" should always be called

Current Outcome

In step 5: The SoapHandler is not instantiated/configured and
In step 6: The SoapHandler is not called when the ejb based webservice endpoint is accessed

Samples

https://github.com/matthiasblaesing/SoapHandlerEJBAndServlet.git

Investigation

The error in step 5 can be tracked down into the JSR-109 glassfish module. It is logged in:

org.glassfish.webservices.WsUtil.processConfiguredHandlers(List, Set)

The suppressed stacktrace:

Schwerwiegend: com.sun.enterprise.container.common.spi.util.InjectionException: Error creating managed object for class: class eu.doppel_helix.dev.soaphandlerejbandservlet.TestHandler
at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl.createManagedObject(InjectionManagerImpl.java:352)
at org.glassfish.webservices.WsUtil.processConfiguredHandlers(WsUtil.java:2015)
at org.glassfish.webservices.WsUtil.configureJAXWSServiceHandlers(WsUtil.java:2050)
at org.glassfish.webservices.EjbRuntimeEndpointInfo.prepareInvocation(EjbRuntimeEndpointInfo.java:260)
at org.glassfish.webservices.EjbRuntimeEndpointInfo.initRuntimeInfo(EjbRuntimeEndpointInfo.java:352)
at org.glassfish.webservices.WebServiceEjbEndpointRegistry.registerEndpoint(WebServiceEjbEndpointRegistry.java:125)
at com.sun.ejb.containers.BaseContainer.initializeHome(BaseContainer.java:1193)
at com.sun.ejb.containers.StatelessSessionContainer.initializeHome(StatelessSessionContainer.java:190)
at com.sun.ejb.containers.StatelessContainerFactory.createContainer(StatelessContainerFactory.java:63)
at org.glassfish.ejb.startup.EjbApplication.loadContainers(EjbApplication.java:224)
at org.glassfish.ejb.startup.EjbDeployer.load(EjbDeployer.java:290)
at org.glassfish.ejb.startup.EjbDeployer.load(EjbDeployer.java:100)
at org.glassfish.internal.data.ModuleInfo.load(ModuleInfo.java:206)
at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:314)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:497)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:220)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:487)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:539)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:535)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:534)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:565)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:557)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:556)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1464)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:109)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1846)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1722)
at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:534)
at com.sun.enterprise.v3.admin.AdminAdapter.onMissingResource(AdminAdapter.java:224)
at org.glassfish.grizzly.http.server.StaticHttpHandlerBase.service(StaticHttpHandlerBase.java:189)
at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:466)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:169)
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:235)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.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:526)
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.access$100(WorkerThreadIOStrategy.java:56)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:593)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:573)
at java.lang.Thread.run(Thread.java:745)
Caused by: com.sun.enterprise.container.common.spi.util.InjectionException: Exception attempting to inject Local ejb-ref name=eu.doppel_helix.dev.soaphandlerejbandservlet.Endpoint2Servlet/ejbTest,Local 3.x interface =eu.doppel_helix.dev.soaphandlerejbandservlet.Dependency1 resolved to intra-app EJB Dependency1 in module SoapHandlerEJBAndServlet,ejb-link=Dependency1,lookup=,mappedName=,jndi-name=,refType=Session into class eu.doppel_helix.dev.soaphandlerejbandservlet.TestHandler: Lookup failed for 'java:comp/env/eu.doppel_helix.dev.soaphandlerejbandservlet.Endpoint2Servlet/ejbTest' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming}
at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl._inject(InjectionManagerImpl.java:740)
at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl.inject(InjectionManagerImpl.java:507)
at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl.injectInstance(InjectionManagerImpl.java:141)
at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl.injectInstance(InjectionManagerImpl.java:127)
at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl.createManagedObject(InjectionManagerImpl.java:347)
... 52 more
Caused by: javax.naming.NamingException: Lookup failed for 'java:comp/env/eu.doppel_helix.dev.soaphandlerejbandservlet.Endpoint2Servlet/ejbTest' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming} [Root exception is javax.naming.NameNotFoundException: No object bound for java:comp/env/eu.doppel_helix.dev.soaphandlerejbandservlet.Endpoint2Servlet/ejbTest [Root exception is java.lang.NullPointerException]]
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:491)
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:438)
at javax.naming.InitialContext.lookup(InitialContext.java:417)
at javax.naming.InitialContext.lookup(InitialContext.java:417)
at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl._inject(InjectionManagerImpl.java:636)
... 56 more
Caused by: javax.naming.NameNotFoundException: No object bound for java:comp/env/eu.doppel_helix.dev.soaphandlerejbandservlet.Endpoint2Servlet/ejbTest [Root exception is java.lang.NullPointerException]
at com.sun.enterprise.naming.impl.JavaURLContext.lookup(JavaURLContext.java:229)
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:471)
... 60 more
Caused by: java.lang.NullPointerException
at com.sun.ejb.EJBUtils.resolveEjbRefObject(EJBUtils.java:363)
at com.sun.ejb.EjbNamingReferenceManagerImpl.resolveEjbReference(EjbNamingReferenceManagerImpl.java:200)
at com.sun.enterprise.container.common.impl.ComponentEnvManagerImpl$EjbReferenceProxy.create(ComponentEnvManagerImpl.java:1015)
at com.sun.enterprise.naming.impl.GlassfishNamingManagerImpl.lookup(GlassfishNamingManagerImpl.java:745)
at com.sun.enterprise.naming.impl.GlassfishNaming
Schwerwiegend: ManagerImpl.lookup(GlassfishNamingManagerImpl.java:715)
at com.sun.enterprise.naming.impl.JavaURLContext.lookup(JavaURLContext.java:159)
... 61 more

Environment

  • Payara Version: 4.1.1.164
  • Edition: Full
  • JDK Version: OpenJDK Runtime Environment (build 1.8.0_121-8u121-b13-0ubuntu1.16.10.2-b13)
  • Operating System: Ubuntu Yakkety

The problem was first observed on Windows 7, Oracle JDK 8u121, Payara 4.1.1.163.1

@khasunuma
Copy link

I try to your problem, but it's not reproduce yet. My current outcome is same as your expected one and I never happen the flaky step at the moment.

I believe the problem is investigated in various environments because the frequency of reproduce is currently unknown. I'll watch this issue and note if new information is appeared. Or other person may provide useful help. Please wait a moment.

FYI, my environment is following;

  • Payara Version: 4.1.1.164 (Multi-Language)
  • Edition: Full
  • JDK Version: Oracle JDK 8 Update 121 (build 1.8.0_121-b13) - Windows x64
  • Operating System: Windows 10 Pro Version 1607

@OndroMih OndroMih self-assigned this Mar 27, 2017
@fturizo fturizo self-assigned this Apr 25, 2017
@fturizo
Copy link
Contributor

fturizo commented Apr 28, 2017

Raised internal JIRA issue PAYARA-1613

@fturizo fturizo added Status: Accepted Confirmed defect or accepted improvement to implement, issue has been escalated to Platform Dev Type: Bug Label issue as a bug defect and removed 1:Investigating labels Apr 28, 2017
@lprimak lprimak added 3:DevInProgress and removed Status: Accepted Confirmed defect or accepted improvement to implement, issue has been escalated to Platform Dev labels May 18, 2017
@lprimak lprimak self-assigned this May 21, 2017
@fturizo fturizo removed the 4:Ready label Jun 5, 2017
@OndroMih OndroMih added this to the Payara 4.174 milestone Nov 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Label issue as a bug defect
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants