-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Problems to found DataSource
PostPosted: Tue Dec 23, 2003 2:40 pm 
Newbie

Joined: Mon Oct 20, 2003 12:18 pm
Posts: 12
Location: Mexico
Hi, I have a SessionBean that extends of BaseService class. In this class I have a method to get the session factory
Code:
    private SessionFactory getSessionFactory() {
        if (developmentMode) {
            _sessionFactory = null;
        }
        if (_sessionFactory == null) {         
            if (LOG.isDebugEnabled()) {
                LOG.debug("getSessionFactory");
            }
            if (!developmentMode) {
                Context context = null;
                try {
                    context = new InitialContext();
                    _sessionFactory = (SessionFactory) context.lookup("HibernateSessionFactory");
                }
                catch (NamingException e) {
                    LOG.warn("Couldn't load SessionFactory from context", e);
                }
                finally {
                    try {
                        if (context != null) {
                            context.close();
                        }
                    }
                    catch (Exception e) {
                        LOG.warn("Couldn't close context", e);
                    }
                }
            }
            else {
                try {
                    _sessionFactory = new Configuration().configure("/com/ixe/ods/seguridad/model/securityadmin.cfg.xml").buildSessionFactory();                   
                }
                catch (HibernateException e) {               
                    LOG.warn(e);
                }
            }
        }
        return _sessionFactory;
    }

The problem is when I try to run my program I receive the next message:
Code:
15640 [main] FATAL connection.DatasourceConnectionProvider  - Could not find datasource: dataSource-ixeNetOraclePool
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:64)
   at net.sf.hibernate.cfg.Configuration.buildSettings(Configuration.java:1091)
   at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:737)
   at com.ixe.ods.seguridad.BaseService.getSessionFactory(BaseService.java:72)
   at com.ixe.ods.seguridad.BaseService.getSession(BaseService.java:89)
   at com.ixe.ods.seguridad.SecuritySessionBean.autorizaFacultad(SecuritySessionBean.java:53)
   at com.ixe.ods.seguridad.test.TestSecuritySession.testAutorizaFacultad(TestSecuritySession.java:56)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:324)
   at junit.framework.TestCase.runTest(TestCase.java:154)
   at junit.framework.TestCase.runBare(TestCase.java:127)
   at junit.framework.TestResult$1.protect(TestResult.java:106)
   at junit.framework.TestResult.runProtected(TestResult.java:124)
   at junit.framework.TestResult.run(TestResult.java:109)
   at junit.framework.TestCase.run(TestCase.java:118)
   at junit.framework.TestSuite.runTest(TestSuite.java:208)
   at junit.framework.TestSuite.run(TestSuite.java:203)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:377)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:261)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:152)
15656 [main] WARN seguridad.SecuritySessionBean  - net.sf.hibernate.HibernateException: Could not find datasource
_sessionFactory ==> null


I reviewed the WebLogic server and the datasource is correct, If someone can help me I will be very grateful.

Thanks in Advance


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.