• Post Reply Bookmark Topic Watch Topic
  • New Topic

java.lang.NoClassDefFoundError: net/sf/jasperreports/engine/JRException  RSS feed

 
Sanket L Shah
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I am developing one application.
Eventhough I have added all the jars into the class path, it is showing me the exception like


java.lang.NoClassDefFoundError: net/sf/jasperreports/engine/JRException
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at org.mortbay.jetty.servlet.Holder.newInstance(Holder.java:153)
at org.mortbay.jetty.servlet.ServletHolder.getServlet(ServletHolder.java:339)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:463)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1093)




Please help me..
Thank you :-)
 
Mahendran Aiyappan
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you have jasperreports-x.x.x.jar in your classpath?


Mahendran.
 
Sanket L Shah
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mahendran Aiyappan wrote:Do you have jasperreports-x.x.x.jar in your classpath?
Mahendran.


Hello Mahendran,

First of all thanks for your reply...
I have all the jar files in my clas path and when i extract the jar files it show the missing class too...
I mean (java.lang.NoClassDefFoundError: net/sf/jasperreports/engine/JRException).

I have added ...
jasperreports-1.3.4.jar

This jar contains all the class.... Including JRException.class (Which causes the exception)


Here is some line of code...

public void service(ServletRequest request, ServletResponse response) throws ServletException, IOException
{
Query query = null;
List myList = null;
session = HibernateFactory.openSession();
query = session.createQuery(" from LanguageMaster");
myList = new ArrayList();
Map parameters = new HashMap();
parameters.put("Title", "This will be Title");
myList = query.list(); // Upto here it works fine ...

try {
JasperDesign design = JRXmlLoader.load("BasicReport.xml"); // It gives errror in this line
JasperReport report = new JasperCompileManager().compileReport(design);
JasperPrint print = JasperFillManager. fillReport(report, parameters, new JRBeanCollectionDataSource(myList));
JasperExportManager.exportReportToPdfFile(print,"sanket.pdf");

} catch (Exception e) {
e.printStackTrace();
}
}


If I run this code as a stand alone (With void main method) than it works fine...


Thanks Mahendran!
 
Mahendran Aiyappan
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mca Sanket Shah,

It could be the jar is not in the classpath of the server in which you are trying to execute. Anyway which server are you using?

Mahendran.
 
Sanket L Shah
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mahendran Aiyappan wrote:Mca Sanket Shah,

It could be the jar is not in the classpath of the server in which you are trying to execute. Anyway which server are you using?

Mahendran.



Yes Mahendran,

I am using tomcat 6.
I have added the jar file in the class path and that is why when i type net.sf.jasperreports.engine.JRException it
Fully qualify it automatically in my eclips editor....

One more thing to say... I am using GWT + Struts

Hope you will get what I have written...

 
Mahendran Aiyappan
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mca Sanket Shah,

I thing you are talking the class path of eclipse where as I am saying about the tomcat's classpath. Here you main method works because the jar is present in your eclipse classpath. Do you have this jar file in your WEB-INF/lib folder?

Mahendran.
 
Sanket L Shah
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mahendran Aiyappan wrote:Mca Sanket Shah,

I thing you are talking the class path of eclipse where as I am saying about the tomcat's classpath. Here you main method works because the jar is present in your eclipse classpath. Do you have this jar file in your WEB-INF/lib folder?

Mahendran.


Great man....

I got the problem solved....
Really thank you very much for your great help...

Thank you so much :-)
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!