Jump to content

Getting error when run java program from ruby


thevoice

Recommended Posts

Hello there,

i have ruby application in which i have to generate report from jasperserver

 

Following is my java code which puts jrxml on server:

public static void putJRXMLOnServer(JServer srv,String resourceName) throws Exception

{

ResourceDescriptor rdis = new ResourceDescriptor();

rdis.setResourceType(ResourceDescriptor.TYPE_JRXML);

rdis.setName(resourceName);

rdis.setLabel("TestJRXMLLabel");

rdis.setDescription("Test JRXML Description");

rdis.setParentFolder("/reportResources");

rdis.setUriString(rdis.getParentFolder() + "/" + rdis.getName());

rdis.setWsType(ResourceDescriptor.TYPE_JRXML);

File jrxml = new File("/sites/launchcomm/app/reports/Report.jrxml");

rdis.setHasData(true);

rdis.setIsNew(false);

// rdis.setIsNew(true);

srv.getWSClient().addOrModifyResource(rdis, jrxml);

}

 

When i run my java program ruby on rails application then i get the following error:

 

java.lang.Exception: 2 - The resource was not found

at com.jaspersoft.jasperserver.irplugin.wsclient.WSClient.modifyReportUnitResource(WSClient.java:500)

at com.jaspersoft.jasperserver.irplugin.wsclient.WSClient.addOrModifyResource(WSClient.java:440)

at MyDynamicReport.putJRXMLOnServer(MyDynamicReport.java:226)

at MyDynamicReport.main(MyDynamicReport.java:73)

Exception in thread "main" java.lang.Exception: 2 - The resource was not found

at com.jaspersoft.jasperserver.irplugin.wsclient.WSClient.modifyReportUnitResource(WSClient.java:500)

at com.jaspersoft.jasperserver.irplugin.wsclient.WSClient.addOrModifyResource(WSClient.java:440)

at MyDynamicReport.putJRXMLOnServer(MyDynamicReport.java:226)

at MyDynamicReport.main(MyDynamicReport.java:73)

 

WHAT IS REASON FOR SUCH ERROR?

I AM UNABLE TO FIND THE REASON FOR SUCH ERROR.

 

Regards,

TheVoice

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

thevoice wrote:

WHAT IS REASON FOR SUCH ERROR?
I AM UNABLE TO FIND THE REASON FOR SUCH ERROR.

 

Are you trying to update an existing resource, or save an JRXML as a new resource? The error seems to indicate that the resource is not found on the server, so if you're saving a new resource, make sure you set the "new" flag to true:

Code:

rdis.setIsNew(true);

 

HTH,

Lucian

Link to comment
Share on other sites

Hi lucianc,

 

Thank you very much for your reply :)

 

Well,from my ruby application,i try to update existing resource.

 

When i run java program from command prompt then its run without giving any error and also update resource on the server.

 

Problem comes when i run my java program from ruby on rails.

 

SO,PLEASE HELP ME TO SOLVE THIS ERROR :)

 

Regards,

TheVoice

Link to comment
Share on other sites

Hello there,

 

The error related to resource not found is get solve.

 

After tracking execution of my report from ruby application i find that resource name from my ruby application to my java program is not pass properly.

 

So i correct it and my error get solved :)

 

Regards,

TheVoice

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...