Welcome Guest  |  Register  |  Login
Login Name Password
  Search  
  Index  | Recent Threads  | Unanswered Threads  | Who's Online  | Help


Quick Go »

No member browsing this thread
Thread Status: Active
Total posts in this thread: 11
Posts: 11   Pages: 2   [ 1 2 | Next Page ]
[ Jump to Last Post ]
Post new Thread
Author
Previous Thread This topic has been viewed 6866 times and has 10 replies Next Thread
Male costafina
Newbie



Romania
Joined: Jul 19, 2008
Post Count: 9
Status: Offline
Reply to this Post  Reply with Quote 
'Error creating PMF' when running 'createschema' for JDO tutorial

Hello,
I am relatively new to JDO and would like to use DataNucleus for a future project.
I have installed Access Platform 1.0 M3 and wanted to try out the examples from datanucleus-samples-jdo-tutorial-1.0.0.m1-src.zip.
I used ANT to build the targets. 'compile' and 'enhance' run without problems but when I want to run 'createschema' I get an error

00:17:57,244 (main) ERROR [DataNucleus.SchemaTool] - Error creating PMF
javax.jdo.JDOFatalInternalException: Error creating transactional connection factory
at org.datanucleus.jdo.NucleusJDOHelper.getJDOExceptionForNucleusException(NucleusJDOHelper.java:407)
...
Caused by: java.lang.NoClassDefFoundError: javax/resource/ResourceException
at java.lang.Class.getDeclaredConstructors0(Native Method)
...
Caused by: java.lang.ClassNotFoundException: javax.resource.ResourceException
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)

I have been looking for hours on the internet on how to make this missig class available but could not find anything useful.

My datanucleus.properties file contains

javax.jdo.PersistenceManagerFactoryClass=org.datanucleus.jdo.JDOPersistenceManagerFactory
javax.jdo.option.ConnectionDriverName=org.firebirdsql.jdbc.FBDriver
javax.jdo.option.ConnectionURL=jdbc:firebirdsql://localhost/test.fdb
javax.jdo.option.ConnectionUserName=admin
javax.jdo.option.ConnectionPassword= xxx
datanucleus.autoCreateSchema=true
datanucleus.validateTables=false
datanucleus.validateConstraints=false

Thank you very much in advance for your help

