Wednesday, May 19, 2010

Netbeans 6.8, Weblogic 10.3.3 and JAX-WS = WSP_1014_POLICY_REFERENCE_DOES_NOT_EXIST

I recently used Netbeans to generate a JAX-WS web service and attempted to deploy it to Weblogic 10.3.3 the result was this : 

<May 19, 2010 9:45:17 AM EDT> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STARTING>  May 19, 2010 9:45:22 AM com.sun.xml.ws.transport.http.servlet.WSServletContextListener contextInitialized INFO: WSSERVLET12: JAX-WS context listener initializing May 19, 2010 9:45:24 AM com.sun.xml.ws.transport.http.servlet.WSServletDelegate <init> INFO: WSSERVLET14: JAX-WS servlet initializing May 19, 2010 9:45:25 AM [com.sun.xml.ws.policy.jaxws.BuilderHandler]  getPolicySubjects SEVERE: [failed to localize] WSP_1014_POLICY_REFERENCE_DOES_NOT_EXIST(zip:C:/Oracle/Middleware/user_projects/domains/CDIR-NOTIFY/servers/AdminServer/tmp/_WL_user/_appsdir_MockNotificationService-J2EE5_war/royxma/war/WEB-INF/lib/webservices-rt-1.4.jar!/WEB-INF/wsdl/wsat.wsdl#Addressing_policy) May 19, 2010 9:45:25 AM [com.sun.xml.ws.policy.jaxws.PolicyWSDLParserExtension]  finished SEVERE: [failed to localize] WSP_1014_POLICY_REFERENCE_DOES_NOT_EXIST(zip:C:/Oracle/Middleware/user_projects/domains/CDIR-NOTIFY/servers/AdminServer/tmp/_WL_user/_appsdir_MockNotificationService-J2EE5_war/royxma/war/WEB-INF/lib/webservices-rt-1.4.jar!/WEB-INF/wsdl/wsat.wsdl#Addressing_policy) May 19, 2010 9:45:25 AM [com.sun.xml.ws.policy.jaxws.PolicyWSDLParserExtension]  finished SEVERE: [failed to localize] WSP_1018_POLICY_EXCEPTION_WHILE_FINISHING_PARSING_WSDL()

So naturally I Googled the error and found this thread : http://forums.java.net/jive/thread.jspa?messageID=375589.

The gist of the thread is that this error occurs when there are two versions of the metro runtime jar in the classpath. 

Sure enough, when I checked the pom.xml generated by Netbeans I found the following dependency : 

  <dependency>       <groupId>com.sun.xml.ws</groupId>       <artifactId>webservices-rt</artifactId>       <version>1.4</version>       <scope>compile</scope>     </dependency>

If you change the scope of this dependency to provided the error goes away and the service will successfully deploy in weblogic: 

 

    <dependency>       <groupId>com.sun.xml.ws</groupId>       <artifactId>webservices-rt</artifactId>       <version>1.4</version>       <scope>provided</scope>     </dependency>  

Posted via web from Relatively Prime

1 comment:

Unknown said...

Thank you for posting this. It saved us a boatload of time and frustration.

Post a Comment