Bonjour je voudrais essayer ojb, mais je n'arrive pas configurer mon projet correctement :
Voici l'exception :
J'ai mis dans WEB-INF les fichiers suivants OJB.properties, repository.xml et repository.dtd.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6 java.lang.ExceptionInInitializerError at org.apache.ojb.broker.PersistenceBrokerFactory.defaultPersistenceBroker(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)
J'ai ajouté le jar contenant les classes ojb.
J'ai tout laissé par défaut sauf repository.xml :
et voici le code qui génère l'exception :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32 <!ENTITY database SYSTEM "repository_database.xml"> <!ENTITY internal SYSTEM "repository_internal.xml"> <!ENTITY user SYSTEM "repository_user.xml"> ]> <descriptor-repository version="1.0" isolation-level="read-uncommitted" proxy-prefetching-limit="50"> <!-- include all used database connections --> <jdbc-connection-descriptor jcd-alias="default" default-connection="true" platform="MySQL" jdbc-level="2.0" driver="org.gjt.mm.mysql.Driver" protocol="jdbc" subprotocol="@OJB_DB_URL@" dbalias="weblog" username="root" password="supports"/> <!-- include ojb internal mappings here; comment this if you don't need them --> &internal; <!-- include user defined mappings here --> <class-descriptor class="member.Member" table="member"> <field-descriptor name="id" column="member_id" jdbc-type="BIGINT" primarykey="true" autoincrement="true"/> <field-descriptor name="name" column="member_name" jdbc-type="VARCHAR"/> </class-descriptor> </descriptor-repository>
J'utilise la version 1.0.4 d'ojb, jdk 1.6, et struts 1.2.9
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 broker = PersistenceBrokerFactory.defaultPersistenceBroker();
Merci de l'aide.
Partager