FJE
FJE

Reputation: 329

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..

Upvotes: 12

Views: 17968

Answers (6)

macieks
macieks

Reputation: 51

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);

Upvotes: 3

moe
moe

Reputation: 1

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

Upvotes: 0

Batavia
Batavia

Reputation: 2497

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.

Upvotes: 0

Acn
Acn

Reputation: 1066

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

Upvotes: -3

Andreas Veithen
Andreas Veithen

Reputation: 9154

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.

Upvotes: 4

Alexander Pavlov
Alexander Pavlov

Reputation: 32286

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

Upvotes: 6

Related Questions