-->
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.  [ 4 posts ] 
Author Message
 Post subject: JNDI lookup fails! Returns null SesssionFactory
PostPosted: Mon Oct 17, 2005 3:45 pm 
Newbie

Joined: Mon Apr 18, 2005 5:53 pm
Posts: 6
Hibernate version:
3.0.5

I have a SessionFactoryObjectFactory deployed in a jboss server (4.0). When I try to access it from an application outside the container (via JNDI lookup) I get a null SessionFactory. Here's the outside container application code:

--------------------------------
Properties jndiProps = new Properties();
jndiProps.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"org.jboss.naming.NamingContextFactory");
jndiProps.setProperty(Context.URL_PKG_PREFIXES,
"org.jboss.naming:org.jnp.interfaces");
jndiProps.setProperty(Context.PROVIDER_URL, "jnp://192.168.1.3:1100/");
/*my JDNI server is at port 1100, this is ok!*/
try {
context = new InitialContext(jndiProps);
} catch (NamingException e) {
//error
}

(SessionFactory) sf = (SessionFactory) context.lookup("java:/hibernate/SessionFactory");
System.out.println(sf); /*this code prints "null" here*/
-------------------------------------
I also have the following messages in the application console:
17:21:41,437 DEBUG SessionFactoryObjectFactory:39 - initializing class SessionFactoryObjectFactory
17:21:41,453 DEBUG SessionFactoryObjectFactory:69 - JNDI lookup: hibernate/SessionFactory
17:21:41,453 DEBUG SessionFactoryObjectFactory:145 - lookup: uid=4028818306ffb8b30106ffb8b6aa0000
17:21:41,453 WARN SessionFactoryObjectFactory:148 - Not found: 4028818306ffb8b30106ffb8b6aa0000
17:21:41,453 DEBUG SessionFactoryObjectFactory:149 - {}

