]
Alessio Soldano commented on WFLY-3262:
---------------------------------------
Thanks for the investigation Rebecca. Honestly, I don't think the web metadata created
for a EJB3 WS endpoint should be different (load on startup or not) depending on the
existence of webservicerefs in servlets being loaded on startup. Perhaps we could see if
we can have a more verbose error message clarifying that the wsdl requested for the ws
refs was not available at the time the refs are being injected, possibly because the refs
are being resolved before the referenced service has been started.
This said, the user can make the endpoint servlet start on load in the case of POJO WS
endpoints. That's not possible atm for EJB3 based endpoints; so a new feature request
JIRA could be created for adding a configuration option to achieve that. An idea could be
to have a boolean flag in the @WebContext annotation.
WebServiceRef injection without explicit wsdl file fails during
Servlet initialization
--------------------------------------------------------------------------------------
Key: WFLY-3262
URL:
https://issues.jboss.org/browse/WFLY-3262
Project: WildFly
Issue Type: Bug
Components: Web Services
Affects Versions: 8.1.0.CR1
Reporter: Matus Abaffy
Assignee: R Searls
Fix For: 9.0.0.CR1
Reproducer test available at
https://github.com/bafco/wildfly/commits/wsServletInjection
I have the following servlet
{code}
@WebServlet(/*..., */ loadOnStartup = 1)
public class ServletLoadOnStartup extends HttpServlet {
@WebServiceRef(value = EndpointService.class)
private EndpointInterface endpoint1;
//...
{code}
(It is located in the package org.jboss.as.test.integration.ws.serviceref. There you can
find more info about the other classes.)
And i get the following exception:
{code}
org.jboss.arquillian.container.spi.client.container.DeploymentException: Cannot deploy:
ws-servlet-test.war
...
Caused by: java.lang.Exception: {"JBAS014671: Failed services" =>
{"jboss.undertow.deployment.default-server.default-host./ws-servlet-test" =>
"org.jboss.msc.service.StartException in service
jboss.undertow.deployment.default-server.default-host./ws-servlet-test:
javax.servlet.ServletException: UT010013: Could not instantiate ServletLoadOnStartup
Caused by: javax.servlet.ServletException: UT010013: Could not instantiate
ServletLoadOnStartup
Caused by: java.lang.IllegalStateException: JBAS011048: Failed to construct component
instance
Caused by: java.lang.RuntimeException: JBAS011875: Resource lookup for injection
failed: env/org.jboss.as.test.integration.ws.serviceref.ServletLoadOnStartup/endpoint1
Caused by: javax.naming.NamingException: JBAS011878: Failed to lookup
env/org.jboss.as.test.integration.ws.serviceref.ServletLoadOnStartup/endpoint1 [Root
exception is org.jboss.wsf.spi.WSFException: Cannot create service]
Caused by: org.jboss.wsf.spi.WSFException: Cannot create service
Caused by: java.lang.reflect.InvocationTargetException
Caused by: javax.xml.ws.WebServiceException:
org.apache.cxf.service.factory.ServiceConstructionException: Failed to create service.
Caused by: org.apache.cxf.service.factory.ServiceConstructionException: Failed to
create service.
Caused by: javax.wsdl.WSDLException: WSDLException: faultCode=PARSER_ERROR: Problem
parsing 'http://localhost:8080/ws-servlet-test/EndpointService/EJB3Bean?wsdl'.:
java.io.FileNotFoundException:
http://localhost:8080/ws-servlet-test/EndpointService/EJB3Bean?wsdl
Caused by: java.io.FileNotFoundException:
http://localhost:8080/ws-servlet-test/EndpointService/EJB3Bean?wsdl"}}
{code}
If I change loadOnStartup parameter to -1, everything works fine, i.e. servlet gets
instantiated and WS is injected correctly. Therefore, I suppose this is a bug.
Another workaround exists - adding wsdl file to the deployment archive and using the
'wsdlLocation' parameter in @WebServiceRef (as can be seen in
ServiceRefSevletTestCase).