[EJB 3.0] - Problem in lookup EJB3.0 using JBOSS4.0.4
by aggarwalanil2004@gmail.com
Hi
I am finding the problem in lookup EJB
I am unable to solve this problem
so,Help me guys.
package com.hqs.ppsadvantage.ejb;
import java.util.Properties;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NameNotFoundException;
import javax.naming.NamingException;
import com.sample.CounterBean;
public class HQSClient {
public static void main(String [] args) {
try {
Context context = getInitialContext();
FileDetailsRemote fileDetailsRemote =
(FileDetailsRemote)context.lookup("FileDetailsSessionBean/remote");
fileDetailsRemote.addFileDetails(10);
System.out.println("class name is : " + fileDetailsRemote.getClass().getName());
}catch(NameNotFoundException ex){
ex.printStackTrace();
}catch (NamingException ex) {
ex.printStackTrace();
}
}
private static Context getInitialContext() throws NamingException {
// Get InitialContext for Embedded OC4J
// The embedded server must be running for lookups to succeed.
Properties env = new Properties();
env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
env.put(Context.PROVIDER_URL, "jnp://127.0.0.1:1099");
env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces" );
Context ctx = new InitialContext(env);
return ctx;
}
}
I am finding the following exception:
javax.naming.NameNotFoundException: FileDetailsSessionBean 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:267)
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:585)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
at sun.rmi.transport.Transport$1.run(Transport.java:153)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
at java.lang.Thread.run(Thread.java:595)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:126)
at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
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 com.hqs.ppsadvantage.ejb.HQSClient.main(HQSClient.java:21)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3976729#3976729
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3976729
19 years, 7 months
[Persistence, JBoss/CMP, Hibernate, Database] - Multiple EntityManagers
by lightbulb432
If you inject multiple EntityManagers into the same class with different persistence units, I assume that would allow for persisting objects to different databases within the same class.
What I'm wondering about is the ability to inject multiple EntityManagers or EntityManagerFactory with the SAME persistence unit in the same class. What purpose might something like this hypothetically serve?
I saw an example where one class had one injected EntityManager of a given persistence unit, and a created EntityManager (from EntityManagerFactory.createEntityManager() where the EntityManagerFactory has the same persistence unit).
What purpose would either of these scenarios have...multiple EntityManagers (either injected directly or through the EntityManagerFactory) with the SAME persistence unit in one class?
I'm confused on this issue because I can't see what the purpose of the same persistence unit would be...couldn't even guess...
Thanks.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3976725#3976725
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3976725
19 years, 7 months
[Management, JMX/JBoss] - jboss.ejb:service=EJBDeployer
by lightbulb432
In the top of the HTML Adaptor view of the webpage for the jboss.ejb:service=EJBDeployer MBean, I see the following title:
MBean Java Class: org.jboss.mx.modelmbean.XMBean
Where is reference to this file made in the corresponding ejb-deployer.xml file in the deploy directory? (Where is JBoss getting org.jboss.mx.modelmbean.XMBean from?)
My second question is what is how can I tell which -deployer.xml files are related to which deployed MBeans, apart from guessing? In this case, I figured that ejb-deployer.xml is the XML file for jboss.ejb:service=EJBDeployer, but how could I know this apart from making the guess? (Is there another mapping file, or a mapping element I'm not seeing in the XML file?)
Please clear up my confusion. Thank you in advance.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3976723#3976723
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3976723
19 years, 7 months