I have made some progress with this problem.  It appears to be some kind of 
problem with ant.  If I use ant (within Eclipse or from the command line), I 
get the error.  If I go to a shell and extract everything from the jar files 
and build a new jar file that includes everything, it works.

I have added debugging output to list all of the system properties and compared 
the results between running from the jar generated by ant versus running the 
manually created jar file and they are the same.

If anyone has new ideas for me to try, I would appreciate it!

I am now just trying to link a simple Jena test, no longer including my real 
code.  My test program is:

import java.util.Properties;

import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.tdb.TDBFactory;

public class JenaTDBTest {
        public static void main(String[] args) {
                // Direct way: Make a TDB-backed Jena model in the named 
directory.
                  String directory = 
"/Users/barbaralerner/Desktop/MyDatabases/DB1" ;
                  
                  Properties properties = System.getProperties();
                  properties.list(System.out);
                  
                  System.out.println("sun.boot.class.path = " + 
System.getProperty("sun.boot.class.path"));
                  System.out.println("sun.boot.library.path = " + 
System.getProperty("sun.boot.library.path"));
                  System.out.println("java.endorsed.dirs = " + 
System.getProperty("java.endorsed.dirs"));
                  System.out.println("java.library.path = " + 
System.getProperty("java.library.path"));
                  System.out.println("java.ext.dirs = " + 
System.getProperty("java.ext.dirs"));
                  System.out.println("java.home = " + 
System.getProperty("java.home"));
                  System.out.println("user.dir = " + 
System.getProperty("user.dir"));
                  
                  try {
                          Model model = 
TDBFactory.createDataset(directory).getDefaultModel() ;
                          model.close() ;
                  } finally {
                          
System.out.println("javax.xml.parsers.DocumentBuilderFactory = " + 
System.getProperty("javax.xml.parsers.DocumentBuilderFactory"));
                          
System.out.println("javax.xml.parsers.SAXParserFactory= " + 
System.getProperty("javax.xml.parsers.SAXParserFactory"));
                          
System.out.println("org.apache.xerces.xni.parser.XMLParserConfiguration = " + 
properties.getProperty("org.apache.xerces.xni.parser.XMLParserConfiguration"));
                  }
        }

}


This is what my ant file looks like:

<?xml version="1.0" encoding="UTF-8"?>
<project name="JenaTDBTest" default="run" basedir="."> 
  <property name="jardir" value="${user.home}/Documents/JarFiles"/>
  <property name="ljiljars" value="${user.home}/Documents/LJilJarFiles/"/>
  <property name="jrunner" value="${ljiljars}/jrunner/"/>
  <!--<property name="tdblib" value="${jardir}/TDB-0.8.10/lib"/>-->
  <property name="tdblib" value="${jardir}/jena-tdb-0.9.0-incubating/lib"/>

  <target name="JenaTDBTest">
        <delete file="JenaTDBTest"/>
        <jar destfile="JenaTDBTest.jar">
                <manifest>
                  <attribute name="Main-Class"
                                value="JenaTDBTest"/>
                </manifest>     
                <fileset dir="bin" includes="**/*.class" />
                <zipfileset includes="**/*.class" 
src="${tdblib}/jena-tdb-0.9.0-incubating.jar"/>
                <zipfileset includes="**/*.class" 
src="${tdblib}/jena-arq-2.9.0-incubating.jar"/>
                <zipfileset includes="**/*.class" 
src="${tdblib}/jena-core-2.7.0-incubating.jar"/>
                <zipfileset includes="**/*.class" 
src="${tdblib}/slf4j-api-1.6.4.jar"/>
                <zipfileset includes="**/*.class" 
src="${tdblib}/slf4j-log4j12-1.6.4.jar"/>
                <zipfileset includes="**/*.class" 
src="${tdblib}/log4j-1.2.16.jar"/>
                <zipfileset includes="**/*.class" 
src="${tdblib}/xercesImpl-2.10.0.jar"/>
                <zipfileset includes="**/*.class" 
src="${tdblib}/xml-apis-1.4.01.jar"/>
                <zipfileset includes="**/*.class" 
src="${tdblib}/commons-codec-1.5.jar"/>
                <zipfileset includes="**/*.class" 
src="${tdblib}/httpclient-4.1.2.jar"/>
                <zipfileset includes="**/*.class" 
src="${tdblib}/httpcore-4.1.3.jar"/>
                <zipfileset includes="**/*.class" 
src="${tdblib}/icu4j-3.4.4.jar"/>
                <zipfileset includes="**/*.class" 
src="${tdblib}/jena-iri-0.9.0-incubating.jar"/>
 
        </jar>
  </target>
        
  <target name="run" depends="JenaTDBTest">
        <java jar="JenaTDBTest.jar" fork="true">
                <jvmarg value="-Djaxp.debug=1"/>
        </java>
        
  </target>
        
</project>


On May 27, 2012, at 11:41 AM, Barbara Lerner wrote:

