Jump to content
We've recently updated our Privacy Statement, available here ×

JasperServer/Tomcat Compile Problems


aegleston

Recommended Posts

Hi,

 

We are encountering compile problems in our production environment which is Tomcat 5.5/JasperServer 2.1/Java 1.5 JRE. These compile problems do not occur in our development environment using iReport 2.0.4. The production compile problem only occurs if we reference the DateUtils class which was recommended in these forums and is a big help with more powerful date handling. In iReport, we simply added the commons-lang-2.3.jar to the classpath. In production, we added commons-lang-2.3.jar to the webapps/jasperserver/WEB-INF/lib directory. Here are the errors we see when attempting to run a report:

 

com.jaspersoft.jasperserver.api.JSExceptionWrapper: Errors were encountered when compiling report expressions class file: 1. The method addMonths(Date, int) is undefined for the type DateUtils value = (java.util.Date)(org.apache.commons.lang.time.DateUtils.addMonths(org.apache.commons.lang.time.DateUtils.truncate(new Date(), Calendar.MONTH), -1));//$JR_EXPR_ID=0$ <-------> 2. The method addDays(Date, int) is undefined for the type DateUtils value = (java.util.Date)(org.apache.commons.lang.time.DateUtils.addDays(org.apache.commons.lang.time.DateUtils.truncate(new Date(), Calendar.MONTH), -1));//$JR_EXPR_ID=1$ <-----> 3. The method addMonths(Date, int) is undefined for the type DateUtils value = (java.util.Date)(org.apache.commons.lang.time.DateUtils.addMonths(org.apache.commons.lang.time.DateUtils.truncate(new Date(), Calendar.MONTH), -1));//$JR_EXPR_ID=0$ <-------> 4. The method addDays(Date, int) is undefined for the type DateUtils value = (java.util.Date)(org.apache.commons.lang.time.DateUtils.addDays(org.apache.commons.lang.time.DateUtils.truncate(new Date(), Calendar.MONTH), -1));//$JR_EXPR_ID=1$ <-----> 5. The method addMonths(Date, int) is undefined for the type DateUtils value = (java.util.Date)(org.apache.commons.lang.time.DateUtils.addMonths(org.apache.commons.lang.time.DateUtils.truncate(new Date(), Calendar.MONTH), -1));//$JR_EXPR_ID=0$ <-------> 6. The method addDays(Date, int) is undefined for the type DateUtils value = (java.util.Date)(org.apache.commons.lang.time.DateUtils.addDays(org.apache.commons.lang.time.DateUtils.truncate(new Date(), Calendar.MONTH), -1));//$JR_EXPR_ID=1$ <-----> 6 errors

 

com.jaspersoft.jasperserver.api.JSExceptionWrapper: net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file:

1. The method addMonths(Date, int) is undefined for the type DateUtils

value = (java.util.Date)(org.apache.commons.lang.time.DateUtils.addMonths(org.apache.commons.lang.time.DateUtils.truncate(new Date(), Calendar.MONTH), -1));//$JR_EXPR_ID=0$

<------->

2. The method addDays(Date, int) is undefined for the type DateUtils

value = (java.util.Date)(org.apache.commons.lang.time.DateUtils.addDays(org.apache.commons.lang.time.DateUtils.truncate(new Date(), Calendar.MONTH), -1));//$JR_EXPR_ID=1$

<----->

3. The method addMonths(Date, int) is undefined for the type DateUtils

value = (java.util.Date)(org.apache.commons.lang.time.DateUtils.addMonths(org.apache.commons.lang.time.DateUtils.truncate(new Date(), Calendar.MONTH), -1));//$JR_EXPR_ID=0$

<------->

4. The method addDays(Date, int) is undefined for the type DateUtils

value = (java.util.Date)(org.apache.commons.lang.time.DateUtils.addDays(org.apache.commons.lang.time.DateUtils.truncate(new Date(), Calendar.MONTH), -1));//$JR_EXPR_ID=1$

<----->

5. The method addMonths(Date, int) is undefined for the type DateUtils

