> at JEgmont.main(Unknown Source) > Caused by: org.apache.ojb.broker.OJBRuntimeException: Property for key > 'PersistenceBrokerFactoryClass' can not be found in properties file
Seems that OJB.properties file is not in classpath.
regards, Armin
Sven Alisch wrote:
Hello ML,
I'm a newbie, sorry for my posting, i know this was discussed in past, but i don't get rid of that error message in this subject.
I create my application from template ojb-blank.
I created my repository_user.xml in directory ./src/ressources/ and it looks like (it is only an extract - after snip and it ends before snap) :
<snip>
<class-descriptor class="jegmont.Users" table="USERS">
<field-descriptor name="userID" primarykey="true" default-fetch="true" column="USERID" jdbc-type="INTEGER"/>
<field-descriptor name="name" nullable="false" default-fetch="true" column="NAME" jdbc-type="VARCHAR"/>
<field-descriptor name="surname" nullable="false" default-fetch="true" column="SURNAME" jdbc-type="VARCHAR"/>
<field-descriptor name="login" nullable="false" default-fetch="true" column="LOGIN" jdbc-type="VARCHAR"/>
<field-descriptor name="password" nullable="false" default-fetch="true" column="PASSWORD" jdbc-type="VARCHAR"/>
</class-descriptor>
</snap>
My Class for that exsample is:
public class Users {
public Users() { }
/** auto_increment */ private Integer userID; private String name; private String surname; private String login; private String password;
// Getters & Setters ...
}
Now I do following in my Main for testing:
import java.util.*;
import org.apache.ojb.broker.*; import org.apache.ojb.broker.query.*;
import jegmont.*;
public class JEgmont {
public static void main(String args[]) { System.out.println("Hello OJB!");
PersistenceBroker broker = null;
try {
broker =
PersistenceBrokerFactory.defaultPersistenceBroker();
Users Template = new Users();Template.setName("Alisch");
QueryByCriteria query = new QueryByCriteria(Template);
Users alisch = (Users) broker.getObjectByQuery(query);
System.out.println(alisch.getName());
}
finally {
if (broker != null) broker.close();
}
}
}
I compiled everything with ant. If I start my app with java -DOJB.properties JEgmont - the following error occured:
Hello OJB!
[BOOT] ERROR: Creation of PersistenceBrokerFactory (PBF) instance failed, can't get PBF class object
Exception in thread "main" java.lang.ExceptionInInitializerError
at org.apache.ojb.broker.PersistenceBrokerFactory.defaultPersistenceBroker(Unknown Source)
at JEgmont.main(Unknown Source)
Caused by: org.apache.ojb.broker.OJBRuntimeException: Property for key 'PersistenceBrokerFactoryClass' can not be found in properties file
at org.apache.ojb.broker.core.PersistenceBrokerFactoryFactory.init(Unknown Source)
at org.apache.ojb.broker.core.PersistenceBrokerFactoryFactory.<clinit>(Unknown Source)
... 2 more
Please help me, i have absolutly no idea for a solution.
Greetings, Sven
--------------------------------------------------------------------- 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]
