Thanks too for all the wonderful work done by all who've contributed to the jakarta-OJB project. This is a very valuable tool and from my limited beginner's knowledge of Java O/R technologies, jakarta-OJB seems to implement *A LOT* of the available options.
Regarding your last comment, I have already followed the instructions on the platforms.html page to setup my Postgres database. That worked fine for Tutorial1, but wasn't enough when I went to run Tutorial2. That's why I asked about the variable substitution in the repository_database.xml. For whatever reason, it doesn't seem to get done, so I had to make the hard-coded alterations.
Is there some other configuration issue I may have screwed up that would keep those substitutions from happening?
Thanks again for all your help.
Cheers, Bill
On Monday, February 24, 2003, at 02:11 AM, Thomas Mahler wrote:
Hi Bill,
Sorry for the inconvienence. We don't have junit tests for the tutorial app, so they sometimes get out of sync...
You will need changes 1. and 2. for working against the default database only.
If you want to run the tutorial against a different database you will also have to change the jdbc-connection information.
You can do it in the hardcoded way you did.
But you couls also use the way recommemded in the platforms.html document.
cheers, Thomas
Bill Bug wrote:Hi All,
Many thanks for the valuable advice & insights offered in this list.
I'm afraid I'm stuck unable to get the OMDG tutorial - Tutorial2 - to run.
The stack trace is listed below.
It appears the database repository file is not getting properly read in the following initialization code
static
{
try
{
databaseName =
((PersistenceBrokerConfiguration) PersistenceBrokerFactory
.getConfigurator()
.getConfigurationFor(null))
.getRepositoryFilename();
}
catch (ConfigurationException e)
{
databaseName = "repository.xml";
}
}
This causes the database.open() attempt to fail in the Application() constructor:
try
{
db.open(databaseName, Database.OPEN_READ_WRITE);
}
catch (ODMGException ex)
{
ex.printStackTrace();
}
I was ultimately able to get the Tutorial2 to run by making the changes listed below. No one of these fixes was sufficient. I needed to make them all.
My questions are:
* Should these changes have been necessary? Did I have some other, simple configuration error that wouldn't have required me to alter any source code? I'm especially concerned about alteration number 3. Why would it be that the variable substitutions in the original repository_database.xml were not being done?
* If these changes are required to get Tutorial2 running, shouldn't the documentation be updated to include this information. It took me quite a while to piece this solution together.
Many thanks for any advice, info or references you can offer.
Cheers,
Bill Bug
Required Alterations:
1) Add the patches created by Armin Waibel to the following classes:
org.apache.ojb.broker.metadata.ConnectionRepository.java
org.apache.ojb.broker.ta.PersistenceBrokerFactoryDefaultImpl.java
org.apache.ojb.broker.util.BrokerHelper.java
and described in the post http://archives.apache.org/eyebrowse/ReadMsg?listName=ojb- [EMAIL PROTECTED]&msgNo=5507
2) made the following change to line 54 of org.apache.ojb.tutorial2.Application.java as described in Robert Sfeir's post http://archives.apache.org/eyebrowse/ReadMsg?listId=107&msgNo=5529
CHANGE:
db.open(databaseName, Database.OPEN_READ_WRITE);
TO:
db.open("default", Database.OPEN_READ_WRITE);
3) made the following change to repository_database.xml to point the jcd directly to the database I was using.
CHANGE:
<jdbc-connection-descriptor
jcd-alias="@JCD_ALIAS@"
default-connection="true"
platform="@DBMS_NAME@"
jdbc-level="@JDBC_LEVEL@"
driver="@DRIVER_NAME@"
protocol="@URL_PROTOCOL@"
subprotocol="@URL_SUBPROTOCOL@"
dbalias="@URL_DBALIAS@"
username="@USER_NAME@"
password="@USER_PASSWD@"
batch-mode="false"
>
TO:
<jdbc-connection-descriptor
jcd-alias="default"
default-connection="true"
platform="PostgreSQL"
jdbc-level="1.0"
driver="org.postgresql.Driver"
protocol="jdbc"
subprotocol="postgresql"
dbalias="ojb"
username="img_meister"
password="doodles"
batch-mode="false"
>
bin/tutorial2.sh
[org.apache.ojb.broker.metadata.ConnectionRepository] INFO: Could not found org.apache.ojb.broker.metadata.JdbcConnectionDescriptor for PBKey org.apache.ojb.broker.PBKey: repository=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
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructo rA ccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingCo ns tructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at org.apache.ojb.broker.util.ClassHelper.newInstance(ClassHelper.java:38 )
at org.apache.ojb.broker.util.factory.ConfigurableFactory.createNewInstan ce (ConfigurableFactory.java:140)
at org.apache.ojb.broker.util.factory.ConfigurableFactory.createNewInstan ce (ConfigurableFactory.java:225)
at org.apache.ojb.broker.accesslayer.ConnectionManagerFactory.createConne ct ionManager(ConnectionManagerFactory.java:35)
at org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.<init>(Persistenc eB rokerImpl.java:195)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructo rA ccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingCo ns tructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at org.apache.ojb.broker.util.ClassHelper.newInstance(ClassHelper.java:38 )
at org.apache.ojb.broker.ta.PersistenceBrokerFactoryDefaultImpl.createNew Br okerInstance(PersistenceBrokerFactoryDefaultImpl.java:199)
at org.apache.ojb.broker.ta.PersistenceBrokerFactoryDefaultImpl$PBKeyedPo ol ableObjectFactory.makeObject(PersistenceBrokerFactoryDefaultImpl.java: 37 7)
at org.apache.commons.pool.impl.GenericKeyedObjectPool.borrowObject(Gener ic KeyedObjectPool.java:748)
at org.apache.ojb.broker.ta.PersistenceBrokerFactoryDefaultImpl.createPer si stenceBroker(PersistenceBrokerFactoryDefaultImpl.java:240)
at org.apache.ojb.broker.PersistenceBrokerFactory.createPersistenceBroker (P ersistenceBrokerFactory.java:138)
at org.apache.ojb.odmg.DatabaseImpl.open(DatabaseImpl.java:160)
at org.apache.ojb.tutorial2.Application.<init>(Application.java:55)
at org.apache.ojb.tutorial2.Application.main(Application.java:89)
Caused by: java.lang.NullPointerException
at org.apache.ojb.broker.platforms.PlatformFactory.getPlatformFor(Platfor mF actory.java:81)
at org.apache.ojb.broker.accesslayer.ConnectionManagerImpl.<init>(Connect io nManagerImpl.java:101)
... 22 more
[org.apache.ojb.broker.ta.PersistenceBrokerFactoryDefaultImpl] ERROR: Creation of a new PB instance failed
null
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructo rA ccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingCo ns tructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at org.apache.ojb.broker.util.ClassHelper.newInstance(ClassHelper.java:38 )
at org.apache.ojb.broker.ta.PersistenceBrokerFactoryDefaultImpl.createNew Br okerInstance(PersistenceBrokerFactoryDefaultImpl.java:199)
at org.apache.ojb.broker.ta.PersistenceBrokerFactoryDefaultImpl$PBKeyedPo ol ableObjectFactory.makeObject(PersistenceBrokerFactoryDefaultImpl.java: 37 7)
at org.apache.commons.pool.impl.GenericKeyedObjectPool.borrowObject(Gener ic KeyedObjectPool.java:748)
at org.apache.ojb.broker.ta.PersistenceBrokerFactoryDefaultImpl.createPer si stenceBroker(PersistenceBrokerFactoryDefaultImpl.java:240)
at org.apache.ojb.broker.PersistenceBrokerFactory.createPersistenceBroker (P ersistenceBrokerFactory.java:138)
at org.apache.ojb.odmg.DatabaseImpl.open(DatabaseImpl.java:160)
at org.apache.ojb.tutorial2.Application.<init>(Application.java:55)
at org.apache.ojb.tutorial2.Application.main(Application.java:89)
Caused by: org.apache.ojb.broker.PersistenceBrokerException
at org.apache.ojb.broker.util.factory.ConfigurableFactory.createNewInstan ce (ConfigurableFactory.java:173)
at org.apache.ojb.broker.util.factory.ConfigurableFactory.createNewInstan ce (ConfigurableFactory.java:225)
at org.apache.ojb.broker.accesslayer.ConnectionManagerFactory.createConne ct ionManager(ConnectionManagerFactory.java:35)
at org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.<init>(Persistenc eB rokerImpl.java:195)
... 13 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructo rA ccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingCo ns tructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at org.apache.ojb.broker.util.ClassHelper.newInstance(ClassHelper.java:38 )
at org.apache.ojb.broker.util.factory.ConfigurableFactory.createNewInstan ce (ConfigurableFactory.java:140)
... 16 more
Caused by: java.lang.NullPointerException
at org.apache.ojb.broker.platforms.PlatformFactory.getPlatformFor(Platfor mF actory.java:81)
at org.apache.ojb.broker.accesslayer.ConnectionManagerImpl.<init>(Connect io nManagerImpl.java:101)
... 22 more
Bill Bug
Senior Analyst/Ontological Engineer
Computer Vision Laboratory for Vertebrate Brain Mapping
Department of Neurobiology & Anatomy
Drexel University College of Medicine
2900 Queen Lane
Philadelphia, PA 19129
215 991 8430 (ph)
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Bill Bug Senior Analyst/Ontological Engineer
Computer Vision Laboratory for Vertebrate Brain Mapping Department of Neurobiology & Anatomy Drexel University College of Medicine 2900 Queen Lane Philadelphia, PA 19129 215 991 8430 (ph)
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
