Précédent   Forum des professionnels en informatique > Logiciels > Solutions d'entreprise > Business Intelligence > Jasper
Jasper Forum d'entraide sur Jasper Reports. Avant de poster --> FAQ Jasper, Tutoriels Jasper
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 27/07/2011, 13h03   #1
Membre régulier
 
Homme Gael Moro
Ingénieur Informatique et Réseaux
Inscription : avril 2011
Messages : 122
Détails du profil
Informations personnelles :
Nom : Homme Gael Moro
Localisation : France, Isère (Rhône Alpes)

Informations professionnelles :
Activité : Ingénieur Informatique et Réseaux
Secteur : Industrie

Informations forums :
Inscription : avril 2011
Messages : 122
Points : 91
Points : 91
Par défaut JRXmlLoader.load() avec application Java web

Bonjour,

J'ai un problème avec "JRXmlLoader.load", je suis dans une application web et donc l'emplacement de mon fichier est: "http://localhost:8080/formation/src/AttestationType.jrxml" mais j'ai une exception de type FileNotFound:
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
 
27 juil. 2011 13:00:13 sitiv.formation.javaClass.tools.CreateFile createPdfAttestation
GRAVE: null
net.sf.jasperreports.engine.JRException: java.io.FileNotFoundException: http:\localhost:8080\formation\src\AttestationType.jrxml (Syntaxe du nom de fichier, de répertoire ou de volume incorrecte)
	at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:174)
	at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:154)
	at sitiv.formation.javaClass.tools.CreateFile.createPdfAttestation(CreateFile.java:70)
	at sitiv.formation.javaClass.tools.PdfTest.testCreatePdfAttestation(PdfTest.java:73)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
	at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
	at junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:39)
	at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:518)
	at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:1052)
	at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:906)
Caused by: java.io.FileNotFoundException: http:\localhost:8080\formation\src\AttestationType.jrxml (Syntaxe du nom de fichier, de répertoire ou de volume incorrecte)
	at java.io.FileInputStream.open(Native Method)
	at java.io.FileInputStream.<init>(FileInputStream.java:120)
	at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:169)
	... 28 more
On peut voir que l'url a été changée (des back slash à la place des slash)

Comment je peux récupérer mon fichier de mon serveur?

Merci
Spiritkill est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 01/08/2011, 10h39   #2
Rédacteur/Modérateur
 
Avatar de JauB
 
Homme Faisel
Ingénieur COBOL/AS400
Inscription : octobre 2005
Messages : 1 713
Détails du profil
Informations personnelles :
Nom : Homme Faisel
Âge : 31
Localisation : Maroc

Informations professionnelles :
Activité : Ingénieur COBOL/AS400
Secteur : Finance

Informations forums :
Inscription : octobre 2005
Messages : 1 713
Points : 2 712
Points : 2 712
Envoyer un message via AIM à JauB Envoyer un message via MSN à JauB Envoyer un message via Yahoo à JauB
Bonjour,
Essaie de récupérer le chemin de ton Jasper et non pas de ton Jrxml.
Tu as la méthode :
Code :
getClass().getResource("reports/TonReport.jasper").getPath();
Tu peux suivre cette discussion ici.
Bon courage.
__________________
*** Ingénieur COBOL/AS400 ***

-------------------------------------------------------------------

Mes articles, Mon Blog

Rubrique Jasper/iReport :
------- Forum Jasper --------
----- FAQ Jasper/iReport -----

JauB est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 05/08/2011, 11h33   #3
Membre régulier
 
Homme Gael Moro
Ingénieur Informatique et Réseaux
Inscription : avril 2011
Messages : 122
Détails du profil
Informations personnelles :
Nom : Homme Gael Moro
Localisation : France, Isère (Rhône Alpes)

Informations professionnelles :
Activité : Ingénieur Informatique et Réseaux
Secteur : Industrie

Informations forums :
Inscription : avril 2011
Messages : 122
Points : 91
Points : 91
Bonjour et merci de ta réponse,

j'ai trouvé la solution dans le lien que tu m'as donné:

Code :
1
2
 
InputStream in =getClass().getResourceAsStream("reports/report1.jrxml");
Mais le in est "null", je pense que c'est parce que mon fichier n'est pas dans les resources de l'application.
je l'ai mise dans: "monApp/web/src/reports/report1.jrxml".

Je ne sais pas le rajouter aux ressources.


Merci encore.
Spiritkill est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 05/08/2011, 12h01   #4
Membre régulier
 
Homme Gael Moro
Ingénieur Informatique et Réseaux
Inscription : avril 2011
Messages : 122
Détails du profil
Informations personnelles :
Nom : Homme Gael Moro
Localisation : France, Isère (Rhône Alpes)

Informations professionnelles :
Activité : Ingénieur Informatique et Réseaux
Secteur : Industrie

Informations forums :
Inscription : avril 2011
Messages : 122
Points : 91
Points : 91
Bon c'est bon ça marche, j'ai rien changé mais ça fonctionne. C'est le principal.


Merci beaucoup
Spiritkill est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité Cette discussion est résolue.
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 15h18.


 
 
 
 
Partenaires

Hébergement Web