[ 
https://issues.apache.org/jira/browse/CXF-7633?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16353814#comment-16353814
 ] 

Sergey Beryozkin commented on CXF-7633:
---------------------------------------

Interesting, I've tried to rename and seeing:
{noformat}
Caused by: java.lang.ClassNotFoundException: 
org.glassfish.jersey.media.sse.internal.JerseySseEventSource$Builder
{noformat}

> JAX-RS 2.1 SSE client SseEventSourceBuilder lookup fails
> --------------------------------------------------------
>
>                 Key: CXF-7633
>                 URL: https://issues.apache.org/jira/browse/CXF-7633
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 3.2.1
>            Reporter: Aaron Anderson
>            Priority: Minor
>
> I tried to use the following code to create a JAX-RS 2.1 SSE client:
>  
> {code:java}
> Client client = ClientBuilder.newBuilder().build();
> WebTarget base = client.target("http://localhost:8080";);
> try (final SseEventSource eventSource = 
> SseEventSource.target(base.path("/rs/news/update")).build()) {
> ...
> {code}
>  
> but I received the following exception:
>  
>  
> {code:java}
> // java.lang.RuntimeException: java.lang.ClassNotFoundException: 
> javax.ws.rs.sse.SseEventSource.Builder
> at javax.ws.rs.sse.SseEventSource$Builder.newBuilder(SseEventSource.java:53)
> at javax.ws.rs.sse.SseEventSource.target(SseEventSource.java:71)
> at org.apache.meecrowave.tests.sse.SSETest.run(SSETest.java:51)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498)
> at 
> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
> at 
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
> at 
> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
> at 
> org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
> at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
> at 
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
> at 
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
> at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
> at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
> at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
> at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
> at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
> at 
> org.apache.meecrowave.junit.MeecrowaveRuleBase$1.evaluate(MeecrowaveRuleBase.java:66)
> at org.junit.rules.RunRules.evaluate(RunRules.java:20)
> at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
> at 
> org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:367)
> at 
> org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:274)
> at 
> org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:238)
> at 
> org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:161)
> at 
> org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:290)
> at 
> org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:242)
> at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:121)
> Caused by: java.lang.ClassNotFoundException: 
> javax.ws.rs.sse.SseEventSource.Builder
> at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
> at java.lang.Class.forName0(Native Method)
> at java.lang.Class.forName(Class.java:264)
> at javax.ws.rs.sse.SseFinder.newInstance(SseFinder.java:114)
> at javax.ws.rs.sse.SseFinder.find(SseFinder.java:97)
> at javax.ws.rs.sse.SseEventSource$Builder.newBuilder(SseEventSource.java:39)
> ... 28 more
> {code}
>  
> After further investigation in the JAX-RS 2.1 specification both at the JCP 
> site and in the [2.1 geronimo 
> specs|https://github.com/apache/geronimo-specs/blob/trunk/geronimo-jaxrs_2.1_spec/src/main/java/javax/ws/rs/sse/SseEventSource.java]
>  JAXRS_DEFAULT_SSE_BUILDER_PROPERTY service locator key is set to 
> javax.ws.rs.sse.SseEventSource.Builder but in CFX the service file name has a 
> dollar sign in the name instead of a period : 
> [SseEventSource$Builder|https://github.com/apache/cxf/blob/feba8045486cd910b238065cbb3ee4a741198d76/rt/rs/sse/src/main/resources/META-INF/services/javax.ws.rs.sse.SseEventSource%24Builder]
>  
> Please rename this file so that it aligns with the specification. I created 
> my own service loader definition file in my project and it cleared up the 
> exception.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to