Now the code in servlet works. I wrote in servlet init method
| InitialContext context = new InitialContext();
| DataSource ds = (DataSource)context.lookup("java:/FIrebirdDS");
| Connection con = ds.getConnection();
| Statement st=con.createStatement();
| ResultSet rs=st.executeQuery("select * from person");
|
Everything works fine, there are proper data in ResultSet after executing st.executeQuery
method. So, FIrebirdDS works. But the old problem stays. In the same servlet init method I
try to use my EJB:
| Object ref = context.lookup("ejb/Person");
| home = (Person) ref;
|
Again, it works, I can then execute the business method of my PersonBean. But when inside
PersonBean EJB I uncomment the line
//@PersistenceContext EntityManager em;
I get an exception
8:50:56,093 ERROR [STDERR] javax.naming.NameNotFoundException: ejb not bound
18:50:56,093 ERROR [STDERR] at
org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
18:50:56,093 ERROR [STDERR] at
org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
18:50:56,093 ERROR [STDERR] at
org.jnp.server.NamingServer.getObject(NamingServer.java:543)
18:50:56,093 ERROR [STDERR] at org.jnp.server.NamingServer.lookup(NamingServer.java:267)
18:50:56,093 ERROR [STDERR] at
org.jnp.interfaces.NamingContext.lookup(NamingContext.java:625)
18:50:56,093 ERROR [STDERR] at
org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
18:50:56,093 ERROR [STDERR] at
javax.naming.InitialContext.lookup(InitialContext.java:351)
18:50:56,093 ERROR [STDERR] at web.ComputeServlet.init(ComputeServlet.java:56)
18:50:56,093 ERROR [STDERR] at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1105)
...
where
web.ComputeServlet.init(ComputeServlet.java:56)
is line
Object ref = context.lookup("ejb/Person");
of my servlet.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4008868#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...