开发者

How to hide warning in jax-ws client which (maybe) caused by jax-ws library

I'm using netbeans to generate web service client in my application. And my program using jax-ws library to set timeout in calling web service.

Problem arise because it generate a lot of this warning message whenever i start this program.:

Dec 13, 2010 4:35:21 PM [com.sun.xml.ws.policy.EffectiveAlternativeSelector] selectAlternatives WARNING: WSP0075: Policy assertion "{http://schemas.xmlsoap.org/ws/2004/10/wsat}ATAlwaysCapability" was evaluated as "UNKNOWN".

Dec 13, 2010 4:35:21 PM [com.sun.xml.ws.policy.EffectiveAlternativeSelector] selectAlternatives WARNING: WSP0075: Policy assertion "{http://schemas.xmlsoap.org/ws/2004/10/wsat}ATAssertion" was evaluated as "UNKNOWN".

Dec 13, 2010 4:35:21 PM [com.sun.xml.ws.policy.EffectiveAlternativeSelector] selectAlternatives WARNING: WSP0019: Suboptimal policy alternative selected on the client side with fitness "UNKNOWN".

I found the same problem with mine in here: http://forums.java.net/node/707265 , but it also have no answer 开发者_如何学编程until now.

Is there any way to hide this warning? I try to search using google, and can't find any match answer for this problem..


You must be using an outdated version of jax-ws (I didn't find EffectiveAlternativeSelector in my 2.2.1 copy), but let me try.

  1. Create a logging.properties file on some path accessible while launching your application (at the very least you may use the one found at $JAVA_HOME/lib/logging.properties)
  2. Add the following line to that file: com.sun.xml.ws.policy.EffectiveAlternativeSelector.level=OFF
  3. Launch your application as

java -Djava.util.logging.config.file=/path/to/your/logging.properties MainClass


My guess is that the WSDL from which the client was generated contains policy assertions related to WS-AtomicTransaction. Since WS-AtomicTransaction requires a transaction manager and the JRE doesn't contain one, it's not surprising that the JAX-WS runtime in the JRE has no support for WS-AtomicTransaction and doesn't understand these policy assertions.

If you don't need WS-AtomicTransaction, then you have two options to get rid of these warnings:

  • Configure logging to suppress these warnings.
  • Remove the assertions from the WSDL.

If you need WS-AtomicTransaction, then you will probably have to run the code in an application server or as a Java EE application client.


9 years after the question, but maybe someone else needs to set this in java code in 2019.

If you just want to hide the warnings (instead of solving the underlying issue) you can easily set the the logging level in your code like this and no messages should appear:

      PolicyLogger logger = PolicyLogger.getLogger(EffectiveAlternativeSelector.class);
      logger.setLevel(Level.OFF);


i think turning of the debugging isn't a solution

http://dannythorpe.com/2012/01/04/java-wcf-usingaddressing-warning/ describes a way to fix this.


The @SupressWarnings() does not help in this case. That annotation is to tell the compiler to not warn you when you are potentially misusing some java type. These ws warnings are getting piped into System.err


Is @SupressWarning(value="?") of any use here ?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