zhys513 / jenabean

Automatically exported from code.google.com/p/jenabean
0 stars 0 forks source link

Cannot run any test from codebase which involves file model #19

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Check out source code
2. Build install via maven
3. Import in eclipse run text (ex Test1)

What is the expected output? What do you see instead?

Got Exception

javax.persistence.PersistenceException: 
com.hp.hpl.jena.assembler.exceptions.NotUniqueException: the object 
tws:filemodel has multiple values for the unique property 
http://jena.hpl.hp.com/2005/11/Assembler#directory
  doing:
    root: http://www.thewebsemantic.com/filemodel with type: http://jena.hpl.hp.com/2005/11/Assembler#FileModel assembler class: class com.hp.hpl.jena.assembler.assemblers.FileModelAssembler

    at thewebsemantic.jpa.JBProvider._createEntityManagerFactory(JBProvider.java:99)
    at thewebsemantic.jpa.JBProvider.createEntityManagerFactory(JBProvider.java:80)
    at thewebsemantic.jpa.JBProvider.createEntityManagerFactory(JBProvider.java:1)
    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:46)
    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:30)
    at com.maarif.cube.core.service.helloworld.JenaBeanTest.test(JenaBeanTest.java:25)
    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:45)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
    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:30)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: com.hp.hpl.jena.assembler.exceptions.NotUniqueException: the object 
tws:filemodel has multiple values for the unique property 
http://jena.hpl.hp.com/2005/11/Assembler#directory
  doing:
    root: http://www.thewebsemantic.com/filemodel with type: http://jena.hpl.hp.com/2005/11/Assembler#FileModel assembler class: class com.hp.hpl.jena.assembler.assemblers.FileModelAssembler

    at com.hp.hpl.jena.assembler.assemblers.AssemblerBase.getUnique(AssemblerBase.java:60)
    at com.hp.hpl.jena.assembler.assemblers.AssemblerBase.getUniqueResource(AssemblerBase.java:42)
    at com.hp.hpl.jena.assembler.assemblers.AssemblerBase.getRequiredResource(AssemblerBase.java:77)
    at com.hp.hpl.jena.assembler.assemblers.FileModelAssembler.getDirectoryName(FileModelAssembler.java:80)
    at com.hp.hpl.jena.assembler.assemblers.FileModelAssembler.getFileName(FileModelAssembler.java:52)
    at com.hp.hpl.jena.assembler.assemblers.FileModelAssembler.openEmptyModel(FileModelAssembler.java:25)
    at com.hp.hpl.jena.assembler.assemblers.ModelAssembler.openModel(ModelAssembler.java:24)
    at com.hp.hpl.jena.assembler.assemblers.ModelAssembler.open(ModelAssembler.java:31)
    at com.hp.hpl.jena.assembler.assemblers.AssemblerGroup$PlainAssemblerGroup.openBySpecificType(AssemblerGroup.java:118)
    at com.hp.hpl.jena.assembler.assemblers.AssemblerGroup$PlainAssemblerGroup.open(AssemblerGroup.java:105)
    at com.hp.hpl.jena.assembler.assemblers.AssemblerGroup$ExpandingAssemblerGroup.open(AssemblerGroup.java:69)
    at com.hp.hpl.jena.assembler.assemblers.AssemblerBase.open(AssemblerBase.java:37)
    at com.hp.hpl.jena.assembler.assemblers.AssemblerBase.open(AssemblerBase.java:34)
    at com.hp.hpl.jena.assembler.assemblers.AssemblerGroup.openModel(AssemblerGroup.java:23)
    at thewebsemantic.jpa.JBProvider._createEntityManagerFactory(JBProvider.java:94)
    ... 30 more

What version of the product are you using? On what operating system?
jena bean -> 1.0.7
jpa4jena -> 0.7

Windows XP, OSX

Please provide any additional information below.

Original issue reported on code.google.com by bedouinr...@gmail.com on 26 Mar 2013 at 2:55

GoogleCodeExporter commented 9 years ago
Got it working reason of failure was i had my project and jpa4jena in my 
workspace in eclipse with workspace resolution turned on and it was finding 
various files.

I progressedw ith this and tried to add db backed store for big big graphs 
using 

 tws:dbmodel rdf:type sdb:DatasetStore ;
     tws:package "com.maarif.cube.core.service.helloworld";
     sdb:layout         "layout2" ;
     sdb:connection     <#conn> ;
     .

<#conn> rdf:type sdb:SDBConnection ;
    sdb:sdbType      "hsqldb" ;
    sdb:sdbHost      "mem" ;
    sdb:sdbUser      "sa" ;
    sdb:sdbPassword  "" ;
    sdb:sdbName      "SDB2" ;
    sdb:driver       "org.hsqldb.jdbcDriver" ;
    .

but it fails with PersistenceException

