Java.lang.ClassNotFoundException: Will not load class net.sf.jasperreports.engin

Signaler
Messages postés
1
Date d'inscription
jeudi 22 juillet 2021
Statut
Membre
Dernière intervention
22 juillet 2021
-
Bonjour,
Quelqu'un peut m'aider svp.
j'ai concu une application en java netbeans,en genera des rapports,j'utilise jasperreport.mais si je visualise le rapport dans netbeans ,je recoit cet erreur:



java.lang.ClassNotFoundException: Will not load class net.sf.jasperreports.engine.xml.JRXmlLoader arbitrarily from one of ModuleCL@1a8beb1[Jasperreport2] and ModuleCL@105fcf1[Apache_Ant] starting from ModuleCL@1503a37[Pharmamod]; see https://netbeans.apache.org/wiki/DevFaqModuleCCE.asciidoc
at org.netbeans.ProxyClassLoader.loadClass(ProxyClassLoader.java:204)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
Caused: java.lang.NoClassDefFoundError: net/sf/jasperreports/engine/xml/JRXmlLoader
at Pharmamod.planTopComponent.jButton1ActionPerformed(planTopComponent.java:120)
at Pharmamod.planTopComponent.access$000(planTopComponent.java:50)
at Pharmamod.planTopComponent$1.actionPerformed(planTopComponent.java:82)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2346)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
at java.awt.Component.processMouseEvent(Component.java:6527)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3321)
at java.awt.Component.processEvent(Component.java:6292)
at java.awt.Container.processEvent(Container.java:2234)
at java.awt.Component.dispatchEventImpl(Component.java:4883)
at java.awt.Container.dispatchEventImpl(Container.java:2292)
at java.awt.Component.dispatchEvent(Component.java:4705)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4898)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4533)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4462)
at java.awt.Container.dispatchEventImpl(Container.java:2278)
at java.awt.Window.dispatchEventImpl(Window.java:2739)
at java.awt.Component.dispatchEvent(Component.java:4705)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:746)
at java.awt.EventQueue.access$400(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:697)
at java.awt.EventQueue$3.run(EventQueue.java:691)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:86)
at java.awt.EventQueue$4.run(EventQueue.java:719)
at java.awt.EventQueue$4.run(EventQueue.java:717)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:716)
at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:159)
[catch] at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)







Mon code java est