-----------------------------------------
here is the jboss log for the HibernateService
17:38:39,867 INFO [HibernateServiceMBean] starting service at JNDI name: hibernate/SessionFactory
17:38:39,867 INFO [HibernateServiceMBean] service properties: {hibernate.session_factory_name=hibernate/SessionFactory, hibernate.transaction.manager_lookup_class=org.hibernate.transaction.JBossTransactionManagerLookup, hibernate.transaction.auto_close_session=true, hibernate.transaction.factory_class=org.hibernate.transaction.JDBCTransactionFactory, hibernate.connection.datasource=java:InformixDS, hibernate.transaction.flush_before_completion=true}
17:38:39,932 INFO [Environment] Hibernate 3.0.5
17:38:39,933 INFO [Environment] hibernate.properties not found
17:38:39,936 INFO [Environment] using CGLIB reflection optimizer
17:38:39,937 INFO [Environment] using JDK 1.4 java.sql.Timestamp handling
17:38:40,061 INFO [Configuration] Mapping resource: imb/logix/database/vdp/Cliente.hbm.xml
17:38:40,230 INFO [HbmBinder] Mapping class: imb.logix.database.vdp.Cliente -> clientes
17:38:40,300 INFO [Configuration] processing extends queue
17:38:40,301 INFO [Configuration] processing collection mappings
17:38:40,301 INFO [Configuration] processing association property references
17:38:40,301 INFO [Configuration] processing foreign key constraints
17:38:40,480 INFO [NamingHelper] JNDI InitialContext properties:{}
17:38:40,484 INFO [DatasourceConnectionProvider] Using datasource: java:InformixDS
17:38:40,820 INFO [SettingsFactory] RDBMS: Informix Dynamic Server, version: 9.40.UC6
17:38:40,820 INFO [SettingsFactory] JDBC driver: IBM Informix JDBC Driver for IBM Informix Dynamic Server, version: 2.21.JC6
17:38:40,852 INFO [Dialect] Using dialect: org.hibernate.dialect.InformixDialect
17:38:40,860 INFO [TransactionFactoryFactory] Transaction strategy: org.hibernate.transaction.JDBCTransactionFactory
17:38:40,865 INFO [TransactionManagerLookupFactory] instantiating TransactionManagerLookup: org.hibernate.transaction.JBossTransactionManagerLookup
17:38:40,869 INFO [TransactionManagerLookupFactory] instantiated TransactionManagerLookup
17:38:40,870 INFO [SettingsFactory] Automatic flush during beforeCompletion(): enabled
17:38:40,870 INFO [SettingsFactory] Automatic session close at end of transaction: enabled
17:38:40,872 INFO [SettingsFactory] Scrollable result sets: enabled
17:38:40,872 INFO [SettingsFactory] JDBC3 getGeneratedKeys(): disabled
17:38:40,872 INFO [SettingsFactory] Connection release mode: null
17:38:40,874 INFO [SettingsFactory] Maximum outer join fetch depth: 5
17:38:40,874 INFO [SettingsFactory] Default batch fetch size: 1
17:38:40,874 INFO [SettingsFactory] Generate SQL with comments: disabled
17:38:40,874 INFO [SettingsFactory] Order SQL updates by primary key: disabled
17:38:40,874 INFO [SettingsFactory] Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
17:38:40,880 INFO [ASTQueryTranslatorFactory] Using ASTQueryTranslatorFactory
17:38:40,881 INFO [SettingsFactory] Query language substitutions: {}
17:38:40,881 INFO [SettingsFactory] Second-level cache: enabled
17:38:40,881 INFO [SettingsFactory] Query cache: enabled
17:38:40,881 INFO [SettingsFactory] Cache provider: org.hibernate.cache.EhCacheProvider
17:38:40,888 INFO [SettingsFactory] Optimize cache for minimal puts: disabled
17:38:40,888 INFO [SettingsFactory] Structured second-level cache entries: disabled
17:38:40,888 INFO [SettingsFactory] Query cache factory: org.hibernate.cache.StandardQueryCacheFactory
17:38:40,904 INFO [SettingsFactory] Statistics: disabled
17:38:40,904 INFO [SettingsFactory] Deleted entity synthetic identifier rollback: disabled
17:38:40,906 INFO [SettingsFactory] Default entity-mode: pojo
17:38:41,080 INFO [SessionFactoryImpl] building session factory
17:38:41,098 WARN [Configurator] No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: jar:file:/usr/local/jboss-4.0.2/server/default/tmp/deploy/tmp15285ehcache-1.1.jar!/ehcache-failsafe.xml
17:38:41,660 INFO [SessionFactoryObjectFactory] Factory name: hibernate/SessionFactory
17:38:41,661 INFO [NamingHelper] JNDI InitialContext properties:{}
17:38:41,662 INFO [SessionFactoryObjectFactory] Bound factory to JNDI name: hibernate/SessionFactory
17:38:41,662 WARN [SessionFactoryObjectFactory] InitialContext did not implement EventContext
17:38:41,662 INFO [NamingHelper] JNDI InitialContext properties:{}
17:38:41,666 INFO [UpdateTimestampsCache] starting update timestamps cache at region: org.hibernate.cache.UpdateTimestampsCache
17:38:41,666 WARN [EhCacheProvider] Could not find configuration [org.hibernate.cache.UpdateTimestampsCache]; using defaults.
17:38:41,694 INFO [StandardQueryCache] starting query cache at region: org.hibernate.cache.StandardQueryCache
17:38:41,695 WARN [EhCacheProvider] Could not find configuration [org.hibernate.cache.StandardQueryCache]; using defaults.
17:38:41,696 INFO [SessionFactoryImpl] Checking 0 named queries


Top
 Profile  
 
 Post subject: Re: JNDI lookup fails! Returns null SesssionFactory
PostPosted: Mon Nov 07, 2005 5:37 am 
Newbie

Joined: Fri Nov 04, 2005 8:15 am
Posts: 5
hai,
did u tried keeping the Hibernate.properties file in the server/default/conf directory of the JBoss..
..phani


Top
 Profile  
 
 Post subject: Re: JNDI lookup fails! Returns null SesssionFactory
PostPosted: Mon Nov 07, 2005 3:50 pm 
Newbie

Joined: Fri Jan 07, 2005 5:31 pm
Posts: 2
Well that is farther than I got. I have set up the same thing via a JBoss har file and I am trying to access it via a JNDI look up that is exactly the same as yours (port 1099 though).

All I get is a javax.naming.NameNotFoundException: hibernate not bound

Any Ideas?

JBoss 4.0.2
Hibernate 3.0.5


Thanks,
ses


Top
 Profile  
 
 Post subject: Re: JNDI lookup fails! Returns null SesssionFactory
PostPosted: Tue Nov 08, 2005 9:49 am 
Newbie

Joined: Fri Jan 07, 2005 5:31 pm
Posts: 2
sully6768 wrote:
Well that is farther than I got.


I fixed the lookup but now I am getting the same problem as you, Null SessionFactory.

Anyone else having this problem?

ses


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

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.