Horst
[Jul 19, 2008 10:45:16 PM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest [Link] Report threatening or abusive post: please login first  Go to top 
Male andy
Expert
Member's Avatar

UK
Joined: Mar 13, 2004
Post Count: 5686
Status: Offline
Reply to this Post  Reply with Quote 
Re: 'Error creating PMF' when running 'createschema' for JDO tutorial

Caused by: java.lang.NoClassDefFoundError: javax/resource/ResourceException

So how exactly are you using SchemaTool and getting that error when that is only referenced in the JCA RAR ? JCA RAR is only for use in J2EE environments (by definition), and in that env the javax.resource "connector-api" jar will be present - and you can't be using "samples-jdo-tutorial" in that environment since it isn't set up to run there
----------------------------------------
-Andy smile

[Jul 20, 2008 8:28:42 AM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Male costafina
Newbie



Romania
Joined: Jul 19, 2008
Post Count: 9
Status: Offline
Reply to this Post  Reply with Quote 
Re: 'Error creating PMF' when running 'createschema' for JDO tutorial

Thank you very much, Andy, for your quick reaction. Your question

So how exactly are you using SchemaTool and getting that error when that is only referenced in the JCA RAR ?


brought me to the conclusion, that the problem must be outside the code I dowloaded from DataNucleus. So I had a closer look at the Firebird Jaybird driver I used. It turned out that I had to use the jaybird-full.jar, which contains a mini J2EE and solves the problem.
see http://www.firebirdsql.org/index.php?op=devel&sub=jdbc&id=faq#3
This brought me a big step forward - to the next problem.

Now I get the following errors
14:14:20,043 (main) ERROR [DataNucleus.Datastore] - Error thrown executing CREATE TABLE DELETEME1216552459963
(
UNUSED INTEGER NOT NULL
) : GDS Exception. 335544569. Dynamic SQL Error
SQL error code = -901
feature is not supported
org.firebirdsql.jdbc.FBSQLException: GDS Exception. 335544569. Dynamic SQL Error

Later in the log file there is the warning
14:14:20,043 (main) WARN [DataNucleus.Datastore.Schema] - Error obtaining connection to database. : {1} Please check that your database JDBC driver is accessible, and the database URL and username/password are correct. org.firebirdsql.jdbc.FBSQLException: GDS Exception. 335544569. Dynamic SQL Error
SQL error code = -901
feature is not supported

and
14:14:20,674 (main) DEBUG [DataNucleus.Datastore.Schema] - Loading column info for table(s) "JDO_BOOKS, JDO_PRODUCTS" in Catalog "", Schema ""

14:14:20,684 (main) DEBUG [DataNucleus.Datastore.Schema] - An error occurred while auto-creating schema elements - rolling back

14:14:20,694 (main) ERROR [DataNucleus.SchemaTool] - An exception was thrown during the operation of SchemaTool. Please refer to the log for full details.
org.datanucleus.exceptions.NucleusDataStoreException: Exception thrown obtaining schema column information from datastore
at org.datanucleus.store.rdbms.schema.RDBMSSchemaHandler.refreshTableData(RDBMSSchemaHandler.java:958)

Now, since I've read that there is a problem with auto-table creation with Firebird, I have tried to set corresponding parameters in my datanucleus.properties file to 'false'. The file now looks like this
javax.jdo.PersistenceManagerFactoryClass=org.datanucleus.jdo.JDOPersistenceManagerFactory
javax.jdo.option.ConnectionDriverName=org.firebirdsql.jdbc.FBDriver
javax.jdo.option.ConnectionURL=jdbc:firebirdsql://localhost/:C:\\Database\\prototype\\test.fdb
javax.jdo.option.ConnectionUserName=SYSDBA
javax.jdo.option.ConnectionPassword=masterkey
datanucleus.autoCreateSchema=false
datanucleus.autoCreateTables=false
datanucleus.validateTables=false
datanucleus.validateConstraints=false

However in the log file these parameters still appear as 'true'.
>> datanucleus.autoCreateColumns=false
>> datanucleus.autoCreateConstraints=true
>> datanucleus.autoCreateSchema=true
>> datanucleus.autoCreateTables=true
>> datanucleus.autoCreateWarnOnError=false
>> datanucleus.autoStartMechanism=None
>> datanucleus.autoStartMechanismMode=Quiet
>> datanucleus.autoStartMechanismXmlFile=datanucleusAutoStart.xml

Why do my settings not take effect? Apart from that, are these parameters the cause of the problem?

Thanks in advance for help.

Horst
[Jul 20, 2008 1:16:10 PM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest [Link] Report threatening or abusive post: please login first  Go to top 
Male andy
Expert
Member's Avatar

UK
Joined: Mar 13, 2004
Post Count: 5686
Status: Offline
Reply to this Post  Reply with Quote 
Re: 'Error creating PMF' when running 'createschema' for JDO tutorial

Error thrown executing CREATE TABLE DELETEME1216552459963
(
UNUSED INTEGER NOT NULL
) : GDS Exception. 335544569. Dynamic SQL Error
SQL error code = -901
feature is not supported
org.firebirdsql.jdbc.FBSQLException: GDS Exception. 335544569. Dynamic SQL Error

Just gotta have lots of admiration for a database that spits out such crap. I tried Firebird a long time ago and the poor documentation wasn't adequate to get it running. I even tried today with FirebirdCS-2.1.1.17910-0 and Jaybird 2.1.6 and get
"GDS Exception. 335544344. I/O error for file open "/home/andy/firebird1.fdb"
Error while trying to open file
null"

(even though the database was created just 2 mins earlier, and can be CONNECTed to in isql). And you then search on Google and get pages of people with the same message. And you click on the link on their site for JayBird Wiki and ... its broken.
I suggest that you get your hands on the DataNucleus code and debug your Firebird problems. Either that or convince the people behind it to provide something half usable.
Why do my settings not take effect? Apart from that, are these parameters the cause of the problem?

You're running SchemaTool to create your schema and you want to turn OFF the creation? Yes it will ignore such settings in that situation clearly.
----------------------------------------
-Andy smile

[Jul 20, 2008 7:51:47 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Male costafina
Newbie



Romania
Joined: Jul 19, 2008
Post Count: 9
Status: Offline
Reply to this Post  Reply with Quote 
Re: 'Error creating PMF' when running 'createschema' for JDO tutorial

I have not used Firebird for a while, but now, as I was looking for clues concerning this -901 code, I was reminded of the fact that there exist different dialects, which may have an impact on the success of SQL statements.
InterBase and Firebird have 3 distinct dialects (1,2,3), which can be set at runtime.

In particular, dialects control how InterBase/Firebird interprets:

* double quotes
* the DATE datatype
* decimal and numeric datatypes
* new reserved keywords

Now I suspect, that this problem may have something to do with speaking the right dialect.
The database I want to access was created with dialect 3, but I don't know which dialect convention DataNucleus uses for its SQL statements.
I have now tried to pass the dialect parameter to the server as a name/value pair appended to the URL, which I found in a coding example.
javax.jdo.option.ConnectionURL = jdbc:firebirdsql://localhost/:C:\\Database\\prototype\\test.fdb?sql_dialect=1
Unfortunately I keep getting the same error, no matter if I code 1, 2 or 3 for dialect.
However it is ot sure whether this parameter is actually handed over to the server, the way I expected it.
[Jul 21, 2008 1:09:55 AM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest [Link] Report threatening or abusive post: please login first  Go to top 
Male andy
Expert
Member's Avatar

UK
Joined: Mar 13, 2004
Post Count: 5686
Status: Offline
Reply to this Post  Reply with Quote 
Re: 'Error creating PMF' when running 'createschema' for JDO tutorial

I actually managed to get Firebird to run (by changing file permissions user groups on the Firebird installation etc etc) on the JDO tutorial using the following properties
javax.jdo.option.ConnectionDriverName=org.firebirdsql.jdbc.FBDriver
javax.jdo.option.ConnectionURL=jdbc:firebirdsql:localhost:/home/andy/firebird1.fdb
javax.jdo.option.ConnectionUserName=SYSDBA
javax.jdo.option.ConnectionPassword=firebird

Some parts of the log
INFO [DataNucleus.Persistence]DataNucleus Persistence Factory - Vendor: "DataNucleus" Version: "1.0-SNAPSHOT"
INFO [DataNucleus.Persistence] - DataNucleus Persistence Factory initialised for datastore URL="jdbc:firebirdsql:localhost:/home/andy/
firebird1.fdb" driver="org.firebirdsql.jdbc.FBDriver" userName="SYSDBA"
...
DEBUG [DataNucleus.Datastore] - StoreManager : "rdbms" (org.datanucleus.store.rdbms.RDBMSManager)
DEBUG [DataNucleus.Datastore] - AutoStart : mechanism=None, mode=Quiet
DEBUG [DataNucleus.Datastore] - Connection Pooling : null
DEBUG [DataNucleus.Datastore] - Datastore Identifiers : factory="jpox" case=UPPERCASE
DEBUG [DataNucleus.Datastore] - Datastore : read-write, checkTableViewExistence, rdbmsConstraintCreateMode=DataNucleus, initialiseColumnInfo=ALL
DEBUG [DataNucleus.Datastore] - Schema Control : AutoCreate(Tables,Columns,Constraints), Validate(Tables,Columns,Constraints)
DEBUG [DataNucleus.Datastore] - Statement Batching : max-batch-size=50
DEBUG [DataNucleus.Datastore] - Query Languages : [javax.jdo.query.SQL, javax.jdo.query.JPQL, javax.jdo.query.NucleusSQL, JPQL, SQL, JDOQL, javax.jdo.query.JDOQL]
DEBUG [DataNucleus.Datastore] - Queries : Timeout=0
DEBUG [DataNucleus.Datastore] - Queries : Results direction=forward, type=forward-only, concurrency=read-only
DEBUG [DataNucleus.Datastore] - Java-Types : string-default-length=255
DEBUG [DataNucleus.Datastore] - JDBC-Types : DATE, DECIMAL, LONGVARCHAR, BIGINT, TIME, NUMERIC, OTHER, CHAR, FLOAT, SMALLINT, BLOB, LON
GVARBINARY, INTEGER, DOUBLE, VARCHAR, TIMESTAMP
DEBUG [DataNucleus.Datastore] - Datastore Adapter : org.datanucleus.store.rdbms.adapter.FirebirdAdapter
DEBUG [DataNucleus.Datastore] - Datastore Details : name="Firebird 2.1BLI-V2.1.1.17910 Firebird 2.1/tcp (rookie.persistability.co.uk)/P
10" version="LI-V2.1.1.17910 Firebird 2.1BLI-V2.1.1.17910 Firebird 2.1/tcp (rookie.persistability.co.uk)/P10" (major=2, minor=1, revision=1)
DEBUG [DataNucleus.Datastore] - Datastore Driver : name="Jaybird JCA/JDBC driver" version="2.1" (major=2, minor=1)
DEBUG [DataNucleus.Datastore] - Supported Identifier Cases : UPPERCASE "MixedCase-Sensitive"
DEBUG [DataNucleus.Datastore] - Supported Identifier Lengths (max) : Table=31 Column=31 Constraint=31 Index=31 Delimiter="
DEBUG [DataNucleus.Datastore] - Support for Identifiers in DDL : catalog=false schema=false
DEBUG [DataNucleus.Datastore] - Support Statement Batching : yes
...
DEBUG [DataNucleus.Datastore.Schema] - CREATE TABLE JDO_PRODUCTS
(
JDO_PRODUCTS_ID BIGINT NOT NULL,
DESCRIPTION VARCHAR(255),
PRODUCT_NAME VARCHAR(100),
PRICE DOUBLE PRECISION NOT NULL
)
DEBUG [DataNucleus.Datastore.Schema] - Execution Time = 3 ms
DEBUG [DataNucleus.Datastore.Schema] - ALTER TABLE JDO_PRODUCTS ADD CONSTRAINT JDO_PRODUCTS_PK PRIMARY KEY (JDO_PRODUCTS_ID)
DEBUG [DataNucleus.Datastore.Schema] - Execution Time = 4 ms
DEBUG [DataNucleus.Datastore.Schema] - Loading column info for table(s) "JDO_PRODUCTS, JDO_BOOKS" in Catalog "", Schema ""
DEBUG [DataNucleus.Datastore.Schema] - Column info loaded for Catalog "", Schema "", 1 tables, time = 29 ms
INFO [DataNucleus.Datastore.Schema] - No column info found for table "JDO_BOOKS" - the table apparently doesnt yet exist in the datastore
INFO [DataNucleus.Datastore.Schema] - Creating table JDO_BOOKS
DEBUG [DataNucleus.Datastore.Schema] - CREATE TABLE JDO_BOOKS
(
JDO_BOOKS_ID BIGINT NOT NULL,
AUTHOR VARCHAR(40),
ISBN CHAR(20),
PUBLISHER VARCHAR(40)
)
DEBUG [DataNucleus.Datastore.Schema] - Execution Time = 2 ms
DEBUG [DataNucleus.Datastore.Schema] - ALTER TABLE JDO_BOOKS ADD CONSTRAINT JDO_BOOKS_PK PRIMARY KEY (JDO_BOOKS_ID)
DEBUG [DataNucleus.Datastore.Schema] - Execution Time = 1 ms
INFO [DataNucleus.Datastore.Schema] - Creating foreign key constraint : "JDO_BOOKS_FK1" in catalog "" schema ""
DEBUG [DataNucleus.Datastore.Schema] - ALTER TABLE JDO_BOOKS ADD CONSTRAINT JDO_BOOKS_FK1 FOREIGN KEY (JDO_BOOKS_ID) REFERENCES JDO_PRODUCTS (JDO_PRODUCTS_ID)
DEBUG [DataNucleus.Datastore.Schema] - Execution Time = 3 ms

Re: dialects - that is why the JDBC driver is supposed to return what types are supported, what is the quote string etc and the application can use what is the right one for what the database expects, so should not be an issue if their JDBC driver does what the spec tells it to do.

Why it should have been necessary to have to manually update file permissions that they installed things as is a different issue. The thing about software is that you should make it work out of the box without people having to hunt for non-existent help docs. At the end of the day there are ample open source RDBMS around, just as capable e.g PostgreSQL.
----------------------------------------
-Andy smile

[Jul 21, 2008 10:02:24 AM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Male costafina
Newbie



Romania
Joined: Jul 19, 2008
Post Count: 9
Status: Offline
Reply to this Post  Reply with Quote 
Re: 'Error creating PMF' when running 'createschema' for JDO tutorial

Thank you very much Andy, for your explanations and the excerpt from your log file. I have had a close look at it, but still could not get a clue as to what my problem is.

The fact, that you were able to run the tutorial with Firebird makes me optimistic that I too, will get it to work.

Would you mind zipping your complete log file and sending it to my mail address?

There are some more DEBUG and INFO messages in my log, that need clarification. Being able to compare your log with mine would probably spare me from asking you silly questions.

Thanks a lot in advance.

Horst
[Jul 21, 2008 4:52:06 PM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest [Link] Report threatening or abusive post: please login first  Go to top 
Male costafina
Newbie



Romania
Joined: Jul 19, 2008
Post Count: 9
Status: Offline
Reply to this Post  Reply with Quote 
Re: 'Error creating PMF' when running 'createschema' for JDO tutorial

Thanks a lot for the log file, Andy. I compared it with mine and found that you had some jars in your classpath which I didn't have (DBCP), but inserting them did not bring about any change.
So in order to save me from further frustration I decided to have a try with a MySQL database. But that, too, brought a strange effect. It turned out that I had specified the database the Firebird way, with a full path, instead of the mere database name. When I changed this it worked.
Then I had a closer look at my Firebird connection string, and actually there was a tiny error in the syntax. I had coded a ':' after the '/' left of he drive name. When I removed this, everything worked fine - almost.
In the MySQL database there are the JDO_BOOKS and JDO_PRODUCTS tables as expected, whereas in the Firebird database I see the DELETEME table but the other two aren't there.
The log file, however clearly says that DELETEME was dropped and the other two tables were created. I am rather puzzled with this result.
I've now deleted the DELETEME table by hand, and given it a second try. This time the DELETEME table isn't there, but the others aren't either. In the log file execution time for CREATE/DROP DELETEME table is give as 20ms/10ms, while for the other two tables it says 0 ms. Something is still not working the way it should. Some sort of disobedience on the database side.
If you have an idea, please let me know.

Horst

Maybe I should mention, that I'm using Firebird not because I'm particularly fond of it, but because I will have to deal with a legacy Firebird database.
[Jul 22, 2008 12:25:56 AM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest [Link] Report threatening or abusive post: please login first  Go to top 
Male costafina
Newbie



Romania
Joined: Jul 19, 2008
Post Count: 9
Status: Offline
Reply to this Post  Reply with Quote 
Re: 'Error creating PMF' when running 'createschema' for JDO tutorial

I have tried different things from the tutorial with the Firebird database and with the MySQL database as well, but I almost never get the results I expect.

The following happened with MySQL

When I execute 'ant deleteschema' the log shows that the 'delete' command is being executed
16:36:25,579 (main) INFO [DataNucleus.SchemaTool] - >> datanucleus.schemaTool.mode=delete

but 2 seconds later the log shows
16:36:27,302 (main) DEBUG [DataNucleus.Datastore.Schema] - Loading column info for table(s) "JDO_BOOKS, JDO_PRODUCTS" in Catalog "", Schema ""
16:36:27,382 (main) DEBUG [DataNucleus.Datastore.Schema] - Column info loaded for Catalog "", Schema "", 0 tables, time = 80 ms
16:36:27,382 (main) INFO [DataNucleus.Datastore.Schema] - No column info found for table "JDO_BOOKS" - the table apparently doesnt yet exist in the datastore
16:36:27,382 (main) INFO [DataNucleus.Datastore.Schema] - Creating table `JDO_BOOKS`
16:36:27,382 (main) DEBUG [DataNucleus.Datastore.Schema] - CREATE TABLE `JDO_BOOKS`
(
`JDO_BOOKS_ID` BIGINT NOT NULL,
`AUTHOR` VARCHAR(40) BINARY NULL,
`ISBN` CHAR(20) BINARY NULL,
`PUBLISHER` VARCHAR(40) BINARY NULL,
PRIMARY KEY (`JDO_BOOKS_ID`)
) ENGINE=INNODB
16:36:27,382 (main) ERROR [DataNucleus.Datastore] - Error thrown executing CREATE TABLE `JDO_BOOKS`
(
`JDO_BOOKS_ID` BIGINT NOT NULL,
`AUTHOR` VARCHAR(40) BINARY NULL,
`ISBN` CHAR(20) BINARY NULL,
`PUBLISHER` VARCHAR(40) BINARY NULL,
PRIMARY KEY (`JDO_BOOKS_ID`)
) ENGINE=INNODB : Table 'jdo_books' already exists
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'jdo_books' already exists

How can the program want to create the table which it's supposed to drop? Are there contradicting parameters somewhere?

When I delete all tables (by hand), and run 'ant runtutorial' the tables get created and the DML gets executed. But when I rerun it, I get an error, that the tables already exist. What can make the program want to create tables that already exist?

The following is about Firebird.

You mentioned that I would have to create the SEQUENCE_TABLE manually because it's not created by the schematool. I forgot to create it but found it had been created automatically.
But when I look at the log I see, it's being referenced when it does not yet exist and is created afterwards, however followed by an error in the ALTER TABLE statement
19:05:00,618 (main) ERROR [DataNucleus.Datastore] - Error thrown executing ALTER TABLE SEQUENCE_TABLE ADD CONSTRAINT SEQUENCE_TABLE_PK PRIMARY KEY (SEQUENCE_NAME) : GDS Exception. 335544351. unsuccessful metadata update
key size too big for index SEQUENCE_TABLE_PK
org.firebirdsql.jdbc.FBSQLException: GDS Exception. 335544351. unsuccessful metadata update
key size too big for index SEQUENCE_TABLE_PK

When I create the SEQUENCE_TABLE manually, I get an error that the table already exists.
The JDO_BOOKS table so far never got created in the Firebird DB.

It appears as if the sequence of actions were somehow out of order.
[Jul 22, 2008 5:24:28 PM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest [Link] Report threatening or abusive post: please login first  Go to top 
Male andy
Expert
Member's Avatar

UK
Joined: Mar 13, 2004
Post Count: 5686
Status: Offline
Reply to this Post  Reply with Quote 
Re: 'Error creating PMF' when running 'createschema' for JDO tutorial

Table 'jdo_books' already exists

So you didn't read the docs for MySQL oddities on Windows
http://www.datanucleus.org/products/accessplatform/rdbms/support.html
a PMF property to set. It expects uppercase, but Mysql gives lowercase
It appears as if the sequence of actions were somehow out of order.

Read that same link, near the end in the Firebird section. It does DDL at the end of a txn ; go figure
----------------------------------------
-Andy smile

[Jul 22, 2008 8:19:24 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Posts: 11   Pages: 2   [ 1 2 | Next Page ]
[ Jump to Last Post ]
Show Printable Version of Thread  Post new Thread