Bonjour,
J'utilise JBoss pour faire tourner une API n-tiers, jusqu'ici tout allait bien, je navait pas de probleme pour inserer des donnees dans la Base.
Cependant depuis que j'essaye d'en getter via ce code :
public List getLangList()
{
Session session;
List l = null;
try {
session = HibernateUtil.currentSession();
l = session.find(" from LangInfo ");
// Travail sur la liste l
HibernateUtil.closeSession();
} catch (HibernateException e) { e.printStackTrace(); }
return l;
}
J'ai desormais une erreur, apparememt lie a ma datasource :
29 juin 2005 20:45:21 net.sf.hibernate.cfg.Environment <clinit>
INFO: Hibernate 2.1.6
29 juin 2005 20:45:21 net.sf.hibernate.cfg.Environment <clinit>
INFO: hibernate.properties not found
29 juin 2005 20:45:21 net.sf.hibernate.cfg.Environment <clinit>
INFO: using CGLIB reflection optimizer
29 juin 2005 20:45:21 net.sf.hibernate.cfg.Configuration configure
INFO: configuring from resource: /hibernate.cfg.xml
29 juin 2005 20:45:21 net.sf.hibernate.cfg.Configuration getConfigurationInputStream
INFO: Configuration resource: /hibernate.cfg.xml
29 juin 2005 20:45:21 net.sf.hibernate.cfg.Configuration addResource
INFO: Mapping resource: pfe/migration/server/ejb/bdd/GlobalConf.hbm
29 juin 2005 20:45:21 net.sf.hibernate.cfg.Binder bindRootClass
INFO: Mapping class: pfe.migration.server.ejb.bdd.GlobalConf -> GLOBAL_CONF
29 juin 2005 20:45:21 net.sf.hibernate.cfg.Configuration addResource
INFO: Mapping resource: pfe/migration/server/ejb/bdd/NetworkConfig.hbm
29 juin 2005 20:45:21 net.sf.hibernate.cfg.Binder bindRootClass
INFO: Mapping class: pfe.migration.server.ejb.bdd.NetworkConfig -> NETWORK_CONFIG
29 juin 2005 20:45:21 net.sf.hibernate.cfg.Configuration addResource
INFO: Mapping resource: pfe/migration/server/ejb/bdd/UsersData.hbm
29 juin 2005 20:45:21 net.sf.hibernate.cfg.Binder bindRootClass
INFO: Mapping class: pfe.migration.server.ejb.bdd.UsersData -> USERS_DATA
29 juin 2005 20:45:21 net.sf.hibernate.cfg.Configuration addResource
INFO: Mapping resource: pfe/migration/server/ejb/bdd/ParamIe.hbm
29 juin 2005 20:45:21 net.sf.hibernate.cfg.Binder bindRootClass
INFO: Mapping class: pfe.migration.server.ejb.bdd.ParamIe -> PARAM_IE
29 juin 2005 20:45:21 net.sf.hibernate.cfg.Configuration addResource
INFO: Mapping resource: pfe/migration/server/ejb/bdd/LangInfo.hbm
29 juin 2005 20:45:21 net.sf.hibernate.cfg.Binder bindRootClass
INFO: Mapping class: pfe.migration.server.ejb.bdd.LangInfo -> LANG_INFO
29 juin 2005 20:45:21 net.sf.hibernate.cfg.Configuration doConfigure
INFO: Configured SessionFactory: null
29 juin 2005 20:45:21 net.sf.hibernate.cfg.Configuration secondPassCompile
INFO: processing one-to-many association mappings
29 juin 2005 20:45:21 net.sf.hibernate.cfg.Configuration secondPassCompile
INFO: processing one-to-one association property references
29 juin 2005 20:45:21 net.sf.hibernate.cfg.Configuration secondPassCompile
INFO: processing foreign key constraints
29 juin 2005 20:45:21 net.sf.hibernate.dialect.Dialect <init>
INFO: Using dialect: net.sf.hibernate.dialect.MySQLDialect
29 juin 2005 20:45:21 net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Maximim outer join fetch depth: 2
29 juin 2005 20:45:21 net.sf.hibernate.cfg.SettingsFactory buildSettings
INFO: Use outer join fetching: true
29 juin 2005 20:45:21 net.sf.hibernate.util.NamingHelper getInitialContext
INFO: JNDI InitialContext properties:{}
29 juin 2005 20:45:21 net.sf.hibernate.connection.DatasourceConnectionProvider configure
GRAVE: Could not find datasource: java:/wandux
javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:640)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:280)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at net.sf.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:44)
at net.sf.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:83)
at net.sf.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:65)
at net.sf.hibernate.cfg.Configuration.buildSettings(Configuration.java:1155)
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:789)
at pfe.migration.server.ejb.bdd.HibernateUtil.<clinit>(HibernateUtil.java:22)
at pfe.migration.client.pre.app.apparence.steps.UserNetStep.getLangList(UserNetStep.java:194)
at pfe.migration.client.pre.app.apparence.steps.UserNetStep.systemInformation(UserNetStep.java:177)
at pfe.migration.client.pre.app.apparence.steps.UserNetStep.<init>(UserNetStep.java:53)
at pfe.migration.client.pre.app.apparence.WanduxApp.moveStepUserAndNetwork(WanduxApp.java:166)
at pfe.migration.client.pre.app.apparence.WanduxApp.incStep(WanduxApp.java:224)
at pfe.migration.client.pre.app.apparence.ButtonImageCanvas.mouseReleased(ButtonImageCanvas.java:80)
at java.awt.Component.processMouseEvent(Component.java:5100)
at java.awt.Component.processEvent(Component.java:4897)
at java.awt.Component.dispatchEventImpl(Component.java:3615)
at java.awt.Component.dispatchEvent(Component.java:3477)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
java.lang.ExceptionInInitializerError
at pfe.migration.client.pre.app.apparence.steps.UserNetStep.getLangList(UserNetStep.java:194)
at pfe.migration.client.pre.app.apparence.steps.UserNetStep.systemInformation(UserNetStep.java:177)
at pfe.migration.client.pre.app.apparence.steps.UserNetStep.<init>(UserNetStep.java:53)
at pfe.migration.client.pre.app.apparence.WanduxApp.moveStepUserAndNetwork(WanduxApp.java:166)
at pfe.migration.client.pre.app.apparence.WanduxApp.incStep(WanduxApp.java:224)
at pfe.migration.client.pre.app.apparence.ButtonImageCanvas.mouseReleased(ButtonImageCanvas.java:80)
at java.awt.Component.processMouseEvent(Component.java:5100)
at java.awt.Component.processEvent(Component.java:4897)
at java.awt.Component.dispatchEventImpl(Component.java:3615)
at java.awt.Component.dispatchEvent(Component.java:3477)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
Caused by: java.lang.RuntimeException: Problème de configuration : Could not find datasource
at pfe.migration.server.ejb.bdd.HibernateUtil.<clinit>(HibernateUtil.java:25)
... 16 more
Caused by: net.sf.hibernate.HibernateException: Could not find datasource
at net.sf.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:48)
at net.sf.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:83)
at net.sf.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:65)
at net.sf.hibernate.cfg.Configuration.buildSettings(Configuration.java:1155)
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:789)
at pfe.migration.server.ejb.bdd.HibernateUtil.<clinit>(HibernateUtil.java:22)
... 16 more
Caused by: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:640)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:280)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at net.sf.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:44)
... 21 more
Cependant mes recherches me menent a penser que le probleme viendrais d'une mauvaise configuration de JBoss concernant la NamingFactory ou de l'abscence de contexte initial.
Je ne parvient pas a isoler la source de mon probleme et encore moins a le resoudre ;-) ...
D'avance merci pour vos idees de solutions, Gael.
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version: 2.0
Name and version of the database you are using: MySQL