JSF Jax-RS Client ProcessingException

Diskutiere Jax-RS Client ProcessingException im Web Tier Forum; Hi Leute, ich habe folgendes Problem. Ich habe einen Client geschrieben der auf meinen Microservices (Jax RS - Jersey) zugreift, und es hat...

  1. masterholdy
    masterholdy Neues Mitglied
    Hi Leute,

    ich habe folgendes Problem. Ich habe einen Client geschrieben der auf meinen Microservices (Jax RS - Jersey) zugreift, und es hat alles funktioniert. Danach habe ich den Client innerhalb meines JSF Projektes gezogen und auf einmal werfen die Post-Requests des Clients folgende Exception:

    ( https://pastebin.com/raw/kqnTQ0XL )
    Code (Text):
    Schwerwiegend:   SUBMIT
    Schwerwiegend:   Generating incomplete JSON
    Warnung:   /issueCreate.xhtml @36,186 actionListener="#{issueCreateBoundary.submitIssue()}": javax.ws.rs.ProcessingException: wrong number of arguments
    javax.el.ELException: /issueCreate.xhtml @36,186 actionListener="#{issueCreateBoundary.submitIssue()}": javax.ws.rs.ProcessingException: wrong number of arguments
        at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:71)
        at javax.faces.event.MethodExpressionActionListener.processAction(MethodExpressionActionListener.java:124)
        at javax.faces.event.ActionEvent.processListener(ActionEvent.java:72)
        at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:490)
        at javax.faces.component.UICommand.broadcast(UICommand.java:211)
        at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:847)
        at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1395)
        at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:58)
        at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:76)
        at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:177)
        at javax.faces.webapp.FacesServlet.executeLifecyle(FacesServlet.java:707)
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:451)
        at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1540)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:217)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:119)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:611)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:550)
        at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:114)
        at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:332)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:199)
        at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:463)
        at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:168)
        at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:206)
        at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:180)
        at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:242)
        at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
        at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
        at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
        at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
        at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
        at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
        at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:539)
        at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
        at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
        at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
        at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
        at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:593)
        at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:573)
        at java.lang.Thread.run(Thread.java:748)
    Caused by: javax.ws.rs.ProcessingException: wrong number of arguments
        at org.glassfish.jersey.client.ClientRuntime.invoke(ClientRuntime.java:287)
        at org.glassfish.jersey.client.JerseyInvocation.lambda$invoke$1(JerseyInvocation.java:767)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:316)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:298)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:229)
        at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:414)
        at org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyInvocation.java:765)
        at org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:456)
        at org.glassfish.jersey.client.JerseyInvocation$Builder.post(JerseyInvocation.java:357)
        at de.hsos.kbse.agilboard.DAL.Services.Superclass.GenericClient.create(GenericClient.java:78)
        at de.hsos.kbse.agilboard.DAL.Services.UserStoryClient$Proxy$_$$_WeldClientProxy.create(Unknown Source)
        at de.hsos.kbse.agilboard.Boundary.IssueCreateBoundary.submitIssue(IssueCreateBoundary.java:26)
        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 javax.el.ELUtil.invokeMethod(ELUtil.java:263)
        at javax.el.BeanELResolver.invoke(BeanELResolver.java:494)
        at javax.el.CompositeELResolver.invoke(CompositeELResolver.java:215)
        at com.sun.el.parser.AstValue.invoke(AstValue.java:285)
        at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:304)
        at org.jboss.weld.module.web.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:40)
        at org.jboss.weld.module.web.el.WeldMethodExpression.invoke(WeldMethodExpression.java:50)
        at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:65)
        ... 39 more
    Caused by: java.lang.IllegalArgumentException: wrong number of arguments
        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.eclipse.yasson.internal.model.GetFromGetter.internalGetValue(GetFromGetter.java:28)
        at org.eclipse.yasson.internal.model.GetValueCommand.getValue(GetValueCommand.java:34)
        at org.eclipse.yasson.internal.model.ReflectionPropagation.getValue(ReflectionPropagation.java:72)
        at org.eclipse.yasson.internal.model.PropertyModel.getValue(PropertyModel.java:257)
        at org.eclipse.yasson.internal.serializer.ObjectSerializer.marshallProperty(ObjectSerializer.java:76)
        at org.eclipse.yasson.internal.serializer.ObjectSerializer.serializeInternal(ObjectSerializer.java:59)
        at org.eclipse.yasson.internal.serializer.AbstractContainerSerializer.serialize(AbstractContainerSerializer.java:60)
        at org.eclipse.yasson.internal.Marshaller.serializeRoot(Marshaller.java:118)
        at org.eclipse.yasson.internal.Marshaller.marshall(Marshaller.java:76)
        at org.eclipse.yasson.internal.JsonBinding.toJson(JsonBinding.java:98)
        at org.glassfish.jersey.jsonb.internal.JsonBindingProvider.writeTo(JsonBindingProvider.java:118)
        at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.invokeWriteTo(WriterInterceptorExecutor.java:266)
        at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.aroundWriteTo(WriterInterceptorExecutor.java:251)
        at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:163)
        at org.glassfish.jersey.message.internal.MessageBodyFactory.writeTo(MessageBodyFactory.java:1135)
        at org.glassfish.jersey.client.ClientRequest.doWriteEntity(ClientRequest.java:516)
        at org.glassfish.jersey.client.ClientRequest.writeEntity(ClientRequest.java:498)
        at org.glassfish.jersey.client.internal.HttpUrlConnector._apply(HttpUrlConnector.java:384)
        at org.glassfish.jersey.client.internal.HttpUrlConnector.apply(HttpUrlConnector.java:282)
        at org.glassfish.jersey.client.ClientRuntime.invoke(ClientRuntime.java:278)
        ... 62 more

    Schwerwiegend:   javax.ws.rs.ProcessingException: wrong number of arguments
        at org.glassfish.jersey.client.ClientRuntime.invoke(ClientRuntime.java:287)
        at org.glassfish.jersey.client.JerseyInvocation.lambda$invoke$1(JerseyInvocation.java:767)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:316)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:298)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:229)
        at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:414)
        at org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyInvocation.java:765)
        at org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:456)
        at org.glassfish.jersey.client.JerseyInvocation$Builder.post(JerseyInvocation.java:357)
        at de.hsos.kbse.agilboard.DAL.Services.Superclass.GenericClient.create(GenericClient.java:78)
        at de.hsos.kbse.agilboard.DAL.Services.UserStoryClient$Proxy$_$$_WeldClientProxy.create(Unknown Source)
        at de.hsos.kbse.agilboard.Boundary.IssueCreateBoundary.submitIssue(IssueCreateBoundary.java:26)
        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 javax.el.ELUtil.invokeMethod(ELUtil.java:263)
        at javax.el.BeanELResolver.invoke(BeanELResolver.java:494)
        at javax.el.CompositeELResolver.invoke(CompositeELResolver.java:215)
        at com.sun.el.parser.AstValue.invoke(AstValue.java:285)
        at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:304)
        at org.jboss.weld.module.web.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:40)
        at org.jboss.weld.module.web.el.WeldMethodExpression.invoke(WeldMethodExpression.java:50)
        at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:65)
        at javax.faces.event.MethodExpressionActionListener.processAction(MethodExpressionActionListener.java:124)
        at javax.faces.event.ActionEvent.processListener(ActionEvent.java:72)
        at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:490)
        at javax.faces.component.UICommand.broadcast(UICommand.java:211)
        at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:847)
        at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1395)
        at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:58)
        at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:76)
        at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:177)
        at javax.faces.webapp.FacesServlet.executeLifecyle(FacesServlet.java:707)
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:451)
        at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1540)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:217)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:119)
        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:611)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:550)
        at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:114)
        at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:332)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:199)
        at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:463)
        at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:168)
        at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:206)
        at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:180)
        at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:242)
        at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
        at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
        at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
        at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
        at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
        at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
        at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:539)
        at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
        at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
        at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
        at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
        at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:593)
        at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:573)
        at java.lang.Thread.run(Thread.java:748)
    Caused by: java.lang.IllegalArgumentException: wrong number of arguments
        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.eclipse.yasson.internal.model.GetFromGetter.internalGetValue(GetFromGetter.java:28)
        at org.eclipse.yasson.internal.model.GetValueCommand.getValue(GetValueCommand.java:34)
        at org.eclipse.yasson.internal.model.ReflectionPropagation.getValue(ReflectionPropagation.java:72)
        at org.eclipse.yasson.internal.model.PropertyModel.getValue(PropertyModel.java:257)
        at org.eclipse.yasson.internal.serializer.ObjectSerializer.marshallProperty(ObjectSerializer.java:76)
        at org.eclipse.yasson.internal.serializer.ObjectSerializer.serializeInternal(ObjectSerializer.java:59)
        at org.eclipse.yasson.internal.serializer.AbstractContainerSerializer.serialize(AbstractContainerSerializer.java:60)
        at org.eclipse.yasson.internal.Marshaller.serializeRoot(Marshaller.java:118)
        at org.eclipse.yasson.internal.Marshaller.marshall(Marshaller.java:76)
        at org.eclipse.yasson.internal.JsonBinding.toJson(JsonBinding.java:98)
        at org.glassfish.jersey.jsonb.internal.JsonBindingProvider.writeTo(JsonBindingProvider.java:118)
        at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.invokeWriteTo(WriterInterceptorExecutor.java:266)
        at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.aroundWriteTo(WriterInterceptorExecutor.java:251)
        at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:163)
        at org.glassfish.jersey.message.internal.MessageBodyFactory.writeTo(MessageBodyFactory.java:1135)
        at org.glassfish.jersey.client.ClientRequest.doWriteEntity(ClientRequest.java:516)
        at org.glassfish.jersey.client.ClientRequest.writeEntity(ClientRequest.java:498)
        at org.glassfish.jersey.client.internal.HttpUrlConnector._apply(HttpUrlConnector.java:384)
        at org.glassfish.jersey.client.internal.HttpUrlConnector.apply(HttpUrlConnector.java:282)
        at org.glassfish.jersey.client.ClientRuntime.invoke(ClientRuntime.java:278)
        ... 62 more
    Wenn ich probiere einen Post-Request an den Microservices zu schicken über meine Test-Datein (Test Packages) geht dieses auch fehlerfrei. Innerhalb meines Projektes (Source Packages) erhalte ich die o.g. Exception wenn ich Post-Request über meine Boundary ausführe.

    Test-Method (geht Problemlos):
    Code (Java):
        @Test
        public void testCRUDUserStory() {
            UserStory userstory = new UserStory();      
            Optional<UserStory> response = this.userStoryClient.create(userstory);
            assertTrue(response.isPresent());
           
            userstory = response.get();
            userstory.setName("bla");      
            response = this.userStoryClient.update(userstory);
            assertTrue(response.isPresent());
            userstory = response.get();
            assertTrue(userstory.getName().equals("bla"));
           
            Integer id = userstory.getId();
            response = this.userStoryClient.getByID(id);
            assertTrue(response.isPresent());
           
            userstory = response.get();
            assertTrue(this.userStoryClient.delete(userstory));
        }
    Mein GenericClient ( https://pastebin.com/MwUjTyx5 ):
    Code (Java):
    package de.hsos.kbse.agilboard.DAL.Services.Superclass;

    import de.hsos.kbse.agilboard.DAL.DAOs.Superclass.EntityWithID;
    import de.hsos.kbse.agilboard.DAL.Services.Consts;
    import java.io.Serializable;
    import java.util.List;
    import java.util.Optional;
    import javax.ejb.Stateless;
    import javax.ws.rs.client.Client;
    import javax.ws.rs.client.ClientBuilder;
    import javax.ws.rs.client.Entity;
    import javax.ws.rs.client.WebTarget;
    import javax.ws.rs.core.GenericType;
    import javax.ws.rs.core.MediaType;
    import javax.ws.rs.core.Response;

    public abstract class GenericClient<T extends EntityWithID> implements Serializable{
        protected Client client;
        protected WebTarget webTarget; //TODO: WebTarget muss geclosed werden wo machen wir das am besten!?
        protected String entityResourceName;
        protected GenericType<T> genericTypeEntity;
        protected GenericType<List<T>> genericTypeList;

        public GenericClient(String entityResourceName, GenericType<T> genericTypeEntity, GenericType<List<T>> genericTypeList) {
            this.client             = ClientBuilder.newClient();
            this.webTarget          = client.target(Consts.BASEURI);      
            this.entityResourceName = entityResourceName;
            this.genericTypeEntity = genericTypeEntity;
            this.genericTypeList = genericTypeList;
        }
       
        public GenericClient(){
            this.client             = ClientBuilder.newClient();
            this.webTarget          = client.target(Consts.BASEURI);  
        };
       
        protected WebTarget getResourceWebTarget(){
            return client
                    .target(Consts.BASEURI)
                    .path(entityResourceName);
        }
       
        protected Optional<List<T>> retrieveEntityList(Response response){
            if(response.getStatus() == 200){
                return Optional.of(response.readEntity(this.genericTypeList));
            }else{
                return Optional.empty();
            }
        }
       
        protected Optional<T> retrieveEntity(Response response){
            if(response.getStatus() == 200){
                return Optional.of(response.readEntity(this.genericTypeEntity));
            }else{
                return Optional.empty();
            }
        }
       
        public Optional<List<T>> getAll(){
            Response response = this.getResourceWebTarget()
                    .request(MediaType.APPLICATION_JSON)
                    .get(Response.class);
            return this.retrieveEntityList(response);
        }
       
        public Optional<T> getByID(int id){
            Response response = this.getResourceWebTarget()
                                    .path(String.valueOf(id))
                                    .request(MediaType.APPLICATION_JSON)
                                    .get(Response.class);
            return this.retrieveEntity(response);
           
        }
       
        public Optional<T> create(T entity){
            Response response = this.getResourceWebTarget()
                    .request(MediaType.APPLICATION_JSON)
                    .post(Entity.entity(entity, MediaType.APPLICATION_JSON),
                        Response.class);      
            return this.retrieveEntity(response);
        }
       
        public Optional<T> update(T entity){              
            Response response = this.getResourceWebTarget()
                    .request(MediaType.APPLICATION_JSON)
                    .put(Entity.entity(entity, MediaType.APPLICATION_JSON), Response.class);
            return this.retrieveEntity(response);
        }
       
        public boolean delete(T entity){
            if(entity == null || entity.getId() == null) return false;
            return this.deleteById(entity.getId());
        }
       
        public boolean deleteById(int id){
            int status = this.getResourceWebTarget()
                    .path(String.valueOf(id))
                    .request(MediaType.APPLICATION_JSON)
                    .delete().getStatus();
            return status == 200;
        }  
    }
    Mein UserStoryClient (extends GenericClient):
    Code (Java):
    @RequestScoped
    @Named
    public class UserStoryClient extends GenericClient<UserStory>{
        public UserStoryClient() {
            super(Consts.USERSTORY_RESOURCEURI, new GenericType<UserStory>(){}, new GenericType<List<UserStory>>(){});
        }

        public Optional<List<UserStory>> getByUserId(int id) {
            Response response = this.getResourceWebTarget()
                    .path(Consts.USER_RESOURCEURI)
                    .path(String.valueOf(id))
                    .request(MediaType.APPLICATION_JSON)
                    .get(Response.class);
            return this.retrieveEntityList(response);
        }
    }
    Meine Boundary die den Client aufruft und den Fehler auslöst:
    Code (Java):
    @RequestScoped
    @Named
    @Getter @Setter
    public class IssueCreateBoundary implements Serializable {
        UserStory userStory = new UserStory();
        @Inject UserStoryClient userStoryGroup;
        private Integer priorityRating;  
        private Integer riskRating;  

        public void submitIssue(){
            if(priorityRating != null)   userStory.setPriority(priorityRating.byteValue());
            if(riskRating != null) userStory.setRisk(riskRating.byteValue());
           
            Optional<UserStory> resp = this.userStoryGroup.create(userStory);
        }
    }
    Meine Pom XML:
    https://pastebin.com/1kZxNCKQ

    Andere Funktionen des Clients (getAll, getByID, ..) kann ich auch innerhalb der Boundary fehlerfrei aufrufen.

    Das ist gerade mein erstes 'richtiges' Java EE Projekt, ich nehme alle Vorschläge dankend an!
     
  2. mrBrown
    mrBrown Super-Moderator Mitarbeiter
    Wie sieht die UserStory-Klasse aus?

    Ich tippe auf diesen Fehler: https://github.com/eclipse-ee4j/yasson/issues/63
    Allerdings wundert mich, dass er nicht im Test auftritt...

    Edit: Wenn ich das richtige sehe, nutzt du zum Testen Jackson, im Server wird aber dann Yasson genutzt?
    Du kannst mal mit mvn dependency:tree nachgucken, ob Yasson als Dependency beim Testen dabei ist
     
    Zuletzt bearbeitet: 26. Juni 2018
    masterholdy gefällt das.
  3. masterholdy
    masterholdy Neues Mitglied
    mvn dependency:tree

    Code (Text):
    de.hsos.kbse.agilboard:webui:war:1.0-SNAPSHOT
    +- org.primefaces.extensions:all-themes:jar:1.0.8:compile
    |  +- org.primefaces.themes:afterdark:jar:1.0.8:runtime
    |  +- org.primefaces.themes:afternoon:jar:1.0.8:runtime
    |  +- org.primefaces.themes:afterwork:jar:1.0.8:runtime
    |  +- org.primefaces.themes:black-tie:jar:1.0.8:runtime
    |  +- org.primefaces.themes:blitzer:jar:1.0.8:runtime
    |  +- org.primefaces.themes:bluesky:jar:1.0.8:runtime
    |  +- org.primefaces.themes:bootstrap:jar:1.0.8:runtime
    |  +- org.primefaces.themes:casablanca:jar:1.0.8:runtime
    |  +- org.primefaces.themes:cruze:jar:1.0.8:runtime
    |  +- org.primefaces.themes:cupertino:jar:1.0.8:runtime
    |  +- org.primefaces.themes:dark-hive:jar:1.0.8:runtime
    |  +- org.primefaces.themes:dot-luv:jar:1.0.8:runtime
    |  +- org.primefaces.themes:eggplant:jar:1.0.8:runtime
    |  +- org.primefaces.themes:excite-bike:jar:1.0.8:runtime
    |  +- org.primefaces.themes:flick:jar:1.0.8:runtime
    |  +- org.primefaces.themes:glass-x:jar:1.0.8:runtime
    |  +- org.primefaces.themes:hot-sneaks:jar:1.0.8:runtime
    |  +- org.primefaces.themes:humanity:jar:1.0.8:runtime
    |  +- org.primefaces.themes:le-frog:jar:1.0.8:runtime
    |  +- org.primefaces.themes:midnight:jar:1.0.8:runtime
    |  +- org.primefaces.themes:mint-choc:jar:1.0.8:runtime
    |  +- org.primefaces.themes:overcast:jar:1.0.8:runtime
    |  +- org.primefaces.themes:pepper-grinder:jar:1.0.8:runtime
    |  +- org.primefaces.themes:redmond:jar:1.0.8:runtime
    |  +- org.primefaces.themes:rocket:jar:1.0.8:runtime
    |  +- org.primefaces.themes:sam:jar:1.0.8:runtime
    |  +- org.primefaces.themes:smoothness:jar:1.0.8:runtime
    |  +- org.primefaces.themes:south-street:jar:1.0.8:runtime
    |  +- org.primefaces.themes:start:jar:1.0.8:runtime
    |  +- org.primefaces.themes:sunny:jar:1.0.8:runtime
    |  +- org.primefaces.themes:swanky-purse:jar:1.0.8:runtime
    |  +- org.primefaces.themes:trontastic:jar:1.0.8:runtime
    |  +- org.primefaces.themes:ui-darkness:jar:1.0.8:runtime
    |  +- org.primefaces.themes:ui-lightness:jar:1.0.8:runtime
    |  +- org.primefaces.themes:vader:jar:1.0.8:runtime
    |  \- org.primefaces.themes:home:jar:1.0.8:runtime
    +- org.projectlombok:lombok:jar:1.18.0:compile
    +- junit:junit:jar:4.12:compile
    |  \- org.hamcrest:hamcrest-core:jar:1.3:compile
    +- javax:javaee-web-api:jar:7.0:provided
    +- org.primefaces:primefaces:jar:6.2:compile
    +- net.bootsfaces:bootsfaces:jar:1.2.0:compile
    +- org.glassfish.jersey.core:jersey-client:jar:2.25.1:compile
    |  +- javax.ws.rs:javax.ws.rs-api:jar:2.0.1:compile
    |  +- org.glassfish.jersey.core:jersey-common:jar:2.25.1:compile
    |  |  +- javax.annotation:javax.annotation-api:jar:1.2:compile
    |  |  +- org.glassfish.jersey.bundles.repackaged:jersey-guava:jar:2.25.1:compile
    |  |  \- org.glassfish.hk2:osgi-resource-locator:jar:1.0.1:compile
    |  +- org.glassfish.hk2:hk2-api:jar:2.5.0-b32:compile
    |  |  +- org.glassfish.hk2:hk2-utils:jar:2.5.0-b32:compile
    |  |  \- org.glassfish.hk2.external:aopalliance-repackaged:jar:2.5.0-b32:compile
    |  +- org.glassfish.hk2.external:javax.inject:jar:2.5.0-b32:compile
    |  \- org.glassfish.hk2:hk2-locator:jar:2.5.0-b32:compile
    |     \- org.javassist:javassist:jar:3.20.0-GA:compile
    \- org.glassfish.jersey.media:jersey-media-json-jackson:jar:2.25.1:compile
       +- org.glassfish.jersey.ext:jersey-entity-filtering:jar:2.25.1:compile
       +- com.fasterxml.jackson.jaxrs:jackson-jaxrs-base:jar:2.8.4:compile
       |  +- com.fasterxml.jackson.core:jackson-core:jar:2.8.4:compile
       |  \- com.fasterxml.jackson.core:jackson-databind:jar:2.8.4:compile
       +- com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:jar:2.8.4:compile
       |  \- com.fasterxml.jackson.module:jackson-module-jaxb-annotations:jar:2.8.4:compile
       \- com.fasterxml.jackson.core:jackson-annotations:jar:2.8.4:compile
    ich habe in der pom.xml nirgendswo etwas zu yasson stehen, wie kann ich jackson zum parsen verwenden?
     
  4. mrBrown
    mrBrown Super-Moderator Mitarbeiter
    masterholdy gefällt das.
  5. masterholdy
    masterholdy Neues Mitglied
    danke schonmal für die schnelle antwort!

    ich bin mir jetzt gerade nicht sicher, ich habe ja ein java web ee projekt und bis auf den client der jax-rs benutzt keine jersey sachen in benutzung (glaube ich zumindest)

    und ich soll ja

    Code (Text):
    <init-param>
        <param-name>jersey.config.server.provider.classnames</param-name>
        <param-value>org.glassfish.jersey.jackson.JacksonFeature</param-value>
    </init-param>
    " you can register the JacksonFeature in your web.xml deployment descriptor by adding the feature fully-qualified class name to the jersey.config.server.provider.classnames initialization parameter:"

    leider habe ich ja keinen jersey server in benutzung, könnte ich einfach das ganze als context param hinzufügen?

    Code (Text):
        <context-param>
                <param-name>jersey.config.server.provider.classnames</param-name>
                <param-value>org.glassfish.jersey.jackson.JacksonFeature</param-value>
        </context-param>
    Code (Text):
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd">
        <context-param>
            <param-name>javax.faces.PROJECT_STAGE</param-name>
            <param-value>Development</param-value>
        </context-param>
        <context-param>
            <param-name>primefaces.THEME</param-name>
            <param-value>bootstrap</param-value>
        </context-param>
        <context-param>
            <param-name>BootsFaces_USE_VIEWPORT</param-name>
            <param-value>false</param-value>
        </context-param>
     
        <context-param>
                <param-name>jersey.config.server.provider.classnames</param-name>
                <param-value>org.glassfish.jersey.jackson.JacksonFeature</param-value>
        </context-param>
         
        <servlet>
            <servlet-name>Faces Servlet</servlet-name>
            <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
            <load-on-startup>1</load-on-startup>
        </servlet>
        <servlet-mapping>
            <servlet-name>Faces Servlet</servlet-name>
            <url-pattern>/faces/*</url-pattern>
        </servlet-mapping>
        <session-config>
            <session-timeout>
                30
            </session-timeout>
        </session-config>
        <welcome-file-list>
            <welcome-file>faces/index.xhtml</welcome-file>
        </welcome-file-list>
    </web-app>
     
    //edit leider erhalte ich hier die selbe exception
    da ich ja jsf benutze und keinen jersey server benutze kann ich schätzungweise auch nicht einfach von resourceconfig extenden und jackson registrieren, wie sollte ich nun vorgehen um jackson zu registiren?
     
    Zuletzt bearbeitet: 26. Juni 2018
  6. mrBrown
    mrBrown Super-Moderator Mitarbeiter
    Und das Java-EE-Project deployest du doch auf einem Application-Server und die Maven-Dinge gehören zu diesem Projekt?

    Da der Stacktrace von Jersey spricht, dürftest du da Jersey im Einsatz haben (zumindest Intern in App-Server).

    afaik klappt das nicht als context-param, sondern nur als init-param, einfach innerhalb von servlet angeben.
     
    masterholdy gefällt das.
  7. masterholdy
    masterholdy Neues Mitglied
    Code (Text):
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd">
        <context-param>
            <param-name>javax.faces.PROJECT_STAGE</param-name>
            <param-value>Development</param-value>
        </context-param>
        <context-param>
            <param-name>primefaces.THEME</param-name>
            <param-value>bootstrap</param-value>
        </context-param>
        <context-param>
            <param-name>BootsFaces_USE_VIEWPORT</param-name>
            <param-value>false</param-value>
        </context-param>
       
        <context-param>
                <param-name>jersey.config.server.provider.classnames</param-name>
                <param-value>org.glassfish.jersey.jackson.JacksonFeature</param-value>
        </context-param>
         
        <servlet>
            <servlet-name>Faces Servlet</servlet-name>
            <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
            <load-on-startup>1</load-on-startup>
            <init-param>
                <param-name>jersey.config.server.provider.classnames</param-name>
                <param-value>org.glassfish.jersey.jackson.JacksonFeature</param-value>
            </init-param>
        </servlet>
        <servlet-mapping>
            <servlet-name>Faces Servlet</servlet-name>
            <url-pattern>/faces/*</url-pattern>
        </servlet-mapping>
        <session-config>
            <session-timeout>
                30
            </session-timeout>
        </session-config>
        <welcome-file-list>
            <welcome-file>faces/index.xhtml</welcome-file>
        </welcome-file-list>
    </web-app>
     
     
  8. masterholdy
    masterholdy Neues Mitglied
    ich habe ganz vergessen den thread zu schließen mrBrown hatte komplett recht
    nachdem ich einen anderen parser genommen habe und @JsonFormat(..) über alle daten geschrieben habe ging alles perfekt
     
Die Seite wird geladen...

Jax-RS Client ProcessingException - Ähnliche Themen

json-b + jax-rs + getter mit Parameter = NullPointerException
json-b + jax-rs + getter mit Parameter = NullPointerException im Forum Allgemeines EE
jax-rs detect aborting upload
jax-rs detect aborting upload im Forum Web Tier
Jersey (JAX-RS) - Background Thread + Objektzugriff
Jersey (JAX-RS) - Background Thread + Objektzugriff im Forum Application Tier
Jersey (JAX-RS) - ServletContextListener
Jersey (JAX-RS) - ServletContextListener im Forum Application Tier
Token-Security unter JBoss 7 / Jax-RS
Token-Security unter JBoss 7 / Jax-RS im Forum SOA
Thema: Jax-RS Client ProcessingException