-->
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.  [ 13 posts ] 
Author Message
 Post subject: hibernate not bound -jboss mbeans related issue
PostPosted: Fri Nov 28, 2003 4:04 am 
Beginner
Beginner

Joined: Fri Nov 28, 2003 3:45 am
Posts: 23
Location: malaysia
Dear all,

I got the following messages when I issued standalone client Jndi look up to look for
java:/hibernate/HibernateFactory

javax.naming.NameNotFoundException: hibernate not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:495)

jndi view from jboss seems indicate jndi successfully employed using sar as per hibernate JMX mbean installed method


java: Namespace
+- XAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)
+- DefaultDS (class: org.jboss.resource.adapter.jdbc.WrapperDataSource)
+- SecurityProxyFactory (class: org.jboss.security.SubjectSecurityProxyFactory)
+- PostgresDS (class: org.jboss.resource.adapter.jdbc.WrapperDataSource)
+- DefaultJMSProvider (class: org.jboss.jms.jndi.JBossMQProvider)
+- comp (class: javax.naming.Context)
+- JmsXA (class: org.jboss.resource.adapter.jms.JmsConnectionFactoryImpl)
+- ConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)
+- jaas (class: javax.naming.Context)
| +- JmsXARealm (class: org.jboss.security.plugins.SecurityDomainContext)
| +- jbossmq (class: org.jboss.security.plugins.SecurityDomainContext)
| +- HsqlDbRealm (class: org.jboss.security.plugins.SecurityDomainContext)
+- timedCacheFactory (class: javax.naming.Context)
Failed to lookup: timedCacheFactory, errmsg=null
+- TransactionPropagationContextExporter (class: org.jboss.tm.TransactionPropagationContextFactory)
+- Mail (class: javax.mail.Session)
+- StdJMSPool (class: org.jboss.jms.asf.StdServerSessionPoolFactory)
+- TransactionPropagationContextImporter (class: org.jboss.tm.TransactionPropagationContextImporter)
+- TransactionManager (class: org.jboss.tm.TxManager)
+- hibernate (class: org.jnp.interfaces.NamingContext)
| +- HibernateFactory (class: net.sf.hibernate.impl.SessionFactoryImpl)
+- MSSQLDS (class: org.jboss.resource.adapter.jdbc.WrapperDataSource)


jboss log out related to sar file employed

15:17:24,457 INFO [Environment] Hibernate 2.1 beta 5
15:17:24,487 INFO [Environment] hibernate.properties not found
15:17:24,507 INFO [Environment] using CGLIB reflection optimizer
15:17:24,527 INFO [Configuration] Mapping resource: src/grp.hbm.xml
15:17:25,128 INFO [Binder] Mapping class: src.grp -> grp
15:17:25,548 INFO [Configuration] Mapping resource: src/codemaster.hbm.xml
15:17:25,659 INFO [Binder] Mapping class: src.codemaster -> codemaster
15:17:25,669 INFO [Configuration] processing one-to-many association mappings
15:17:25,669 INFO [Binder] Mapping collection: src.grp.codemaster -> codemaster
15:17:25,679 INFO [Configuration] processing one-to-one association property references
15:17:25,679 INFO [Configuration] processing foreign key constraints
15:17:25,779 INFO [Dialect] Using dialect: net.sf.hibernate.dialect.PostgreSQLDialect
15:17:25,779 INFO [SettingsFactory] Use outer join fetching: false
15:17:25,809 INFO [NamingHelper] JNDI InitialContext properties:{}
15:17:25,829 INFO [DatasourceConnectionProvider] Using datasource: java:/PostgresDS
15:17:25,849 INFO [TransactionFactoryFactory] Transaction strategy: net.sf.hibernate.transaction.JTATransactionFactory
15:17:25,869 INFO [NamingHelper] JNDI InitialContext properties:{}
15:17:25,879 INFO [TransactionManagerLookupFactory] instantiating TransactionManagerLookup: net.sf.hibernate.transaction.JBossTransactionManagerLookup
15:17:25,899 INFO [TransactionManagerLookupFactory] instantiated TransactionManagerLookup
15:17:25,909 INFO [NamingHelper] JNDI InitialContext properties:{}
15:17:25,909 INFO [TransactionManagerLookupFactory] instantiating TransactionManagerLookup: net.sf.hibernate.transaction.JBossTransactionManagerLookup
15:17:25,909 INFO [TransactionManagerLookupFactory] instantiated TransactionManagerLookup
15:17:26,920 INFO [SettingsFactory] Use scrollable result sets: true
15:17:26,920 INFO [SettingsFactory] JDBC 2 max batch size: 15
15:17:26,920 INFO [SettingsFactory] echoing all SQL to stdout
15:17:26,930 INFO [SettingsFactory] Query language substitutions: {}
15:17:26,930 INFO [SettingsFactory] cache provider: net.sf.hibernate.cache.JCSCacheProvider
15:17:26,940 INFO [Configuration] instantiating and configuring caches
15:17:27,341 INFO [SessionFactoryImpl] building session factory
15:17:28,062 INFO [SessionFactoryObjectFactory] Factory name: java:/hibernate/HibernateFactory
15:17:28,062 INFO [NamingHelper] JNDI InitialContext properties:{}
15:17:28,072 INFO [NamingHelper] Creating subcontext: hibernate
15:17:28,072 INFO [SessionFactoryObjectFactory] Bound factory to JNDI name: java:/hibernate/HibernateFactory
15:17:28,072 WARN [SessionFactoryObjectFactory] InitialContext did not implement EventContext
15:17:28,072 INFO [NamingHelper] JNDI InitialContext properties:{}


