• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Can't get JIBX to run in ANT

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm trying to get an ANT script to run in myEclipse on my new Mac Pro. I'm not sure I have everything configured properly. Perhaps someone can look at the following and see what I'm doing wrong.

In the ANT script is the the following taskdef:

<!-- JiBX binding compiler task definition -->
<taskdef classname="org.jibx.binding.ant.CompileTask" name="bind">
<classpath>
<pathelement location="lib/bcel.jar"/>
<pathelement location="lib/jibx-bind.jar"/>
<pathelement location="lib/jibx-run.jar"/>
<pathelement location="lib/xpp3.jar"/>
</classpath>
</taskdef>

I have added the above jars in eclipse's External Dialog Config, so they are defined at <project name>/lib/

The bind task is then called here:

<!-- Run JiBX binding compiler -->
<bind load="true" verbose="false">
<bindingfileset includes="mpdwcrbinding.xml, binding.xml, localvideobinding.xml, mlbdatabinding.xml, leaderboardsearch.xml,leaderboardupdate.xml, leaderboardquery.xml, hotelbinding.xml, pastwxdaily.xml, pastwxhourly.xml, tropicalstormdata.xml, wxgoldmaps.xml" dir="config/jibx"/>
<classpathset dir="lib/"/>
<!-- classpathset dir="lib/jibx-run.jar" / -->
</bind>

The xml files exist at <project name/config/jibx/

However, when the ANT script reaches the <bind> tag above I get the following failure code:

BUILD FAILED
/Volumes/Data/JavaProjects/estreetDev/build.xml:124: java.lang.ExceptionInInitializerError

Does anything pop out at anyone?

Thanks,
Steve
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nothing pops out, but try running Ant with the -v option, that should give some more details on the error.
 
Steve Sherwood
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've done the verbose mode and it's telling me:

Caused by: java.lang.IllegalArgumentException: Class org.jibx.runtime.Utility not found in any classpath

As I said I had the jar, jibx-run.jar, added to the ANT build's classpath as well as to the project's class path in eclipse. Inside of that jar is

org.jibx.runtime.Utility.class

It's like eclipse on the Mac can't work with jar files.

Any ideas.
 
Peter Johnson
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try using full path names in your pathelements. Perhaps the base directory is not what you think it is. If that works, then you need to determine what the actual base directory is, and then you can adjust the pathelements. Or you could define a property (in build.properties) that defines the location of the JiBX files and then use that in the classpath.

Another solution would be to place the JiXB JARs in the Ant lib directory. Yes it is drastic, but it should work.

Finally, have you tried running the Ant script from a command line (not from within myEclipse)? If that works, then at least you know that MyEclipse is not screwing it up.
 
Steve Sherwood
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've run the ant script from the command line and it works, so ANT is working correctly. Also, the basedir is what I think it is. I've echoed it in the ANT script and it prints out exactly what I think it is. I believe I included that in the previous post.

