[jboss-user] [JNDI/Naming/Network] - Re: jndi jboss service problem connecting
ByDcc
do-not-reply at jboss.com
Sat Nov 3 04:24:17 EDT 2007
Well, I tried many names but the result is always the same.
Global JNDI Namespace
| ....
| +- ConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)
| ....
| +- persistence.units:unitName=cartstore (class: org.hibernate.impl.SessionFactoryImpl)
| ...
| +- CartstoreFactory (class: org.jboss.ejb3.entity.InjectedEntityManagerFactory)
My code
| Object obj=ic.lookup("cartstore");
| Object obj1=ic.lookup("persistence.units:unitName=cartstore");
| Object obj2=ic.lookup("ConnectionFactory");
|
| EntityManagerFactory em = (EntityManagerFactory) ic.lookup("CartstoreFactory");
|
| CategoryEntity ce = new CategoryEntity();
| ce.setCreationDate(new Timestamp( Calendar.getInstance().getTimeInMillis() ) );
| ce.setDescription("pppppp");
| ce.setKeyName("lllllll");
| ce.setName("oooooooo");
|
| em.createEntityManager().persist(ce);
obj is null
obj1 is null
obj2 is NOT null. I have a reference to an object.
And the last line throws a NullPointerException.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4101512#4101512
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4101512
More information about the jboss-user
mailing list