Dear all,
Sorry for posing this topic again, especially to Hibernate team as I still could not resolve the factory jndi issues
Using the advice provided, thel following erros again appears on the jboss jndi look up through local client and session bean jndi wrap up
{java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.provider.url=localhost:1099, jnp.timeout=0, jnp.socketFactory=org.jnp.interfaces.TimedSocketFactory, java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces, jnp.sotimeout=0}
RelHome
RelHome
home1=RelHome
0 [AWT-EventQueue-0] DEBUG net.sf.hibernate.impl.SessionFactoryImpl - deserializing
30 [AWT-EventQueue-0] DEBUG net.sf.hibernate.impl.SessionFactoryImpl - deserialized: 4028819af92fa8af00f92fa8b3cb0000
30 [AWT-EventQueue-0] DEBUG net.sf.hibernate.impl.SessionFactoryImpl - Resolving serialized SessionFactory
30 [AWT-EventQueue-0] DEBUG net.sf.hibernate.impl.SessionFactoryObjectFactory - initializing class SessionFactoryObjectFactory
50 [AWT-EventQueue-0] DEBUG net.sf.hibernate.impl.SessionFactoryObjectFactory - lookup: uid=4028819af92fa8af00f92fa8b3cb0000
50 [AWT-EventQueue-0] WARN net.sf.hibernate.impl.SessionFactoryObjectFactory - Not found: 4028819af92fa8af00f92fa8b3cb0000
50 [AWT-EventQueue-0] DEBUG net.sf.hibernate.impl.SessionFactoryObjectFactory - {}
50 [AWT-EventQueue-0] DEBUG net.sf.hibernate.impl.SessionFactoryObjectFactory - lookup: name=java:/HibernateFactory
50 [AWT-EventQueue-0] WARN net.sf.hibernate.impl.SessionFactoryObjectFactory - Not found: java:/HibernateFactory
50 [AWT-EventQueue-0] DEBUG net.sf.hibernate.impl.SessionFactoryObjectFactory - {}
java.lang.reflect.UndeclaredThrowableException
at $Proxy1.HiberData(Unknown Source)
at javaPrg.MSSC_MENU.GetCon2(MSSC_MENU.java:575)
at javaPrg.MSSC_MENU$3.actionPerformed(MSSC_MENU.java:128)
-----------------------------------------------------------------
Caused by: java.io.InvalidObjectException: Could not find a SessionFactory named: java:/HibernateFactory
at net.sf.hibernate.impl.SessionFactoryImpl.readResolve(SessionFactoryImpl.java:393)
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)
----------------------------------------------------------------------------------
jboss log out indicate jndi successfully bond
10:40:36,193 INFO [TxConnectionManager] Started jboss.jca:service=LocalTxCM,name=PostgresDS
10:40:36,193 INFO [HibernateServiceMBean] starting service at JNDI name: java:/HibernateFactory
10:40:36,193 INFO [HibernateServiceMBean] service properties: {hibernate.session_factory_name=java:/HibernateFactory, hibernate.transaction.manager_lookup_class=net.sf.hibernate.transaction.JBossTransactionManagerLookup, hibernate.dialect=net.sf.hibernate.dialect.PostgreSQLDialect, hibernate.show_sql=true, hibernate.use_outer_join=false, hibernate.transaction.factory_class=net.sf.hibernate.transaction.JTATransactionFactory, hibernate.connection.datasource=java:/PostgresDS}
10:40:36,353 INFO [Environment] Hibernate 2.1 rc1
10:40:36,383 INFO [Environment] hibernate.properties not found
10:40:36,413 INFO [Environment] using CGLIB reflection optimizer
10:40:36,423 INFO [Configuration] Mapping resource: src/grp.hbm.xml
10:40:37,124 INFO [Binder] Mapping class: src.grp -> grp
10:40:37,525 INFO [Configuration] Mapping resource: src/codemaster.hbm.xml
10:40:37,625 INFO [Binder] Mapping class: src.codemaster -> codemaster
10:40:37,635 INFO [Configuration] processing one-to-many association mappings
10:40:37,635 INFO [Binder] Mapping collection: src.grp.codemaster -> codemaster
10:40:37,645 INFO [Configuration] processing one-to-one association property references
10:40:37,645 INFO [Configuration] processing foreign key constraints
10:40:37,745 INFO [Dialect] Using dialect: net.sf.hibernate.dialect.PostgreSQLDialect
10:40:37,745 INFO [SettingsFactory] Use outer join fetching: false
10:40:37,775 INFO [NamingHelper] JNDI InitialContext properties:{}
10:40:37,795 INFO [DatasourceConnectionProvider] Using datasource: java:/PostgresDS
10:40:37,815 INFO [TransactionFactoryFactory] Transaction strategy: net.sf.hibernate.transaction.JTATransactionFactory
10:40:37,825 INFO [NamingHelper] JNDI InitialContext properties:{}
10:40:37,845 INFO [TransactionManagerLookupFactory] instantiating TransactionManagerLookup: net.sf.hibernate.transaction.JBossTransactionManagerLookup
10:40:37,865 INFO [TransactionManagerLookupFactory] instantiated TransactionManagerLookup
10:40:37,865 INFO [NamingHelper] JNDI InitialContext properties:{}
10:40:37,865 INFO [TransactionManagerLookupFactory] instantiating TransactionManagerLookup: net.sf.hibernate.transaction.JBossTransactionManagerLookup
10:40:37,865 INFO [TransactionManagerLookupFactory] instantiated TransactionManagerLookup
10:40:40,619 INFO [SettingsFactory] Use scrollable result sets: true
10:40:40,619 INFO [SettingsFactory] JDBC 2 max batch size: 15
10:40:40,629 INFO [SettingsFactory] echoing all SQL to stdout
10:40:40,629 INFO [SettingsFactory] Query language substitutions: {}
10:40:40,629 INFO [SettingsFactory] cache provider: net.sf.ehcache.hibernate.Provider
10:40:40,659 INFO [Configuration] instantiating and configuring caches
10:40:41,080 INFO [SessionFactoryImpl] building session factory
10:40:41,961 INFO [SessionFactoryObjectFactory] Factory name: java:/HibernateFactory
10:40:41,961 INFO [NamingHelper] JNDI InitialContext properties:{}
10:40:41,961 INFO [SessionFactoryObjectFactory] Bound factory to JNDI name: java:/HibernateFactory
10:40:41,971 WARN [SessionFactoryObjectFactory] InitialContext did not implement EventContext
10:40:41,971 INFO [NamingHelper] JNDI InitialContext properties:{}
partioal Rel session bean look up to test the factory look up only
try {
Context ctxh = new InitialContext();
Hashtable env = ctxh.getEnvironment();
Object oHiber;
oHiber = ctxh.lookup("java:/HibernateFactory");
//factory=(SessionFactory)PortableRemoteObject.narrow(oHiber,SessionFactory.class);
SessionFactory factory = (SessionFactory) oHiber;
System.out.println("factory= " + factory);
harr.add(factory);
session = factory.openSession();
tx = session.beginTransaction();
}
//---- catch exception errors
---------------------------------------------------
partial client session bean look up procedure
public void GetCon2() {
try {
Context ctx1 = new InitialContext();
env = ctx1.getEnvironment();
Object oRef1;
Object oRef2;
System.out.println(env);
oRef1 = ctx1.lookup("Rel");
System.out.println(oRef1);
System.out.println(oRef1);
RelHome home1 = (RelHome) PortableRemoteObject.narrow(oRef1,
RelHome.class);
System.out.println("home1=" + home1);
Rel remote1;
remote1 = home1.create();
System.out.println("result=" + remote1.HiberData());
}///
etc ....
What I am interested now is whether using local client programme to look up
a hibernate jndi wrapped inside a stateless session bean is in fact a proper way to perfrom the java:/HibernateFactory jndi deployed using SAR
Thanks
|