I HAVE to believe that myEclipse works on Mac OS X, so all I can figure is that I don't have a configuration setting right. I've tried everything I can think of and I can't get it to work. I'm desperate to find someone who knows how to configure ANT to run on myEclipse on Mac OS X. I need to know how to set the classpaths in the External Tools Dialog or Project Preferences or Eclipse preferences or where ever (I've tried them all), so that when the ANT build runs it sees the classes inside of the jars that are on the classpaths??? This shouldn't be this hard, but I've been trying for two weeks to figure this out. I am totally frustrated. Maybe there's a system environment variable that is not set. There has to be some solution to this problem!!

I've tried myEclipse forums, this forum, Apple's site, and I can't find anyone who can help me. If there is a Mac User on this forum, please respond with some advice.

THANKS
 
Peter Johnson
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I just now noticed this. The taskdef uses the class org.jibx.binding.ant.CompileTask. The CNFE mentions org.jibx.runtime.Utility. Here is what I think is happening: the CompileTask class is being loaded correctly. It in turn is attempting to start another Java process using the Utility class as the main class, and that second process cannot find the proper JAR file.

To see if this is the case, try this. I assume, based on what you have posted so far, that you are having myEclipse run Ant in a separate process (and not within myEclipse itself). If so, add the "-verbose:class" JVM command line option to the Ant process. This will print out each class loaded and the JAR it comes from. You should see that CompileTask is loaded just fine.

Next, you have to find out where, and if, Utility is being fired up. You might have to modify the code to add the "-verbose:class" option. And you need to know which JAR contains the Utility class.

All of this, if it does not highlight the solution, should at least help pinpoint where to look next.
 
Steve Sherwood
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
org.jibx.runtime.Utility.class is in lib/jibx-run.jar.

I am running ANT inside of myEclipse. I added verbose to the command options. Here is the output from the console tab in myEclipse with verbose turned on:

Apache Ant version 1.7.0 compiled on February 29 2008
Buildfile: /Volumes/Data/JavaProjectsWork/estreetDev/testBuild.xml
parsing buildfile /Volumes/Data/JavaProjectsWork/estreetDev/testBuild.xml with URI = file:/Volumes/Data/JavaProjectsWork/estreetDev/testBuild.xml
Project base dir set to: /Volumes/Data/JavaProjectsWork/estreetDev
[antlib rg.apache.tools.ant] Could not load definitions from resource org/apache/tools/ant/antlib.xml. It could not be found.
[property] Loading /Volumes/Data/JavaProjectsWork/estreetDev/build.ant.properties
[property] Unable to find property file: /Volumes/Data/JavaProjectsWork/estreetDev/build.ant.properties
Arguments: -verbose -Dbasedir=/Volumes/Data/JavaProjectsWork/estreetDev -Dorg.eclipse.ant.core.ANT_PROCESS_ID=1215263978740
Build sequence for target(s) `doIt' is [doIt]
Complete build sequence is [doIt, ]

doIt:
[echo] /Volumes/Data/JavaProjectsWork/estreetDev
[bind] Using the following paths:
[bind] /Volumes/Data/JavaProjectsWork/estreetDev/lib
[bind] Using the following binding paths:
[bind] /Volumes/Data/JavaProjectsWork/estreetDev/config/jibx/binding.xml

BUILD FAILED
/Volumes/Data/JavaProjectsWork/estreetDev/testBuild.xml:17: java.lang.ExceptionInInitializerError
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:115)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.eclipse.ant.internal.core.ant.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
at org.eclipse.ant.internal.core.ant.InternalAntRunner.run(InternalAntRunner.java:623)
at org.eclipse.ant.internal.core.ant.InternalAntRunner.run(InternalAntRunner.java:456)
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:585)
at org.eclipse.ant.core.AntRunner.run(AntRunner.java:377)
at org.eclipse.ant.internal.ui.launchConfigurations.AntLaunchDelegate$1.run(AntLaunchDelegate.java:230)
at java.lang.Thread.run(Thread.java:613)
Caused by: java.lang.ExceptionInInitializerError
at org.jibx.binding.Compile.compile(Compile.java:270)
at org.jibx.binding.ant.CompileTask.execute(CompileTask.java:238)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
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:585)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
... 17 more
Caused by: java.lang.IllegalArgumentException: Class org.jibx.runtime.Utility not found in any classpath
at org.jibx.binding.def.StringConversion.<init>(StringConversion.java:153)
at org.jibx.binding.def.PrimitiveStringConversion.<init>(PrimitiveStringConversion.java:152)
at org.jibx.binding.def.BindingDefinition.<clinit>(BindingDefinition.java:66)
... 25 more
--- Nested Exception ---
java.lang.ExceptionInInitializerError
at org.jibx.binding.Compile.compile(Compile.java:270)
at org.jibx.binding.ant.CompileTask.execute(CompileTask.java:238)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
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:585)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.eclipse.ant.internal.core.ant.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
at org.eclipse.ant.internal.core.ant.InternalAntRunner.run(InternalAntRunner.java:623)
at org.eclipse.ant.internal.core.ant.InternalAntRunner.run(InternalAntRunner.java:456)
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:585)
at org.eclipse.ant.core.AntRunner.run(AntRunner.java:377)
at org.eclipse.ant.internal.ui.launchConfigurations.AntLaunchDelegate$1.run(AntLaunchDelegate.java:230)
at java.lang.Thread.run(Thread.java:613)
Caused by: java.lang.IllegalArgumentException: Class org.jibx.runtime.Utility not found in any classpath
at org.jibx.binding.def.StringConversion.<init>(StringConversion.java:153)
at org.jibx.binding.def.PrimitiveStringConversion.<init>(PrimitiveStringConversion.java:152)
at org.jibx.binding.def.BindingDefinition.<clinit>(BindingDefinition.java:66)
... 25 more

Total time: 609 milliseconds
 
Peter Johnson
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This following lines tell me that the JiBX classes were found:

Caused by: java.lang.IllegalArgumentException: Class org.jibx.runtime.Utility not found in any classpath
at org.jibx.binding.def.StringConversion.<init>(StringConversion.java:153)
at org.jibx.binding.def.PrimitiveStringConversion.<init>(PrimitiveStringConversion.java:152)
at org.jibx.binding.def.BindingDefinition.<clinit>(BindingDefinition.java:66)



Which JAR file contains org.jibx.runtime.Utility?

Also, I did not mean the Ant verbose option. I meant the JVM option "-verbose:class". This JVM option, as I explained before, lists out each class loaded and the JAR file it can from. You will get thousands of lines of output. Because you are running Ant within the myEclipse process, you will have to change the JVM options for myEclipse. I don't know how to do this for myEclipse, but in Eclipse there is an eclipse.ini file that contains the JVM options. Also, you will want to redirect stdout to a file to capture all of the lines. Initially, look for the jibx clases that were in the stack trace fragment I quoted above, at look at which JAR file they came from.
 
Steve Sherwood
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I finally got it.

I needed to add the xercesImpl.jar to /Library/Java/Home/lib/endorsed/ and set the JRE tab in external tools to RUN the ANT script in a separate JRE.

I kept Googling until I found the answer at http://www.slamb.org/svn/repos/trunk/projects/axamol/sax-pipeline/README.

Thanks for all your help.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic