0

An url is set with something like http:xxx.com in ..test/java/resources/application-local.properties and ..main/java/resources/application-local.properties

A file called applicationcontext-ws.xml used ${url} :

<jaxws:client id="xxx"
              serviceClass="RemoteService"
              address="${url}">
    <jaxws:outInterceptors>
        <ref bean="headerInterceptor"/>
    </jaxws:outInterceptors>
</jaxws:client>

When running test, I got an exception:

Caused by: java.net.URISyntaxException: Illegal character in path at index 1: ${url} at java.net.URI$Parser.fail(URI.java:2848) at java.net.URI$Parser.checkChars(URI.java:3021) at java.net.URI$Parser.parseHierarchical(URI.java:3105) at java.net.URI$Parser.parse(URI.java:3063) at java.net.URI.(URI.java:588) at org.apache.cxf.transport.http.HTTPConduit.setupURI(HTTPConduit.java:664) at org.apache.cxf.transport.http.HTTPConduit.prepare(HTTPConduit.java:458)

However, when running it normally, i.e., not running test, this problem never occurs.

At first I suspect that it's because ..test/resources/application-local.properties is not loaded. I annotate a field url with @Value(${url}) in my test class, and in debug mode I can see the field's value is exactly the url's content in ..test/resources/application-local.properties, so that's not the cause.

Would you please offer some advice to help me figure out what's the cause and how to resove url while running test? Thanks.

1
  • 1
    You should provide more details about your test setup and the test itself. Commented Sep 17, 2018 at 7:36

1 Answer 1

0

I believe '${url}' itself is going as the url and '{' is being treated as an illegal character. Please debug and check what is the url that is being passed/created at runtime. I believe ${url} is not getting replaced correctly at runtime.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.