javax.persistence.PersistenceException: 
com.hp.hpl.jena.assembler.exceptions.AssemblerException: caught: null
  doing:
    root: http://www.thewebsemantic.com/dbmodel with type: http://jena.hpl.hp.com/2007/sdb#DatasetStore assembler class: class com.hp.hpl.jena.sdb.assembler.DatasetStoreAssembler

    at thewebsemantic.jpa.JBProvider._createEntityManagerFactory(JBProvider.java:99)
    at thewebsemantic.jpa.JBProvider.createEntityManagerFactory(JBProvider.java:80)
    at thewebsemantic.jpa.JBProvider.createEntityManagerFactory(JBProvider.java:39)
    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:46)
    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:30)
    at com.maarif.cube.core.service.helloworld.JenaBeanTest.saveTest(JenaBeanTest.java:30)
    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:45)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
    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:30)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: com.hp.hpl.jena.assembler.exceptions.AssemblerException: caught: null
  doing:
    root: http://www.thewebsemantic.com/dbmodel with type: http://jena.hpl.hp.com/2007/sdb#DatasetStore assembler class: class com.hp.hpl.jena.sdb.assembler.DatasetStoreAssembler

    at com.hp.hpl.jena.assembler.assemblers.AssemblerGroup$PlainAssemblerGroup.openBySpecificType(AssemblerGroup.java:138)
    at com.hp.hpl.jena.assembler.assemblers.AssemblerGroup$PlainAssemblerGroup.open(AssemblerGroup.java:117)
    at com.hp.hpl.jena.assembler.assemblers.AssemblerGroup$ExpandingAssemblerGroup.open(AssemblerGroup.java:81)
    at com.hp.hpl.jena.assembler.assemblers.AssemblerBase.open(AssemblerBase.java:52)
    at com.hp.hpl.jena.assembler.assemblers.AssemblerBase.open(AssemblerBase.java:48)
    at com.hp.hpl.jena.assembler.assemblers.AssemblerGroup.openModel(AssemblerGroup.java:35)
    at thewebsemantic.jpa.JBProvider._createEntityManagerFactory(JBProvider.java:94)
    ... 30 more
Caused by: java.lang.NullPointerException
    at com.hp.hpl.jena.sparql.util.graph.GraphUtils.atmostOneProperty(GraphUtils.java:125)
    at com.hp.hpl.jena.sparql.util.graph.GraphUtils.getResourceValue(GraphUtils.java:159)
    at com.hp.hpl.jena.sdb.assembler.StoreDescAssembler.open(StoreDescAssembler.java:52)
    at com.hp.hpl.jena.sdb.assembler.DatasetStoreAssembler.openStore(DatasetStoreAssembler.java:49)
    at com.hp.hpl.jena.sdb.assembler.DatasetStoreAssembler.open(DatasetStoreAssembler.java:40)
    at com.hp.hpl.jena.sdb.assembler.DatasetStoreAssembler.open(DatasetStoreAssembler.java:33)
    at com.hp.hpl.jena.assembler.assemblers.AssemblerGroup$PlainAssemblerGroup.openBySpecificType(AssemblerGroup.java:130)
    ... 36 more

Original comment by bedouinr...@gmail.com on 27 Mar 2013 at 11:56

GoogleCodeExporter commented 9 years ago
tws:dbmodel rdf:type sdb:Model ;
     tws:package "com.maarif.cube.core.service.helloworld";
     sdb:store <#store>;
     sdb:dataset <#dataset>;
     .

<#dataset> rdf:type sdb:DatasetStore ;
    sdb:store <#store> .

<#store> rdf:type sdb:Store ;
     sdb:connection     <#conn> ;
     sdb:layout         "layout2" ;
     .

<#conn> rdf:type sdb:SDBConnection ;
    ##sdb:sdbType      "hsqldb" ;
    ##sdb:sdbHost      "file" ;
    ##sdb:sdbUser      "sa" ;
    ##sdb:sdbPassword  "" ;
    ##sdb:jdbcURL      "jdbc:hsqldb:mem;shutdown=true;sql.enforce_size=false";
    ##sdb:sdbName      "SDB2" ;
    ##sdb:driver       "org.hsqldb.jdbcDriver" ;
    sdb:sdbType        "derby" ;
    sdb:sdbName        "DB/SDB2" ;  # Directory name of the database
    sdb:driver         "org.apache.derby.jdbc.EmbeddedDriver" ;    
    .

its creating db connection now but fails with errors ;

WARN  2013-03-28 10:00:11,937 [Thread-2] 
com.hp.hpl.jena.sdb.sql.SDBConnection.exception(SDBConnection.java:338): 
prepareStatement: SQLException
Schema 'USER' does not exist
DELETE FROM Triples 
WHERE
s = ? AND
p = ? AND
o = ?

