RE: Trying to get OJB up and running (newbie)

2003-03-11 Thread Peter Kirk
I've got it running now, thanks.
The problem was that the database name in the db.open call should be set to
the jcd-alias from the repository xml - it should not be set to the
databaseName value returned from 
  
databaseName = ( (PersistenceBrokerConfiguration)
PersistenceBrokerFactory.getConfigurator()
.getConfigurationFor( null ) ).getRepositoryFilename();

don't know why I tried that

Thanks,
Peter


Trying to get OJB up and running (newbie)

2003-03-10 Thread Peter Kirk
Hi there

I am trying to learn how to use OJB.

At the moment I am not getting very far. Either I have not installed
something correctly, or I have not configured something correctly.

When I call the db.open method I get a mass of exceptions. Perhaps someone
can see where I can start looking for the problem...

Here is a snippet of my code:

Implementation odmg = OJB.getInstance();
Database db = odmg.newDatabase();

try
{
  db.open( databaseName, Database.OPEN_READ_WRITE );
}

And here is the first part of some output I see (which comes from inside the
open method):

[org.apache.ojb.broker.metadata.ConnectionRepository] INFO: Could not found
org.apache.ojb.broker.metadata.JdbcConnectionDescriptor for PBKey
org.apache.ojb.broker.PBKey:
repository=C:/Work/Experimentation/OJB/repository.xml, user=null,
password=null
[org.apache.ojb.broker.accesslayer.ConnectionManagerFactory] ERROR:
ConfigurableFactory instantiation failed for class class
org.apache.ojb.broker.accesslayer.ConnectionManagerImpl
* Factory types: 
1 - Type: org.apache.ojb.broker.PersistenceBroker
* Factory arguments: 
1 - Argument: [EMAIL PROTECTED]
null
java.lang.reflect.InvocationTargetException: java.lang.NullPointerException
at
org.apache.ojb.broker.platforms.PlatformFactory.getPlatformFor(Unknown
Source)
at
org.apache.ojb.broker.accesslayer.ConnectionManagerImpl.init(Unknown
Source)
at java.lang.reflect.Constructor.newInstance(Native Method)
at org.apache.ojb.broker.util.ClassHelper.newInstance(Unknown
Source)
at
org.apache.ojb.broker.util.factory.ConfigurableFactory.createNewInstance(Unk
nown Source)
at
org.apache.ojb.broker.util.factory.ConfigurableFactory.createNewInstance(Unk
nown Source)
at
org.apache.ojb.broker.accesslayer.ConnectionManagerFactory.createConnectionM
anager(Unknown Source)
at
org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.init(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Native Method)
at org.apache.ojb.broker.util.ClassHelper.newInstance(Unknown
Source)
at
org.apache.ojb.broker.ta.PersistenceBrokerFactoryDefaultImpl.createNewBroker
Instance(Unknown Source)
at
org.apache.ojb.broker.ta.PersistenceBrokerFactoryDefaultImpl$PBKeyedPoolable
ObjectFactory.makeObject(Unknown Source)
at
org.apache.commons.pool.impl.GenericKeyedObjectPool.borrowObject(GenericKeye
dObjectPool.java:748)
at
org.apache.ojb.broker.ta.PersistenceBrokerFactoryDefaultImpl.createPersisten
ceBroker(Unknown Source)
at
org.apache.ojb.broker.PersistenceBrokerFactory.createPersistenceBroker(Unkno
wn Source)
at org.apache.ojb.odmg.DatabaseImpl.open(Unknown Source)
at dk.pk.ojb.Test.main(Test.java:103)

Thanks for any help,
Peter


RE: Trying to get OJB up and running (newbie)

