on 05-07-2014 11:51 AM
Hi,
I've been trying to lookup() MBeanServerConnection object from the JNDI but it returns Null. Initial context is ok.
What am I doing wrong?
Properties p = new Properties();
p.setProperty(Context.INITIAL_CONTEXT_FACTORY, "com.sap.engine.services.jndi.InitialContextFactoryImpl");
p.setProperty(Context.PROVIDER_URL, serverUrl);
p.setProperty(Context.SECURITY_PRINCIPAL, username);
p.setProperty(Context.SECURITY_CREDENTIALS, password);
p.setProperty("force_remote", "true");
String name = "jmx";
Context ctx = new InitialContext(p);
MBeanServerConnection mbs = (MBeanServerConnection) ctx.lookup(name);// returns null
Best regards,
wojtek
Hi,
I see that you are doing EJB lookup from SAP server... keep in mind that if the EJB version is 2.X or below...the looup method will return reference to the HomeInterface. From the HomeInterface object you have to call create() method to get new Bean object.
If its EJB version 3.X then lookup method will return reference to the RemoteInterface. From remote interface you can directly call the business method exposed in that remote interface.
Also verify if you are giving the JNDI name of the bean correctly in the lookup method. You can get it from you server http://<host>:<port>/ejbexplorer
Thanks,
Anand
Message was edited by: Anand V D
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
For standalone java application you need to
1) Add the sap client jar to your java application. You can find it on your sap server in below folder /usr/sap/<SID>/<DB Instance>/j2ee/j2eeclient. Look for the jar file with name sap.com~tc~je~clientlib~impl.jar
2) InitialContext PROVIDER_URL should be in format "<sapserverhost>:<p4port>". You can find the P4 port of you sap system in tcode SMICM and click on services(shift+f1).
Hope it helps.
Thanks,
Anand
Thank you for your help.
I use exception.jar, logging.jar and sapj2eeclient.jar. These are all needed as far as I know. I'm running SAP NW Portal 7.01.
InitialContext connects alright, I can list all JNDI objects on the server. The problem is the lookup() method which returns Null, this is the part which I'm having problems with.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.