> I am still stuck on this.  xerces is also include in the jdk classes, but it 
> uses a different package name there, so that shouldn't cause confusion, 
> should it?
> 
> I have looked through all the jar files I am building with and cannot find 
> another copy of xerces.
> 
> I have also looked in Java's lib/endorsed directory and it is empty.
> 
> I am on a Mac running 10.6.8 and Java 1.6.
> 
> I have switched to jena 0.9.0.
> 
> I would appreciate any suggestions on how to track this down.
> 
> Barbara
> 
> On May 25, 2012, at 3:28 AM, Dave Reynolds wrote:
> 
>> This looks like a problem with the version of Xerces. Make sure you don't 
>> have a different older Xerces on your classpath. Note that some Java 
>> environments have an "endorsed" directory which sneaks an old copy of Xerces 
>> onto your classpath without you being aware of it.
>> 
>> Dave
>> 
>> On 25/05/12 02:13, Barbara Lerner wrote:
>>> Hi,
>>> 
>>>  I am new to Jena and am trying to use tdb to create a database.  When I 
>>> call TDBFactory.createModel, I get the exception shown below.  I have tried 
>>> using ModelFactory.createDefaultModel() and that works fine.  I thought 
>>> there might be a versioning problem with external jars, but I believe I am 
>>> using the jar files that came with tdb in my build.
>>> 
>>>  I would appreciate any suggestions!
>>> 
>>> Barbara
>>> 
>>> Exception in thread "main" java.lang.ExceptionInInitializerError
>>>     at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
>>>     at 
>>> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
>>>     at 
>>> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
>>>     at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
>>>     at java.lang.Class.newInstance0(Class.java:355)
>>>     at java.lang.Class.newInstance(Class.java:308)
>>>     at org.apache.xerces.impl.dv.ObjectFactory.newInstance(Unknown Source)
>>>     at org.apache.xerces.impl.dv.SchemaDVFactory.getInstance(Unknown Source)
>>>     at org.apache.xerces.impl.dv.SchemaDVFactory.getInstance(Unknown Source)
>>>     at 
>>> com.hp.hpl.jena.datatypes.xsd.XSDDatatype.<init>(XSDDatatype.java:210)
>>>     at 
>>> com.hp.hpl.jena.datatypes.xsd.XSDDatatype.<init>(XSDDatatype.java:222)
>>>     at com.hp.hpl.jena.datatypes.xsd.impl.XSDFloat.<init>(XSDFloat.java:44)
>>>     at 
>>> com.hp.hpl.jena.datatypes.xsd.XSDDatatype.<clinit>(XSDDatatype.java:55)
>>>     at com.hp.hpl.jena.sparql.graph.NodeConst.<clinit>(NodeConst.java:16)
>>>     at 
>>> com.hp.hpl.jena.sparql.engine.optimizer.reorder.ReorderFixed.<clinit>(ReorderFixed.java:23)
>>>     at 
>>> com.hp.hpl.jena.sparql.engine.optimizer.reorder.ReorderLib.fixed(ReorderLib.java:53)
>>>     at com.hp.hpl.jena.tdb.sys.SystemTDB.<clinit>(SystemTDB.java:173)
>>>     at com.hp.hpl.jena.tdb.TDB.<clinit>(TDB.java:70)
>>>     at com.hp.hpl.jena.tdb.sys.SetupTDB.<clinit>(SetupTDB.java:70)
>>>     at 
>>> com.hp.hpl.jena.tdb.sys.DatasetGraphSetup.createDatasetGraph(DatasetGraphSetup.java:21)
>>>     at 
>>> com.hp.hpl.jena.tdb.sys.CachingTDBMaker.createDatasetGraph(CachingTDBMaker.java:46)
>>>     at com.hp.hpl.jena.tdb.sys.TDBMaker._createGraph(TDBMaker.java:71)
>>>     at com.hp.hpl.jena.tdb.TDBFactory.createGraph(TDBFactory.java:94)
>>>     at com.hp.hpl.jena.tdb.TDBFactory.createGraph(TDBFactory.java:100)
>>>     at com.hp.hpl.jena.tdb.TDBFactory.createModel(TDBFactory.java:56)
>>>     at laser.ddg.query.RdfModelFactory.getModel(RdfModelFactory.java:39)
>>>     at laser.ddg.query.RdfModelFactory.<clinit>(RdfModelFactory.java:19)
>>>     at laser.juliette.ddgbuilder.DDGBuilder.<init>(DDGBuilder.java:97)
>>>     at 
>>> laser.juliette.ddgbuilder.DDGBuilderConfigurator.visit(DDGBuilderConfigurator.java:16)
>>>     at 
>>> laser.juliette.runtime.RuntimeFactoryFactory.createRuntimeFactory(RuntimeFactoryFactory.java:13)
>>>     at laser.juliette.runner.Runner.startProcess(Runner.java:47)
>>>     at laser.juliette.runner.Runner.run(Runner.java:30)
>>>     at 
>>> laser.juliette.runner.RunnerCommandService.run(RunnerCommandService.java:22)
>>>     at laser.juliette.driver.Driver.run(Driver.java:48)
>>>     at laser.juliette.driver.Driver.main(Driver.java:25)
>>> Caused by: java.lang.RuntimeException: internal error
>>>     at org.apache.xerces.impl.dv.xs.XSSimpleTypeDecl.applyFacets1(Unknown 
>>> Source)
>>>     at 
>>> org.apache.xerces.impl.dv.xs.SchemaDVFactoryImpl.createBuiltInTypes(Unknown 
>>> Source)
>>>     at org.apache.xerces.impl.dv.xs.SchemaDVFactoryImpl.<clinit>(Unknown 
>>> Source)
>>>     ... 35 more
>>> 
>>> ------------------
>>> 
>>> Barbara Lerner
>>> Associate Professor
>>> Computer Science Dept.
>>> Mt. Holyoke College
>>> 
>>> 
>>> 
>>> 
> 
> ------------------
> 
> Barbara Lerner
> Associate Professor
> Computer Science Dept.
> Mt. Holyoke College
> 
> 
> 

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

Barbara Lerner
Associate Professor
Computer Science Dept.
Mt. Holyoke College



Reply via email to