value = (java.util.Date)(org.apache.commons.lang.time.DateUtils.addMonths(org.apache.commons.lang.time.DateUtils.truncate(new Date(), Calendar.MONTH), -1));//$JR_EXPR_ID=0$

<------->

6. The method addDays(Date, int) is undefined for the type DateUtils

value = (java.util.Date)(org.apache.commons.lang.time.DateUtils.addDays(org.apache.commons.lang.time.DateUtils.truncate(new Date(), Calendar.MONTH), -1));//$JR_EXPR_ID=1$

<----->

6 errors

 

at net.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:193)

at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:220)

at com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.EngineServiceImpl.compileReport(EngineServiceImpl.java:753)

at com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.EngineServiceImpl$CacheableCompiledReports.getData(EngineServiceImpl.java:157)

at com.jaspersoft.jasperserver.api.metadata.common.service.impl.hibernate.HibernateRepositoryCache.saveData(HibernateRepositoryCache.java:186)

at com.jaspersoft.jasperserver.api.metadata.common.service.impl.hibernate.HibernateRepositoryCache.getCachedItem(HibernateRepositoryCache.java:125)

at com.jaspersoft.jasperserver.api.metadata.common.service.impl.hibernate.HibernateRepositoryCache.cache(HibernateRepositoryCache.java:71)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

 

We have tried the following according to other posts in this forum:

1) added jdt-compiler-3.1.1.jar to the webapps/jasperserver/WEB-INF/lib directory.

2) included the following in the jasperreports.properties file in webapps/jasperserver/WEB-INF/classes:

 

org.eclipse.jdt.core.compiler.source=1.5

org.eclipse.jdt.core.compiler.compliance=1.5

org.eclipse.jdt.core.compiler.codegen.TargetPlatform=1.5

 

We have also tried editing the setclasspath.sh Tomcat script to manually include the commons-lang-2.3.jar in the classpath. For some reason, Tomcat and JasperServer do not seem to see the commons-lang-2.3.jar file which includes the DateUtils class.

 

Any help is appreciated.

 

Andy

 

Post edited by: aegleston, at: 2008/03/22 19:27

 

Post edited by: aegleston, at: 2008/03/23 11:51

Post edited by: aegleston, at: 2008/03/23 11:52

Link to comment
Share on other sites

  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

JasperServer already contains a Commons Lang 2.1 jar under WEB-INF/lib, and the DateUtils methods you are using were not present in Commons Lang 2.1. Therefore, after you copy the Commons Lang 2.3 jar to WEB-INF/lib, make sure to remove the old (2.1) jar so that the classes are actually loaded from the jar you added.

 

HTH,

Lucian

Link to comment
Share on other sites

  • 6 years later...

I am developing java barcode generator and recently i am working on a program of drawing barcode in jasper reports.I need to use the JasperServer/Tomcat.I searched for a couple of days to fix this bug with nothing new.I had a report which include multi-level subreports everything works fine on iReport 3.7.5.

I used subreport.jasper as subreport expression in the first level & also subreportA.jasper, subreportB.jasper in the second level & place all (the main report & subreports) in the same path. The problem raised when I try to deploy it on my JasperServer. When I try to upload the first main report the iReport wizard offerd me to attach the first subreport.jrxml in resource folder and access it with repo:subreport.jrxml or repo:subreport.jasper. Then I manually upload the second level subreports and do the same thing change the subreport expression to repo:subreportA.jasper and repo:subreportB.jasper.

I got compilation error : Unable to locate the subreport with expression: ""repo:subreport.jasper"". java.lang.Exception: repo:subreport.jrxml not found.


I try dozen solution and nothing works. using : SUBREPORT_DIR @ the beginning,

using full path : repo:/Circuit_Reports/Connectivity/Connectivity_files/,

switch between .jasper & .jrxml.

using jasperserver_api_engine_impl_0_fix.jar in lib folder as a fixation to this bug,

I also searched the database record to be sure that they are in the same folder and have the same parent folder.

 

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...