ERROR 2013-03-28 10:00:11,937 [Thread-2] 
com.hp.hpl.jena.sdb.layout2.LoaderTuplesNodes$Commiter.handleIssue(LoaderTuplesN
odes.java:373): Error in thread: Problem making new tupleloader
com.hp.hpl.jena.sdb.SDBException: Problem making new tupleloader
    at com.hp.hpl.jena.sdb.layout2.LoaderTuplesNodes.updateOneTuple(LoaderTuplesNodes.java:292)
    at com.hp.hpl.jena.sdb.layout2.LoaderTuplesNodes.access$200(LoaderTuplesNodes.java:43)
    at com.hp.hpl.jena.sdb.layout2.LoaderTuplesNodes$Commiter.run(LoaderTuplesNodes.java:362)
    at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.reflect.InvocationTargetException
    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 com.hp.hpl.jena.sdb.layout2.LoaderTuplesNodes.updateOneTuple(LoaderTuplesNodes.java:288)
    ... 3 more
Caused by: com.hp.hpl.jena.sdb.SDBException: Problem initialising loader for 
[Triples]
    at com.hp.hpl.jena.sdb.layout2.TupleLoaderBase.<init>(TupleLoaderBase.java:59)
    at com.hp.hpl.jena.sdb.layout2.hash.TupleLoaderHashBase.<init>(TupleLoaderHashBase.java:29)
    at com.hp.hpl.jena.sdb.layout2.hash.TupleLoaderHashDerby.<init>(TupleLoaderHashDerby.java:33)
    ... 8 more
Caused by: java.sql.SQLSyntaxErrorException: Schema 'USER' does not exist
    at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source)
    at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source)
    at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown Source)
    at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown Source)
    at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source)
    at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown Source)
    at org.apache.derby.impl.jdbc.EmbedPreparedStatement.<init>(Unknown Source)
    at org.apache.derby.impl.jdbc.EmbedPreparedStatement20.<init>(Unknown Source)
    at org.apache.derby.impl.jdbc.EmbedPreparedStatement30.<init>(Unknown Source)
    at org.apache.derby.impl.jdbc.EmbedPreparedStatement40.<init>(Unknown Source)
    at org.apache.derby.jdbc.Driver40.newEmbedPreparedStatement(Unknown Source)
    at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(Unknown Source)
    at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(Unknown Source)
    at com.hp.hpl.jena.sdb.sql.SDBConnection.prepareStatement(SDBConnection.java:228)
    at com.hp.hpl.jena.sdb.layout2.TupleLoaderBase.init(TupleLoaderBase.java:70)
    at com.hp.hpl.jena.sdb.layout2.TupleLoaderBase.<init>(TupleLoaderBase.java:57)
    ... 10 more
Caused by: java.sql.SQLException: Schema 'USER' does not exist
    at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)
    at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source)
    ... 26 more
Caused by: ERROR 42Y07: Schema 'USER' does not exist
    at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
    at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.getSchemaDescriptor(Unknown Source)
    at org.apache.derby.impl.sql.compile.QueryTreeNode.getSchemaDescriptor(Unknown Source)
    at org.apache.derby.impl.sql.compile.QueryTreeNode.getSchemaDescriptor(Unknown Source)
    at org.apache.derby.impl.sql.compile.FromBaseTable.bindTableDescriptor(Unknown Source)
    at org.apache.derby.impl.sql.compile.FromBaseTable.bindNonVTITables(Unknown Source)
    at org.apache.derby.impl.sql.compile.FromList.bindTables(Unknown Source)
    at org.apache.derby.impl.sql.compile.SelectNode.bindNonVTITables(Unknown Source)
    at org.apache.derby.impl.sql.compile.DMLStatementNode.bindTables(Unknown Source)
    at org.apache.derby.impl.sql.compile.DeleteNode.bindStatement(Unknown Source)
    at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
    at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
    at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)
    ... 20 more
DEBUG 2013-03-28 10:00:11,937 [main] 
com.hp.hpl.jena.shared.LockMRSW.leaveCriticalSection(LockMRSW.java:143): main 
>> leaveCS: Thread R/W: 0/1 :: Model R/W: 0/1 (thread: main)
DEBUG 2013-03-28 10:00:11,937 [main] 
com.hp.hpl.jena.shared.LockMRSW.leaveCriticalSection(LockMRSW.java:176): main 
<< leaveCS: Thread R/W: 0/0 :: Model R/W: 0/0 (thread: main)

Original comment by bedouinr...@gmail.com on 28 Mar 2013 at 9:59

GoogleCodeExporter commented 9 years ago
I m using StoreDesc delivered in jena-sdb 1.3.6 and I have the same problem 
when I want to use the SDBConnection.

Original comment by alexandr...@gmail.com on 28 Jun 2013 at 2:18