Jaspersoft / jrs-rest-java-client

Java Rest Client for JasperReports Server
GNU Lesser General Public License v3.0
100 stars 101 forks source link

javax.ws.rs.ProcessingException: javax.ws.rs.core.Response$Status #11

Closed RaviTeja457 closed 10 years ago

RaviTeja457 commented 10 years ago

Hi

I added the dependency and repositories as follows

com.jaspersoft jrs-rest-java-client 5.5.0-SNAPSHOT
<repositories>

    <repository>
        <id>jaspersoft-clients-releases</id>
        <name>Jaspersoft clients releases</name>
        <url>http://jaspersoft.artifactoryonline.com/jaspersoft/jaspersoft-clients-releases</url>
    </repository>

    <repository>
        <id>jaspersoft-clients-snapshots</id>
        <name>Jaspersoft clients snapshots</name>
        <url>http://jaspersoft.artifactoryonline.com/jaspersoft/jaspersoft-clients-snapshots</url>
    </repository>

</repositories>

And my code is as below RestClientConfiguration configuration = new RestClientConfiguration("http://localhost:8080/jasperserver"); JasperserverRestClient client = new JasperserverRestClient(configuration); OperationResult result = client .authenticate("superuser", "ariveguru") .reportingService() .report("/reports/samples/Cascading_multi_select_report") .prepareForRun(ReportOutputFormat.HTML, 1) .parameter("project_id", "2") .run(); result.getEntity(); I got the following error ,Please help me out javax.ws.rs.ProcessingException: javax.ws.rs.core.Response$Status$Family.familyOf(I)Ljavax/ws/rs/core/Response$Status$Family;

boryskolesnykov commented 10 years ago

Hi, what version of JRS are you using?

RaviTeja457 commented 10 years ago

jrs-rest-java-client 5.5.0-SNAPSHOT

boryskolesnykov commented 10 years ago

I mean JasperReports server, not REST client.

RaviTeja457 commented 10 years ago

Hi Borys Kolesnykov,

Thank you for replying

I am using aws(Amazon AMI instance) jasper server and my dependencies are as follows

javaee-api , reasteasy-JAXRS , jrs-rest-java-client

Apart from these i am not using anything

boryskolesnykov commented 10 years ago

Maybe, here is some misunderstanding. I would like to know exactly version of your JasperReports server, it can be v4.7.0, v5.0.0, v5.1.0, v5.2.0, v5.5.0 or earlier. I'm talking about server side, not about application where you are using REST client.

RaviTeja457 commented 10 years ago

Oh Sorry the server version is Version 5.5.0

RaviTeja457 commented 10 years ago

Hi Borys Kolesnykov,

Is any dependecies are missing or i need to do any more configuration

boryskolesnykov commented 10 years ago

Currently I'm trying to reproduce this error, but still have no success. Could you give me a link to your jasperserver and some test credentials, if your security policy allows?

RaviTeja457 commented 10 years ago

http://ec2-54-214-135-73.us-west-2.compute.amazonaws.com/jasperserver-pro uname : demo pwd : demo

boryskolesnykov commented 10 years ago

Ok, I tried to reproduce error with your server instance but haven't succeed. Report "/reports/samples/Cascading_multi_select_report" doesn't exists in your JRS instance and it correctly throws ResourceNotFoundException with this stack trace

Exception in thread "main" com.jaspersoft.jasperserver.jaxrs.client.core.exceptions.ResourceNotFoundException: Resource URI:/reports/samples/Cascading_multi_select_report Type:com.jaspersoft.jasperserver.api.metadata.common.domain.InputControlsContainer not found
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
    at com.jaspersoft.jasperserver.jaxrs.client.core.exceptions.handling.DefaultErrorHandler.handleBodyError(DefaultErrorHandler.java:90)
    at com.jaspersoft.jasperserver.jaxrs.client.apiadapters.reporting.RunReportErrorHandler.handleBodyError(RunReportErrorHandler.java:38)
    at com.jaspersoft.jasperserver.jaxrs.client.core.exceptions.handling.DefaultErrorHandler.handleError(DefaultErrorHandler.java:59)
    at com.jaspersoft.jasperserver.jaxrs.client.core.JerseyRequest.executeRequest(JerseyRequest.java:168)
    at com.jaspersoft.jasperserver.jaxrs.client.core.JerseyRequest.executeRequest(JerseyRequest.java:143)
    at com.jaspersoft.jasperserver.jaxrs.client.core.JerseyRequest.get(JerseyRequest.java:109)
    at com.jaspersoft.jasperserver.jaxrs.client.apiadapters.reporting.RunReportAdapter.run(RunReportAdapter.java:69)
    at Test.main(Test.java:11)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)

