Ta SessionFactory asi neni bindnuta v JNDI. Nekde pri startu app serveru nebo aplikace musite
spustit nejaky kod ktery vytvori tu SessionFactory podle hibernate.properties.
Pri vytvareni se pak ta fatory bindne do JNDI (to uz tusim udela hibernate sam podle instrukci
v hibernate.properties)

Jeste se mne prilis nezda ze v hibernate.properties mate nastaven jak Datasource tak i prime pripojeni
do DB. Podle me by Vam melo stacit nastavit jen hibernate.dialect a hibernate.connection.datasource.

Vlastik.

Jiri Smejkal napsal(a):

Prosím o radu, zkouším propojení struts-hibernate3-db sybase na aplikačním serveru Sun Java System Application Server 8.1. Omlouvám se za začátečnický dotaz, určitě mi chybí něco na aplikačním serveru:

 

Děkuji moc.     

 

 

Webová aplikace.

xxxAction struts mám:

 

 Context init = new InitialContext();

             Context ctx = (Context) init.lookup("java:/hibernate/SessionFactory");

             SessionFactory sf = (SessionFactory) ctx.lookup("moje");

             hibSession = sf.openSession();

 

chyba:

 

javax.naming.NameNotFoundException: No object bound to name java:/hibernate/SessionFactory

        at com.sun.enterprise.naming.NamingManagerImpl.lookup(NamingManagerImpl.java:668)

        at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.java:155)

        at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:288)

        at javax.naming.InitialContext.lookup(InitialContext.java:351)

 

Definice:

hibernate.properties

 

## JNDI Datasource

hibernate.connection.datasource java:/comp/env/jdbc/asa

hibernate.connection.username dba

hibernate.connection.password sql

## Sybase

hibernate.dialect org.hibernate.dialect.SybaseDialect

hibernate.connection.driver_class com.sybase.jdbc2.jdbc.SybDriver

hibernate.connection.username dba

hibernate.connection.password sql

hibernate.connection.url jdbc:sybase:Tds:localhost:2638/webbec

## specify a JNDI name for the SessionFactory

hibernate.session_factory_name java:hibernate/SessionFactory/moje

## specify a JNDI name for the SessionFactory

hibernate.session_factory_name java:hibernate/SessionFactory/moje

#file system

hibernate.jndi.class com.sun.jndi.fscontext.RefFSContextFactory

hibernate.jndi.url iiop://localhost:3700/

 

 

 

 

 

 


 
  Obsah této zásilky byl zkontrolován na přítomnost virů technologií BitDefender
  Odesláno 602LAN SUITE - http://www.software602.cz/
 

-- 
Ing. Vlastimil Elias                        Qbizm technologies, a.s.
vedouci analytik                            ... the art of software.
____________________________________________________________________
www.qbizm-technologies.cz    www.qbizm.cz      www.qbizm-services.cz


Odpovedet emailem