private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
try {
//claudine123_0189

// - Chargement et compilation du rapport
JasperDesign jDesign = JRXmlLoader.load("C:\\Users\\SAMSUNG\\Pictures\\Pharmacie1\\Pharmamod\\src\\Report\\Plan_comptable.jrxml");

String query="SELECT classe,\n" +
"(case\n" +
" when classe=1 then \"OPERATIONS FINANCIERES\"\n" +
" when classe=3 then \"OPERATIONS DIVERSES\"\n" +
" when classe=4 then \"IMMOBILISATIONS\"\n" +
" when classe=5 then \"FONDS PROPRES ET ASSIMILES\"\n" +
" when classe=6 then \"CHARGES\"\n" +
" when classe=7 then \"PRODUITS\"\n" +
" else \"\"\n" +
" END)as Desc_class\n" +
" ,\n" +
" sousclasse,\n" +
"(case\n" +
" when sousclasse=10 then \"ENCAISSE\"\n" +
" when sousclasse=11 then \"DEPOT A VUE\"\n" +
" when sousclasse=13 then \"EMPRUNTS\"\n" +
" when sousclasse=30 then \"STOCKS\"\n" +
" when sousclasse=31 then \"DEBITEUR DIVERS\"\n" +
" when sousclasse=32 then \"CREDITEURS DIVERS\"\n" +
" when sousclasse=40 then \"IMMOBILISATIONS INCORPORELLES\"\n" +
" when sousclasse=41 then \"IMMOBILISATIONS CORPORELLES\"\n" +
" when sousclasse=48 then \"AMORTISSEMENT\"\n" +
" when sousclasse=51 then \"SUBVENTIONS D’INVESTISSEMENT\"\n" +
" when sousclasse=52 then \"REPPORT A NOUVEAU\"\n" +
" when sousclasse=53 then \"CAPITAL\"\n" +
" when sousclasse=54 then \"RESULTAT\"\n" +
" when sousclasse=60 then \"CHARGES GENERALES D’EXPLOITATION\"\n" +
" when sousclasse=64 then \"IMPOT ET TAXE\"\n" +
" when sousclasse=65 then \"REMUNERATIONS\"\n" +
" when sousclasse=66 then \"PERTE\"\n" +
" when sousclasse=68 then \"AMORTISSEMENT DE IMMOBILISATIONS\"\n" +
" when sousclasse=70 then \"PRODUITS SUR VENTEE\"\n" +
" when sousclasse=71 then \"PRODUITS SUR LAVAGE\"\n" +
" when sousclasse=72 then \"PRODUITS SUR PARKING\"\n" +
" when sousclasse=73 then \"PRODUITS SUR ABBATOIRE\"\n" +
" when sousclasse=74 then \"PRODUITS DIVERS\"\n" +
" else \"\"\n" +
" END)as Desc_sous_class,\n" +
" SUBSTR(numcpte, 1, 3) as sousclasse1,\n" +
"(case\n" +
" when SUBSTR(numcpte, 1, 3)=401 then \"FRAIS D’ETABLISSEMENT\"\n" +
" when SUBSTR(numcpte, 1, 3)=411 then \"IMMEUBLE\"\n" +
" when SUBSTR(numcpte, 1, 3)=412 then \"MATERIEL ET MOBILIER\"\n" +
" when SUBSTR(numcpte, 1, 3)=481 then \"AMORTISSEMENT DES IMMOBILISATIONS INCORPORELLES\"\n" +
" when SUBSTR(numcpte, 1, 3)=482 then \"AMORTISSEMENT DES IMMOBILISATIONS CORPORELLES\"\n" +
" when SUBSTR(numcpte, 1, 3)=601 then \"COUT DES STOCKS VENDUS\"\n" +
" when SUBSTR(numcpte, 1, 3)=602 then \"FRAIS DE TRANSPORT\"\n" +
" when SUBSTR(numcpte, 1, 3)=603 then \"FRAIS D’ENTRETIEN, REPARATION ET FOUNITURES\"\n" +
" when SUBSTR(numcpte, 1, 3)=604 then \"FRAIS DES LOCATIONS\"\n" +
" when SUBSTR(numcpte, 1, 3)=605 then \"AUTRES CHARGES GENERALES D’EXPLOITATION DIVERSES\"\n" +
" else \"\"\n" +
" END)as Desc_sous_classe1,\n" +
" SUBSTR( numcpte, 1, 4) as sousclasse2,\n" +
"(case\n" +
" when SUBSTR( numcpte, 1, 4)=4821 then \"AMORTISSEMENT DES IMMEUBLES \"\n" +
" when SUBSTR( numcpte, 1, 4)=4822 then \"AMORTISSEMENT DES MATERIEL ET MOBILIER \"\n" +
" else \"\"\n" +
" END)as Desc_sous_class2,\n" +
"\n" +
" numcpte,description FROM `souscompte`";
JRDesignQuery updatequery=new JRDesignQuery();
updatequery.setText(query);


jDesign.setQuery(updatequery);
JasperReport jReport = JasperCompileManager.compileReport(jDesign);

// - Paramètres à envoyer au rapport
//Map parameters = new HashMap();
//parameters.put("date", "date");

// - Exécution du rapport
JasperPrint jPrint = JasperFillManager.fillReport(jReport, null, conn);
JasperViewer.viewReport(jPrint);
// - Création du rapport au format PDF
//JasperExportManager.exportReportToPdfFile(jasperPrint, "E:\\compte d'exploitation.pdf");
} catch(Exception e){
JOptionPane.showConfirmDialog(null, e);
}
}