Hi!
This message contains 2 parts as my prev email was not accepted by the
maillist system.
===================
=> My main problem.
=> The same problem but with the output of compile running with -v option.
===================
Hi!
I would like to use JiBX. This is the !PACKAGE! what I was looking for!
I came back to java, started to refresh it after 5-6 years of break (I
am biologist). I can not sleep well for 3 days in order to learn
java/JiBX and see a simple working example.
But if I insert the “BindingDirectory.getFactory(MyClass.class)” into
the code I get a java.lang.NoClassDefFoundError. See below.
I tried to solve this in the last days, but I can not step forward.
Thanks for your help in advance,
Tamas
//===================================
// FILE SwissProt.java
package org.biohegedus.myprj;
public class SwissProt {
public String entry_name;
public SwissProt() {
this.entry_name = "default_value";
};
};
//===================================
// FILE Proba.java (version A)
package org.biohegedus.myprj;
//import java.io.*;
import org.jibx.runtime.*;
public class Proba {
public static void main(String[] args) {
try{
//IBindingFactory bfact = BindingDirectory.getFactory
(SwissProt.class);
//IUnmarshallingContext uctx =
bfact.createUnmarshallingContext();
//Object obj = uctx.unmarshalDocument( new FileInputStream
("sw_test.xml"), null);
SwissProt sp = new SwissProt();
System.out.println( sp.entry_name);
}
catch(Exception e){
e.printStackTrace();
}
}
}
[EMAIL PROTECTED] myprj]$ javac Proba.java
[EMAIL PROTECTED] myprj]$ javac SwissProt.java
[EMAIL PROTECTED] myprj]$ java org.biohegedus.myprj.Proba
default_value
[EMAIL PROTECTED] myprj]$
The base code seems to work well… But:
//===================================
// !!!! Proba.java (Version B)
package org.biohegedus.myprj;
//import java.io.*;
import org.jibx.runtime.*;
public class Proba {
public static void main(String[] args) {
try{
IBindingFactory bfact = BindingDirectory.getFactory
(SwissProt.class); // line 9
//IUnmarshallingContext uctx =
bfact.createUnmarshallingContext();
//Object obj = uctx.unmarshalDocument( new FileInputStream
("sw_test.xml"), null);
SwissProt sp = new SwissProt();
System.out.println( sp.entry_name);
}
catch(Exception e){
e.printStackTrace();
}
}
}
[EMAIL PROTECTED] myprj]$ javac SwissProt.java
[EMAIL PROTECTED] myprj]$ javac Proba.java
[EMAIL PROTECTED] myprj]$ java -cp .:/usr/java/jibx/lib/jibx-
run.jar:/home/hegedus/prg/javas:/usr/java/jibx/lib/bcel.jar:/usr/java/ji
bx/lib/jibx-bind.jar org.jibx.binding.Compile SwissProt_bndg.xml
[EMAIL PROTECTED] myprj]$ java org.biohegedus.myprj.Proba
Exception in thread "main" java.lang.NoClassDefFoundError: SwissProt
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:141)
at org.biohegedus.myprj.Proba.class$(Proba.java:9)
at org.biohegedus.myprj.Proba.main(Proba.java:9)
[EMAIL PROTECTED] myprj]$
$JAVA_HOME=/usr/java/j2sdk1.4.2_08
$CLASS_PATH=.:/usr/java/jibx/lib/jibx-run.jar:/home/hegedus/prg/javas
(note: ‘javas’ dir contains the dirs org/biohegedus/myprj; all my files
are in the org/biohegedus/myprj and I am performing the compilation and
running from that dir; I do not use IDE (but emacs))
=======================================================
I tried compiled the bindings from different locations ( ROOT (javas);
ROOT/../myprj dir) with a lot of classpath definitions with the '-v' switch.
I get still the same error.
Thanks,
Tamas
PS: I do not give up! But it would be great to have it functional w/o
much more hassle.
==========================================================================
[EMAIL PROTECTED] javas]$ java -cp
.:/usr/java/jibx/lib/jibx-run.jar:/home/hegedus/prg/javas:/home/hegedus/prg/javas/org/biohegedus/myprj:/usr/java/jibx/lib/bcel.jar:/usr/java/jibx/lib/jibx-bind.jar
org.jibx.binding.Compile -v org/biohegedus/myprj/SwissProt_bndg.xml
Using paths:
.
/usr/java/jibx/lib/jibx-run.jar
/home/hegedus/prg/javas
/home/hegedus/prg/javas/org/biohegedus/myprj
/usr/java/jibx/lib/bcel.jar
/usr/java/jibx/lib/jibx-bind.jar
/usr/java/jibx/lib/xpp3.jar
.
Using bindings:
org/biohegedus/myprj/SwissProt_bndg.xml
Running binding compiler version jibx-rc1
binding SwissProt_bndg:
context (mp#=1) (cv#=0) (fm#=0)
mapping class SwissProt to element entry (#0)
context (cv#=0) (fm#=0)
element wrapper entry
object binding for SwissProt
structure ordered
element name from property entry_name (java.lang.String)
Generating code for mapping SwissProt
After linking view of binding SwissProt_bndg:
binding SwissProt_bndg:
context (mp#=1) (cv#=0) (fm#=0)
mapping class SwissProt to element entry (#0)
context (cv#=0) (fm#=0)
element wrapper entry
object binding for SwissProt
structure ordered
element name from property entry_name (java.lang.String)
Wrote 2 files
JiBX_SwissProt_bndgSwissProt_access output file size is 1785 bytes
JiBX_SwissProt_bndgFactory output file size is 2239 bytes
Kept 1 files unchanged:
SwissProt
Deleted 0 files:
[EMAIL PROTECTED] javas]$ java org.biohegedus.myprj.Proba
Exception in thread "main" java.lang.NoClassDefFoundError: SwissProt
etc...
--
Tamas Hegedus, PhD | phone: (1) 919-966 0329
UNC - Biochem & Biophys | fax: (1) 919-966 5178
5007A Thurston-Bowles Bldg | mailto:[EMAIL PROTECTED]
Chapel Hill, NC, 27599-7248 | http://biohegedus.org
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id492&op=click
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users