Hello help please
I am using JBoss Application Server 4.0.3SP1 . I need an ejb which needs to
connect to Oracle Containers for J2EE 10g (10.1.3.0.0) Developer's Preview 4
and get all the MBeans information from there.
First I tried to connect through the basic Java Program given below, which
needed a application-client.xml in META-INF directory to refer. That worked
fine.
import javax.management.j2ee.*;
import javax.management.*;
import javax.management.remote.*;
import javax.ejb.*;
import javax.naming.*;
import javax.rmi.*;
public class Main {
public static void main(String[] args) throws Exception {
Hashtable props = new Hashtable();
props.put(Context.PROVIDER_URL, "ormi://trainingtest1:23791/default");
props.put(Context.SECURITY_PRINCIPAL, "oc4jadmin");
props.put(Context.SECURITY_CREDENTIALS, "welcome");
props.put(Context.INITIAL_CONTEXT_FACTORY
,"com.evermind.server.ApplicationClientInitialContextFactory");
InitialContext ctx = new InitialContext(props);
Object o = ctx.lookup("java:comp/env/ejb/mgmt/MEJB");
ManagementHome home = (ManagementHome)PortableRemoteObject.narrow(o,
ManagementHome.class);
Management mejb = home.create();
}
}
The Same program when i tried to implement through EJB in JBoss it did not
function. So I tried to implement in servlet first and then in EJB. And also i
kept the application-client.xml file in META-INF directory inside classes
folder. When i try to run the following servlet program by packagin to a ear
file the below given exception is thrown. I cant come out the error. can any
one please help me in comming out of this problem.
the servlet program is
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import javax.naming.*;
import javax.management.j2ee.*;
import javax.management.*;
import javax.management.remote.*;
import javax.ejb.*;
import javax.naming.*;
import javax.rmi.*;
import java.util.*;
public class Test extends HttpServlet {
public void doGet (HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
PrintWriter out=response.getWriter();
String msg="";
try{
Hashtable props = new Hashtable();
props.put(Context.PROVIDER_URL, "ormi://localhost:23791/default");
props.put(Context.SECURITY_PRINCIPAL, "oc4jadmin");
props.put(Context.SECURITY_CREDENTIALS, "welcome");
props.put(Context.INITIAL_CONTEXT_FACTORY
,"com.evermind.server.ApplicationClientInitialContextFactory");
InitialContext ctx = new InitialContext(props);
Object o = ctx.lookup("java:comp/env/ejb/mgmt/MEJB");
ManagementHome home = (ManagementHome)PortableRemoteObject.narrow(o,
ManagementHome.class);
out.flush();
Management mejb = home.create();
}catch(Exception e){
e.printStackTrace();
}
out.println("Done");
out.close();
}
public void destroy(){}
}
javax.naming.NameNotFoundException: ejb not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:514)
at org.jnp.server.NamingServer.getBinding(NamingServer.java:522)
at org.jnp.server.NamingServer.getObject(NamingServer.java:528)
at org.jnp.server.NamingServer.lookup(NamingServer.java:252)
at org.jnp.server.NamingServer.lookup(NamingServer.java:255)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:610)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:701)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at Test.doGet(Test.java:64)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.jboss.web.tomcat.filters.ReplyHeaderFilte
r.doFilter(ReplyHeaderFilter.java:81)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at
org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
at
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:159)
at
org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at
org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
at java.lang.Thread.run(Thread.java:595)
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3928478#3928478
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3928478
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user