2003-03-10 Thread oliver . matz
Hello Peter,

 -Original Message-
 From: Peter Kirk [mailto:[EMAIL PROTECTED]

 When I call the db.open method I get a mass of exceptions. 
 Perhaps someone
 can see where I can start looking for the problem...

this might be a known problem.  (See thread: Help : OJB, ODMG API !)

Get the newest tutorial2 Application.java from

http://cvs.apache.org/viewcvs.cgi/db-ojb/src/test/org/apache/ojb/tutorial2/

 Here is a snippet of my code:
 
 Implementation odmg = OJB.getInstance();
 Database db = odmg.newDatabase();
 
 try
 {
   db.open( databaseName, Database.OPEN_READ_WRITE );
 }
 
 And here is the first part of some output I see (which comes 
 from inside the
 open method):
 
 [org.apache.ojb.broker.metadata.ConnectionRepository] INFO: 
 Could not found
 org.apache.ojb.broker.metadata.JdbcConnectionDescriptor for PBKey
 org.apache.ojb.broker.PBKey:
 repository=C:/Work/Experimentation/OJB/repository.xml, user=null,

You have edited that value, haven't you?  It's meaning is 
not the repository file any more, but a reference to an alias
inside it.

Olli

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Trying to get OJB up and running (newbie)

2003-03-10 Thread Peter Kirk


 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 Sent: 10. marts 2003 14:37
 To: [EMAIL PROTECTED]
 Subject: RE: Trying to get OJB up and running (newbie)
 
  And here is the first part of some output I see (which comes 
  from inside the
  open method):
  
  [org.apache.ojb.broker.metadata.ConnectionRepository] INFO: 
  Could not found
  org.apache.ojb.broker.metadata.JdbcConnectionDescriptor for PBKey
  org.apache.ojb.broker.PBKey:
  repository=C:/Work/Experimentation/OJB/repository.xml, user=null,
 
 You have edited that value, haven't you?  It's meaning is 
 not the repository file any more, but a reference to an alias
 inside it.

Yes, I couldn't get the tutorial2 to work at all. So I have been trying to
set up my own simple (really simple) application.

It seems that the tutorial stuff has extra things defined in the xml files
(junit tests and such?). Anyway it seemed a little confusing to me. I just
wanted a dead simple first try - a hypersonic database with a single table,
a single dataclass with a single text string as data...

Also, I couldn't run the build batch file succesfully - here I get errors
(and a huge exception/stack trace).

Peter


RE: Trying to get OJB up and running (newbie)

2003-03-10 Thread oliver . matz
Hello Peter,

 -Original Message-
 From: Peter Kirk [mailto:[EMAIL PROTECTED]

 It seems that the tutorial stuff has extra things defined in 
 the xml files
 (junit tests and such?). Anyway it seemed a little confusing 
 to me. I just
 wanted a dead simple first try - a hypersonic database with a 
 single table,
 a single dataclass with a single text string as data...

I definetly agree that the out-of-the-box experience of
OJB is a weak point.  I suffered, too, when I tried 
to get a simple isolated example to start with.

There are some threads in this list about that topic.

 Also, I couldn't run the build batch file succesfully - 
 here I get errors
 (and a huge exception/stack trace).

Which errors?

Olli

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Trying to get OJB up and running (newbie)

2003-03-10 Thread Peter Kirk


 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 Sent: 10. marts 2003 16:23
 To: [EMAIL PROTECTED]
 Subject: RE: Trying to get OJB up and running (newbie)
 
 
 Hello Peter,
 
  -Original Message-
  From: Peter Kirk [mailto:[EMAIL PROTECTED]
 
  Also, I couldn't run the build batch file succesfully - 
  here I get errors
  (and a huge exception/stack trace).
 
 Which errors?

Hi,
below is some of the output I see in my windows dos prompt (I've snipped a
bit away because it's quite long):

Buildfile: build.xml
set-archive-name:
set-archive-name-date:
detect-jdk:
check-jdk12proxy-classes:
check-jndi-classes:
use-jdk12:
use-jdk13:
 [echo] detected JDK 1.3
use-jdk14:
init:
prepare:
check-j2ee-classes:
preprocess:
 [echo] using switches: +JDK13, -JDBC30
 [java] ..

snip

project-create-db-classpath:
 [echo] 
 [echo]   driver=org.hsqldb.jdbcDriver
 [echo]   url=jdbc:hsqldb:target/test/OJB
 [echo]   userid=sa
 [echo]   password=
 [echo] 
[torque-create-db] Using classpath
[torque-create-db] Generating to file C:\FILE
DOWNLOADS\Java\OJB\rc1\db-ojb-1.0.rc1-src\db-ojb-1.0.rc1-src\db-ojb-1.0.rc1\
target\src\sql\create-db.sql
[torque-create-db] Resolver: used database.dtd from
org.apache.torque.engine.database.transform package 
[torque-create-db] Resolver: used database.dtd from
org.apache.torque.engine.database.transform package 
  [sql] Executing file: C:\FILE
DOWNLOADS\Java\OJB\rc1\db-ojb-1.0.rc1-src\db-ojb-1.0.rc1-src\db-ojb-1.0.rc1\
target\src\sql\create-db.sql
  [sql] 0 of 1 SQL statements executed successfully

snip

project-insert-sql:
[torque-insert-sql] Our new url - jdbc:hsqldb:target/test/OJB
[torque-insert-sql] Executing file: C:\FILE
DOWNLOADS\Java\OJB\rc1\db-ojb-1.0.rc1-src\db-ojb-1.0.rc1-src\db-ojb-1.0.rc1\
target\src\sql\ojbtest-schema.sql
[torque-insert-sql] Executing file: C:\FILE
DOWNLOADS\Java\OJB\rc1\db-ojb-1.0.rc1-src\db-ojb-1.0.rc1-src\db-ojb-1.0.rc1\
target\src\sql\ojbcore-schema.sql
[torque-insert-sql] Executing file: C:\FILE
DOWNLOADS\Java\OJB\rc1\db-ojb-1.0.rc1-src\db-ojb-1.0.rc1-src\db-ojb-1.0.rc1\
target\src\sql\ojbtest-data.sql
[torque-insert-sql] 231 of 231 SQL statements executed successfully

junit-no-compile-no-prepare:
[junit] Running org.apache.ojb.broker.AllTests
[junit] Tests run: 187, Failures: 2, Errors: 182, Time elapsed: 16,624
sec
[junit] Running org.apache.ojb.odmg.AllTests
[junit] [BOOT] INFO: OJB.properties: file:/C:/FILE
DOWNLOADS/Java/OJB/rc1/db-ojb-1.0.rc1-src/db-ojb-1.0.rc1-src/db-ojb-1.0.rc1/
target/test/ojb/OJB.properties
[junit] [BOOT] ERROR: Error in instantiation of PersistenceBrokerFactory
class
[junit] Could not read repository class descriptor data, using
repository: repository.xml: no protocol: repository.dtd
[junit] java.net.MalformedURLException: no protocol: repository.dtd
[junit] at java.net.URL.init(URL.java:473)
[junit] at java.net.URL.init(URL.java:376)
[junit] at java.net.URL.init(URL.java:330)
[junit] at
org.apache.xerces.impl.XMLEntityManager.startEntity(Unknown Source)
[junit] at
org.apache.xerces.impl.XMLEntityManager.startDTDEntity(Unknown Source)
[junit] at
org.apache.xerces.impl.XMLDTDScannerImpl.setInputSource(Unknown Source)
[junit] at
org.apache.xerces.impl.XMLDocumentScannerImpl$DTDDispatcher.dispatch(Unknown
Source)
[junit] at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)
[junit] at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown
Source)
[junit] at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown
Source)
[junit] at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
[junit] at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown
Source)
[junit] at
org.apache.ojb.broker.metadata.RepositoryPersistor.buildRepository(Repositor
yPersistor.java:288)
[junit] at
org.apache.ojb.broker.metadata.RepositoryPersistor.readDescriptorRepository(
RepositoryPersistor.java:199)
[junit] at
org.apache.ojb.broker.metadata.MetadataManager.init(MetadataManager.java:88)
[junit] at
org.apache.ojb.broker.metadata.MetadataManager.init(MetadataManager.java:7
9)
[junit] at
org.apache.ojb.broker.metadata.MetadataManager.getInstance(MetadataManager.j
ava:113)
[junit] at
org.apache.ojb.broker.ta.PersistenceBrokerFactoryDefaultImpl.buildDefaultKey
(PersistenceBrokerFactoryDefaultImpl.java:145)
[junit] at
org.apache.ojb.broker.ta.PersistenceBrokerFactoryDefaultImpl.init(Persiste
nceBrokerFactoryDefaultImpl.java:116)
[junit] at java.lang.Class.newInstance0(Native Method)
[junit] at java.lang.Class.newInstance(Class.java:237)
[junit] at
org.apache.ojb.broker.ta.PersistenceBrokerFactoryFactory.instantiate(Persist
enceBrokerFactoryFactory.java:99)
[junit