Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CDI bean can not be a Json Rpc Service #73

Open
mkuligPSI opened this issue Apr 26, 2021 · 1 comment
Open

CDI bean can not be a Json Rpc Service #73

mkuligPSI opened this issue Apr 26, 2021 · 1 comment

Comments

@mkuligPSI
Copy link

My JsonRpcService is a CDI bean. I inject it to Web socket Server Endpoint.

@Inject
MyJsonRpcService myJsonRpcService;

Calling JsonRpcServer#handle(request, myJsonRpcService) throws exception:

Caused by: java.lang.IllegalArgumentException: Multiple entries with same key: jobExecuted=MethodMetadata{name=jobExecuted, method=public void com.MyJsonRpcService.jobExecuted(com.JobDto), params={job=ParameterMetadata{name=job, type=class com.JobDto, genericType=class com.JobDto, index=0, optional=false}}} and jobExecuted=MethodMetadata{name=jobExecuted, method=public void com.MyJsonRpcService$Proxy$_$$_WeldClientProxy.jobExecuted(com.JobDto), params={job=ParameterMetadata{name=job, type=class com.JobDto, genericType=class com.JobDto, index=0, optional=false}}}
        at deployment.pos.coordinator.service-3.4.0-SNAPSHOT.war//com.google.common.collect.ImmutableMap.conflictException(ImmutableMap.java:215)
        at deployment.pos.coordinator.service-3.4.0-SNAPSHOT.war//com.google.common.collect.ImmutableMap.checkNoConflict(ImmutableMap.java:209)
        at deployment.pos.coordinator.service-3.4.0-SNAPSHOT.war//com.google.common.collect.RegularImmutableMap.checkNoConflictInKeyBucket(RegularImmutableMap.java:147)
        at deployment.pos.coordinator.service-3.4.0-SNAPSHOT.war//com.google.common.collect.RegularImmutableMap.fromEntryArray(RegularImmutableMap.java:110)
        at deployment.pos.coordinator.service-3.4.0-SNAPSHOT.war//com.google.common.collect.ImmutableMap$Builder.build(ImmutableMap.java:393)
        at deployment.pos.coordinator.service-3.4.0-SNAPSHOT.war//com.github.arteam.simplejsonrpc.server.Reflections.getClassMetadata(Reflections.java:106)

There are two methods with the same key:
com.MyJsonRpcService.jobExecuted
and
com.MyJsonRpcService$Proxy$_$$_WeldClientProxy.jobExecuted

@mkuligPSI mkuligPSI changed the title CDI bean can not be Json Rpc Service CDI bean can not be a Json Rpc Service May 5, 2021
@mkuligPSI
Copy link
Author

@singleton annotated beans don’t have a proxy object so JsonRpcService can be Singleton.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant