Jump to content
Changes to the Jaspersoft community edition download ×

java.lang.NoClassDefFoundError


nikhilbabu1990

Recommended Posts

Hi,


       To invoke my jasper report from jasper server, i wrote the java code in Jdev 12.2.1 by using REST web service. but while running i am getting this error   "


 


Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/http/util/Args


  at org.apache.http.auth.UsernamePasswordCredentials.<init>(UsernamePasswordCredentials.java:78)


  at com.uravatech.jasper.Jasper.main(Jasper.java:30)


Caused by: java.lang.ClassNotFoundException: org.apache.http.util.Args


  at java.net.URLClassLoader.findClass(URLClassLoader.java:381)


  at java.lang.ClassLoader.loadClass(ClassLoader.java:424)


  at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)


  at java.lang.ClassLoader.loadClass(ClassLoader.java:357)


  ... 2 more


Process exited with exit code 1. "


 


And the code which i used is


 


public class Jasper {  


            public static void main(String[] args) throws Exception          


                CredentialsProvider credsProvider = new BasicCredentialsProvider();


                                     HttpHost targetHost = new HttpHost("192.168.2.201", 8081, "http");


                               credsProvider.setCredentials(  new AuthScope(targetHost)


                                                            , new UsernamePasswordCredentials("jasperadmin", "jasperadmin"));                              


                CloseableHttpClient httpclient = HttpClients.custom()


                        .setDefaultCredentialsProvider(credsProvider).build();         


                try {


                    HttpGet httpget = new HttpGet("http://192.168.2.201:8081/jasperserver[-pro]/rest_v2/reports/reports/CrossTab/Accounts.pdf");


                    System.out.println("executing request" + httpget.getRequestLine());


                    CloseableHttpResponse response = httpclient.execute(httpget);


                    System.out.println(response.getStatusLine());


          } finally {


                    httpclient.close();


                }


              }


}


 


And i added these jar files also,


commons-beanutils-1.9.2


commons-collections-3.2.2


commons-digester-2.1


commons-logging-1.2


groovy-all-2.4.5


httpclient-4.3.4


httpcomponents-client-4.5.1-src.tar


httpcore-4.0-beta3


itext-2.1.7.js3


jasperreports-6.2.0


jrs-rest-java-client-6.2.0-jar-with-dependencies


jrwebservice_0


restapicodesample


RESTful-Java-Client-ApacheHttpClient-Example


 


Help me to resolve this error.


 


Regards,


 


Nikhil


Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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