You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Christine Gerstenmayer <ch...@chello.at> on 2005/07/02 07:08:55 UTC

Problem with OJB 1.0.1 in a batch-program

Because I do not find my question asked on 2005-06-30 in mail-archive
(although questions from 2005-07-01 are already there) I try it once more:

Hi all,

I use OJB in a batch-program. 

The batch-program is in a different project to the OBJ-Classes and
-properties.

All OJB-classes and -repository-files are included in a jar-File which is in
the classpath of the batch-program when running it.

When running it as a Java-Application in Eclipse with the OJB-Project in
Java Build Path everything works fine.

If I run it outside Eclipse in a shellskript I get the following exception
while initializing OJB:

2005-06-30 20:18:37,714 [ERROR] at.rit.cpm.azvimport.AZVImport  - There was
no default-PBKey specified
org.apache.ojb.broker.PBFactoryException: There was no default-PBKey
specified
        at
org.apache.ojb.broker.core.PersistenceBrokerFactoryBaseImpl.defaultPersisten
ceBroker(Unknown Source)
        at
org.apache.ojb.broker.PersistenceBrokerFactory.defaultPersistenceBroker(Unkn
own Source)
        at
at.rit.cpm.persistency.AbstractPersistency.getNewBroker(AbstractPersistency.
java:45)
        at
at.rit.cpm.persistency.AbstractPersistency.selectOrderedByCriteria(AbstractP
ersistency.java:428)
        at
at.rit.cpm.factory.BankTypeFactory.getAllBankTypes(BankTypeFactory.java:48)
        at at.rit.cpm.azvimport.AZVImport.main(AZVImport.java:33)


If I include the contents of repository.database.xml and
repository_internal.xml into repository_base.xml at place "&database" and
"&internal" and I copy all contents of all table-repository-files into
repository.xml (at "&adminlog;&banktype;..") it also works fine.

Why OJB doesn't find the files represented by the placeholders like
"&internal" or "&database" or "&<tablename>" when I run it in batch-mode ?

Please help.

Thanks in advance.

Christine




---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


AW: Problem with OJB 1.0.1 in a batch-program

Posted by Christine Gerstenmayer <ch...@chello.at>.
Hi Tom !
Aha, I thought, there would be another solution.
Ok, I changed build.xml and inserted several replacetasks and now it works.
Thanks a lot for your support!
Christine

-----Ursprüngliche Nachricht-----
Von: Thomas Dudziak [mailto:tomdzk@gmail.com] 
Gesendet: Samstag, 02. Juli 2005 10:23
An: OJB Users List
Betreff: Re: Problem with OJB 1.0.1 in a batch-program

On 7/2/05, Christine Gerstenmayer <ch...@chello.at> wrote:

> I use OJB in a batch-program.
> 
> The batch-program is in a different project to the OBJ-Classes and
> -properties.
> 
> All OJB-classes and -repository-files are included in a jar-File which is
in
> the classpath of the batch-program when running it.
> 
> When running it as a Java-Application in Eclipse with the OJB-Project in
> Java Build Path everything works fine.
> 
> If I run it outside Eclipse in a shellskript I get the following exception
> while initializing OJB:
> 
> 2005-06-30 20:18:37,714 [ERROR] at.rit.cpm.azvimport.AZVImport  - There
was
> no default-PBKey specified
> org.apache.ojb.broker.PBFactoryException: There was no default-PBKey
> specified
>         at
>
org.apache.ojb.broker.core.PersistenceBrokerFactoryBaseImpl.defaultPersisten
> ceBroker(Unknown Source)
>         at
>
org.apache.ojb.broker.PersistenceBrokerFactory.defaultPersistenceBroker(Unkn
> own Source)
>         at
>
at.rit.cpm.persistency.AbstractPersistency.getNewBroker(AbstractPersistency.
> java:45)
>         at
>
at.rit.cpm.persistency.AbstractPersistency.selectOrderedByCriteria(AbstractP
> ersistency.java:428)
>         at
>
at.rit.cpm.factory.BankTypeFactory.getAllBankTypes(BankTypeFactory.java:48)
>         at at.rit.cpm.azvimport.AZVImport.main(AZVImport.java:33)
> 
> 
> If I include the contents of repository.database.xml and
> repository_internal.xml into repository_base.xml at place "&database" and
> "&internal" and I copy all contents of all table-repository-files into
> repository.xml (at "&adminlog;&banktype;..") it also works fine.
> 
> Why OJB doesn't find the files represented by the placeholders like
> "&internal" or "&database" or "&<tablename>" when I run it in batch-mode ?

This is a problem of the XML parser, not OJB, because the resolution
of these entities is done by the XML parser which probably does not
search the classpath or jars in it. You chould include the contents of
the files referenced by the entities directly in the repository.xml,
eg. using Ant's replace task.

Tom

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: Problem with OJB 1.0.1 in a batch-program

Posted by Thomas Dudziak <to...@gmail.com>.
On 7/2/05, Christine Gerstenmayer <ch...@chello.at> wrote:

> I use OJB in a batch-program.
> 
> The batch-program is in a different project to the OBJ-Classes and
> -properties.
> 
> All OJB-classes and -repository-files are included in a jar-File which is in
> the classpath of the batch-program when running it.
> 
> When running it as a Java-Application in Eclipse with the OJB-Project in
> Java Build Path everything works fine.
> 
> If I run it outside Eclipse in a shellskript I get the following exception
> while initializing OJB:
> 
> 2005-06-30 20:18:37,714 [ERROR] at.rit.cpm.azvimport.AZVImport  - There was
> no default-PBKey specified
> org.apache.ojb.broker.PBFactoryException: There was no default-PBKey
> specified
>         at
> org.apache.ojb.broker.core.PersistenceBrokerFactoryBaseImpl.defaultPersisten
> ceBroker(Unknown Source)
>         at
> org.apache.ojb.broker.PersistenceBrokerFactory.defaultPersistenceBroker(Unkn
> own Source)
>         at
> at.rit.cpm.persistency.AbstractPersistency.getNewBroker(AbstractPersistency.
> java:45)
>         at
> at.rit.cpm.persistency.AbstractPersistency.selectOrderedByCriteria(AbstractP
> ersistency.java:428)
>         at
> at.rit.cpm.factory.BankTypeFactory.getAllBankTypes(BankTypeFactory.java:48)
>         at at.rit.cpm.azvimport.AZVImport.main(AZVImport.java:33)
> 
> 
> If I include the contents of repository.database.xml and
> repository_internal.xml into repository_base.xml at place "&database" and
> "&internal" and I copy all contents of all table-repository-files into
> repository.xml (at "&adminlog;&banktype;..") it also works fine.
> 
> Why OJB doesn't find the files represented by the placeholders like
> "&internal" or "&database" or "&<tablename>" when I run it in batch-mode ?

This is a problem of the XML parser, not OJB, because the resolution
of these entities is done by the XML parser which probably does not
search the classpath or jars in it. You chould include the contents of
the files referenced by the entities directly in the repository.xml,
eg. using Ant's replace task.

Tom

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org