But I tried same operation with existed report "/public/Samples/Reports/9g.CustomerDetailReport" and everything works for me.

        RestClientConfiguration configuration = new RestClientConfiguration("http://ec2-54-214-135-73.us-west-2.compute.amazonaws.com/jasperserver-pro");
        JasperserverRestClient client = new JasperserverRestClient(configuration);
        OperationResult result = client
                .authenticate("demo", "demo")
                .reportingService()
                .report("/public/Samples/Reports/9g.CustomerDetailReport")
                .prepareForRun(ReportOutputFormat.HTML, 1)
                .parameter("project_id", "2")
                .run();

        System.out.println(result.getEntity());
boryskolesnykov commented 10 years ago

Please provide me with full stack trace of the error.

RaviTeja457 commented 10 years ago

Thank you sir Could you send me the example you tried

boryskolesnykov commented 10 years ago

Maybe there is some conflict of libraries in your project and in jrs-rest-client. Try to execute this code separately, not within your web app.

boryskolesnykov commented 10 years ago

Give me please your email to send an example

RaviTeja457 commented 10 years ago

ravi.teja@ariveguru.com

boryskolesnykov commented 10 years ago

I think i found an error. Change your jersey dependency on this one

       <dependency>
            <groupId>org.glassfish.jersey.containers</groupId>
            <!-- if your container implements Servlet API older than 3.0, use "jersey-container-servlet-core"  -->
            <artifactId>jersey-container-servlet</artifactId>
            <version>2.5</version>
        </dependency>
RaviTeja457 commented 10 years ago

Could you please send me the code you tried, I hope it helps me lot

boryskolesnykov commented 10 years ago

I've sent, but firstly try to change dependency. I'm almost sure that it will solve your problem.

RaviTeja457 commented 10 years ago

Hi boryskolesnykov,

I tried with the example code what you sent , It is working good . But same thing when i use for restful same exception is coming . Please find the attachment as my example code .

My environment is JBOSS - 7.1

RaviTeja457 commented 10 years ago

Hi sir ,

I sent the log and example code as an email to borys.kolesnikov@gmail.com

boryskolesnykov commented 10 years ago

Hi RaviTeja457,

JBOSS has its own implementation of JAX-RS API (RestEasy) and it conflicts with implementation which is used by jrs-rest-client (Jersey). So it's a bug and it will be fixed as soon as possible.

But you can use Tomcat, it doesn't contain any implementations of Java EE specifications and it won't conflict with jrs-rest-client.

boryskolesnykov commented 10 years ago

Hi RaviTeja457,

JBoss uses old version of JAX-RS API, but jrs-rest-client uses a new one. So, to resolve this conflict you need to exclude an old version from JBoss, you can do it by adding jboss-deployment-structure.xml file to either /META-INF or /WEB-INF directory

<jboss-deployment-structure>
    <deployment>
        <exclusions>

            <!-- Exclude JAVA EE of JBOSS (javax.ws..) => Add dependency javax.annotation -->
            <module name="javaee.api" />
            <!-- Exclude RestEasy conflict (javax.ws.rs.ext.RunDelegate) -->
            <module name="javax.ws.rs.api"/>
            <module name="org.codehaus.jackson.jackson-core-asl" />
            <module name="org.jboss.resteasy.resteasy-atom-provider" />
            <module name="org.jboss.resteasy.resteasy-cdi" />
            <module name="org.jboss.resteasy.resteasy-crypto" />
            <module name="org.jboss.resteasy.resteasy-jackson-provider" />
            <module name="org.jboss.resteasy.resteasy-jaxb-provider" />
            <module name="org.jboss.resteasy.resteasy-jaxrs" />
            <module name="org.jboss.resteasy.resteasy-jettison-provider" />
            <module name="org.jboss.resteasy.resteasy-jsapi" />
            <module name="org.jboss.resteasy.resteasy-json-p-provider" />
            <module name="org.jboss.resteasy.resteasy-multipart-provider" />
            <module name="org.jboss.resteasy.resteasy-validator-provider-11" />
            <module name="org.jboss.resteasy.resteasy-yaml-provider" />
        </exclusions>
    </deployment>
</jboss-deployment-structure>

Also, I've sent you a small demo web application as an example on your email.