[jboss-user] [JNDI/Naming/Network] - javax.naming.NameNotFoundException hibernate service
GBlack
do-not-reply at jboss.com
Fri Jan 19 02:24:33 EST 2007
Hello everybody,
I am learning server technology and now I want to do small application. JSF - EJB2 - Hibernate - MySQL.
I defined this mbean in my .har
| <server>
| <mbean code="org.jboss.hibernate.jmx.Hibernate"
| name="sprava:name=MySqlSessionFactory">
| <attribute name="DatasourceName">java:/MySqlDS</attribute>
| <attribute name="Dialect">
| org.hibernate.dialect.MySQLDialect
| </attribute>
| <attribute name="SessionFactoryName">
| java:/hibernate/MySqlSessionFactory
| </attribute>
| <attribute name="ShowSqlEnabled">true</attribute>
| </mbean>
| </server>
|
During the deploying look all fine. And it ends
2007-01-19 07:54:11,206 INFO [org.jboss.hibernate.jmx.Hibernate] SessionFactory successfully built and bound into JNDI [java:/hibernate/MySqlSessionFactory]
I write in my EJBBean this code
| try {
| InitialContext ctx = new InitialContext();
| this.factory = (SessionFactory) ctx
| .lookup("java:/hibernate/MySessionFactory");
| } catch (Exception e) {
| throw new RuntimeException("ulozEJB", e);
| }
|
| TNepritomnost novy = new TNepritomnost();
| novy.setDatum_od(d_od);
| novy.setDatum_do(d_do);
| novy.setZkratkaPracovnika(zkr);
| novy.setDuvod(duv);
| novy.setSpzAuta(spz);
| novy.setPoznamka(pozn);
| novy.setPocetObedu(obedy);
|
| Session session = this.factory.openSession();
| Transaction transaction = session.beginTransaction();
| session.save(novy);
| transaction.commit();
| session.close();
|
But red row throw
javax.naming.NameNotFoundException: MySessionFactory not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
at org.jnp.server.NamingServer.lookup(NamingServer.java:296)
at org.jnp.server.NamingServer.lookup(NamingServer.java:270)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:625)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at sprava.web.TestDSBean.uloz(TestDSBean.java:63)
I mean that I should wirte some reference from ejb to hibernate mbean service but I don't know how.
Please help me or send any link for more information. I was finding it here and in wiki too but not succesfully.
Thanks for your time.
Georg Black.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4003672#4003672
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4003672
More information about the jboss-user
mailing list