slt, tou le monde
lorsk jexecute cette comande java org.apache.axis.wsdl.WSDL2Java http://localhost:8080/axis/Bing.jws?wsdl
*jaurai cette reponse
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/axis/wsdl/
WSDL2Java
komen je fai
slt, tou le monde
lorsk jexecute cette comande java org.apache.axis.wsdl.WSDL2Java http://localhost:8080/axis/Bing.jws?wsdl
*jaurai cette reponse
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/axis/wsdl/
WSDL2Java
komen je fai
Bonjour,
Je n'ai pas assez de renseignements pour te répondre mais j'ai eu la même erreur dans une discussion voisine. Si tu jettes un coup d'oeil, ça te donnera peut être la solution
J'ai eu le même problème.
Je l'ai résolu en précisant dans mon path les jar dont wsdl2java a besoin.
Ci-dessous, un fichier .bat pour lancer la génération depuis un .wsdl.
++
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5 set CLASSPATH=%PATH%;%AXIS_HOME%\lib\axis.jar;%AXIS_HOME%\lib\wsdl4j-1.5.1.jar;%AXIS_HOME%\lib\saaj.jar;%AXIS_HOME%\lib\log4j-1.2.8.jar;%AXIS_HOME%\lib\commons-logging-1.0.4.jar;%AXIS_HOME%\lib\jaxrpc.jar;%AXIS_HOME%\lib\commons-discovery-0.2.jar echo %CLASSPATH% java org.apache.axis.wsdl.WSDL2Java MyWSDL.wsdl pause
Salut,
J'ai le même problème:
Mon CLASSPATH contient toutes les références aux .jar ou .class que j'utilise dans mon programme! Je sais plus quoi faire d'autre !!!
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11 Exception in thread "main" java.lang.NoClassDefFoundError: persistentOntology\Main Caused by: java.lang.ClassNotFoundException: persistentOntology\Main.java at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClassInternal(Unknown Source) Could not find the main class: persistentOntology\Main.java. Program will exit.
Bonjour,
Pourrais-tu poster ta classe main ?
Mes liens: Profil | Blog
Mes articles Java : JSF 2.0 | NetBeans 6.9/OSGi
Mes articles Webmarketing : Apprenez à mixer, filtrer, différentes sources de flux (RSS,...)
Vidéos pour les membres :
James Gosling - Créateur du langage Java
Chris Melissinos - Chef Evangéliste
Réseaux sociaux: Twitter Webmarketing | Facebook Webmarketing
Grâce à un Post ouvert dans une autre catégorie de ce forum (java/débuter) j'ai corriger ma commande d'exécution en java.exe persistentOntology.Main (c'est simple mais je débute en java)! Et le message d'erreur Exception in thread "main" java.lang.NoClassDefFoundError s'est substituer en un autre Exception in thread "main" java.lang.ExceptionInInitializerError
Main.java (Ce code je ne l'ai pas fait, ce sont des exemples frouni avec JENA. Je le teste avant le mien, et j'obtiens la même erreur qu'avec mon code)
Message d'erreur
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121 package persistentOntology; import com.hp.hpl.jena.ontology.*; import com.hp.hpl.jena.rdf.model.ModelMaker; /** * <p> * Simple execution wrapper for persistent ontology example. * </p> * <p> * Usage: * <pre> * java jena.examples.ontology.persistentOntology.Main * [--dbUser string] e.g: --dbUser ijd * [--dbURL string] e.g: --dbURL jdbc:postgresql://localhost/jenatest * [--dbPw string] e.g: --dbPw nosecrets * [--dbType string] e.g: --dbType PostgreSQL * [--dbDriver string] e.g: --dbDriver org.postgresql.Driver * [--reload] if true will reload the source data * [sourceURL] optional source URL for the data to persist * </pre> * If no db parameters or source URL is given, defaults will be used. * </p> public class Main { // Constants ////////////////////////////////// public static final String ONT1 = "urn:x-hp-jena:test1"; public static final String ONT2 = "urn:x-hp-jena:test2"; public static final String DB_URL = "jdbc:postgresql://localhost/jenatest"; public static final String DB_USER = "ijd"; public static final String DB_PASSWD = ""; public static final String DB = "PostgreSQL"; public static final String DB_DRIVER = "org.postgresql.Driver"; // Static variables ////////////////////////////////// // database connection parameters, with defaults private static String s_dbURL = DB_URL; private static String s_dbUser = DB_USER; private static String s_dbPw = DB_PASSWD; private static String s_dbType = DB; private static String s_dbDriver = DB_DRIVER; // if true, reload the data private static boolean s_reload = false; // source URL to load data from; if null, use default private static String s_source; public static void main( String[] args ) { processArgs( args ); // check for default sources if (s_source == null) { s_source = getDefaultSource(); } // create the helper class we use to handle the persistent ontologies PersistentOntology po = new PersistentOntology(); // ensure the JDBC driver class is loaded try { Class.forName( s_dbDriver ); } catch (Exception e) { System.err.println( "Failed to load the driver for the database: " + e.getMessage() ); System.err.println( "Have you got the CLASSPATH set correctly?" ); } // are we re-loading the data this time? if (s_reload) { // we pass cleanDB=true to clear out existing models // NOTE: this will remove ALL Jena models from the named persistent store, so // use with care if you have existing data stored ModelMaker maker = po.getRDBMaker( s_dbURL, s_dbUser, s_dbPw, s_dbType, true ); // now load the source data into the newly cleaned db po.loadDB( maker, s_source ); } // now we list the classes in the database, to show that the persistence worked ModelMaker maker = po.getRDBMaker( s_dbURL, s_dbUser, s_dbPw, s_dbType, false ); po.listClasses( maker, s_source ); } /** * Process any command line arguments */ private static void processArgs( String[] args ) { int i = 0; while (i < args.length) { String arg = args[i++]; if (arg.equals( "--dbUser" )) {s_dbURL = args[i++];} else if (arg.equals( "--dbURL" )) {s_dbURL = args[i++];} else if (arg.equals( "--dbPasswd" )) {s_dbPw = args[i++];} else if (arg.equals( "--dbType" )) {s_dbType = args[i++];} else if (arg.equals( "--reload" )) {s_reload = true;} else if (arg.equals( "--dbDriver" )) {s_dbDriver = args[i++];} else { // assume this is a URL to load data from s_source = arg; } } } private static String getDefaultSource() { // use the ont doc mgr to map from a generic URN to a local source file OntDocumentManager.getInstance().addAltEntry( ONT1, "file:src-examples/data/test1.owl" ); OntDocumentManager.getInstance().addAltEntry( ONT2, "file:src-examples/data/test2.owl" ); return ONT1; } }
Mon fichier à moi est le suivant, comme j'ai dit plus haut j'obtiens la même erreur.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 C:\Users\toto\Downloads\JENA>java.exe persistentOntology.Main Exception in thread "main" java.lang.ExceptionInInitializerError at org.slf4j.LoggerFactory.getSingleton(LoggerFactory.java:189) at org.slf4j.LoggerFactory.bind(LoggerFactory.java:112) at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:105) at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:235) at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:208) at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:221) at com.hp.hpl.jena.rdf.model.impl.PropertyImpl.<clinit>(PropertyImpl.java:64) at com.hp.hpl.jena.enhanced.BuiltinPersonalities.<clinit>(BuiltinPersonalities.java:27) at com.hp.hpl.jena.rdf.model.impl.ModelCom.<init>(ModelCom.java:51) at com.hp.hpl.jena.rdf.model.ModelFactory.createDefaultModel(ModelFactory.java:122) at com.hp.hpl.jena.rdf.model.ModelFactory.createDefaultModel(ModelFactory.java:116) at com.hp.hpl.jena.vocabulary.OntDocManagerVocab.<clinit>(OntDocManagerVocab.java:37) at com.hp.hpl.jena.ontology.OntDocumentManager.<clinit>(OntDocumentManager.java:83) at persistentOntology.Main.getDefaultSource(Main.java:164) at persistentOntology.Main.main(Main.java:99) Caused by: java.lang.UnsupportedOperationException: This code should have never made it into the jar at org.slf4j.impl.StaticLoggerBinder.<init>(StaticLoggerBinder.java:67) at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:48) ... 15 more
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55 package mypackage; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.util.concurrent.TimeUnit; import com.hp.hpl.jena.query.DataSource; import com.hp.hpl.jena.query.Query; import com.hp.hpl.jena.query.QueryExecution; import com.hp.hpl.jena.query.QueryExecutionFactory; import com.hp.hpl.jena.query.QueryFactory; import com.hp.hpl.jena.query.ResultSet; import com.hp.hpl.jena.query.ResultSetFormatter; import com.hp.hpl.jena.rdf.model.InfModel; import com.hp.hpl.jena.rdf.model.Model; import com.hp.hpl.jena.rdf.model.ModelFactory; import com.hp.hpl.jena.reasoner.ReasonerFactory; import com.hp.hpl.jena.reasoner.rulesys.OWLMicroReasonerFactory; public class Test { static Query loadQuery(File file) throws IOException { } static Model loadModel(File file) throws IOException { } static void executeSelectQuery(DataSource dataset, String queryString) { // Execute the query and obtain results } public static void main(String[] args) throws Exception { File ontologie = new File("ontologie.owl"); Model model = loadModel(ontologie); ReasonerFactory reasonerFactory = new OWLMicroReasonerFactory(); InfModel infModel = ModelFactory.createInfModel(reasonerFactory.create(null), model); File question = new File("requete.rq"); Query query = loadQuery(question); QueryExecution qe = QueryExecutionFactory.create(query, infModel); ResultSet results = qe.execSelect(); ResultSetFormatter.out(results, query); } }
J'ai eu la meme erreur que toi : j'ai importé tous les fichier .jar nécessaire pour le fonctionnement de l'api jena meme il ne reconnait pas toujour le package com.hp.hpl.jena.. Est ce que tu as trouvé une solution?
Partager