extract of the standalone clinet issuing the lookup

try{
Context ctxh=new InitialContext();
env=ctxh.getEnvironment();
System.out.println(env);
Object oHiber;
oHiber=ctxh.lookup("java:/hibernate/HibernateFactory");
SessionFactory factory=(SessionFactory)PortableRemoteObject.narrow(oHiber,SessionFactory.class);
System.out.println("factory= "+factory);
Session session=factory.openSession();
Transaction tx=null;
try{tx=session.beginTransaction();


messages and error related to initial context
{java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.provider.url=OPSMERP1:1099, jnp.timeout=0, jnp.socketFactory=org.jnp.interfaces.TimedSocketFactory, java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces, jnp.sotimeout=0}
javax.naming.NameNotFoundException: hibernate not bound


I have no idea why this is so , could somebody help me to resolve this?

the same hibernate configuration xml mapping files work fine using client programme with jndi look up as well as hibernator 0.96 in the eclipse environment.


Thanks in advance


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 28, 2003 8:35 pm 
Beginner
Beginner

Joined: Fri Nov 28, 2003 3:45 am
Posts: 23
Location: malaysia
Dear all,

is it true to say that the hibernate jndi only exist within the same JVM and can not be accessed from external ? I try to wrap it using a session bean concept before issuing a local session bean interface to perform the jndi look up but nothing seems to work so far. Somebody suggest to me that try using jnp://localhost to configure the initial jboss context to global jndi environment , jndi look up seems ok but still encounter with errors resulted from either hibernate or jboss, could some one try to shed the light and provide insights into this problem ?


Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 28, 2003 8:40 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Quote:
is it true to say that the hibernate jndi only exist within the same JVM and can not be accessed from external


Absolutely! We don't want to talk to the session factory over the network!


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 28, 2003 9:12 pm 
Beginner
Beginner

Joined: Fri Nov 28, 2003 3:45 am
Posts: 23
Location: malaysia
Hello gavin,

Dear Sir,

Could you be kind enough to teach me how to access the hibernate jndi
java:/hibernate/HibernateFactory using the correct jndi lookup or method?

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 29, 2003 2:21 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
See your other thread - Its answered there.


Top
 Profile  
 
 Post subject: Did I answer the JNDI 'example' question in another thread?
PostPosted: Sat Nov 29, 2003 2:25 am 
Regular
Regular

Joined: Sun Sep 21, 2003 11:43 pm
Posts: 85
Location: Massachusetts
I guess I did. :)

Regards,
David

P.S. Yes, I know it's too late for jokes.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 29, 2003 2:31 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Its only late afternoon here - jokes are great any time. With both our answer he should be right (no joke :-) ).


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 30, 2003 7:45 pm 
Beginner
Beginner

Joined: Fri Nov 28, 2003 3:45 am
Posts: 23
Location: malaysia
Hi ,


I could not understand and do not know where to look for you fellow precise answer to my question, could you be more specific by what does it means " answer in other thread or forum "


Thanks


Top
 Profile  
 
 Post subject: explanation
PostPosted: Sun Nov 30, 2003 8:14 pm 
Regular
Regular

Joined: Sun Sep 21, 2003 11:43 pm
Posts: 85
Location: Massachusetts
Dear tsg26,

Earlier in this topic, you asked the question:

Quote:
Could you be kind enough to teach me how to access the hibernate jndi java:/hibernate/HibernateFactory using the correct jndi lookup or method?


Both David and I (I'm another David) answered that question in YOUR other topic/thread entitled How to lookup hibernate jndi?. If you followed your previous post, you would have seen details on changing your hibernate configuration as well as the (working) example Java code I supplied for you. Please review that thread and those answers at the page: http://forum.hibernate.org/viewtopic.php?t=925945&highlight=

In the future, before you post a question, you might want to use the forum search feature to avoid asking questions which have already been answered. Many times, those answers include example code which can save you (and everyone else) time. :)

Regards,
David


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 04, 2004 12:00 am 
Newbie

Joined: Tue Dec 30, 2003 11:04 pm
Posts: 2
I got the same problem.
(Using JBoss MBean with Hibernate 2.1.1, JBoss3.2.3, JBossIDE 1.2.2, XDoclet1.2, Eclipse 2.1.2)

My ejb client cannot lookup the session factory
(javax.naming.NameNotFoundException: HibernateFactory not bound)
,while in session bean, it works.

I do a search here, but fail to get the answer.

thank you for your answer.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 04, 2004 12:53 am 
Senior
Senior

Joined: Tue Nov 25, 2003 9:35 am
Posts: 194
Location: San Francisco
Look at Gavin's reply, above. It makes no sense to access a SessionFactory outside the JVM.


Sherman


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 04, 2004 1:55 am 
Newbie

Joined: Tue Dec 30, 2003 11:04 pm
Posts: 2
sgwood wrote:
Look at Gavin's reply, above. It makes no sense to access a SessionFactory outside the JVM.
Sherman


I want use SessionBean to wrap business logic (use Hibernate if need to fetch data),
but want the client to fetch data using hibernate api directly.
like this:
Code:
//:EJB Client

bean=.. //lookup a ejb
bean.someBusinessMethod();
SessionFactory sessions=.. //lookup a sessionFactory via JNDI
Session session=sessions.openSession();
...
session.save(obj);
session.createQuery(..);
..
session.close();


Is it possible?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 04, 2004 7:45 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
No. The Hibernate SessionFactory bound in JNDI is not accessible over the network.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 13 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.