Help me to invoke an EJB deployed in weblogic
700733Jun 21 2010 — edited Feb 27 2020Hi,
I have these EJB's deployed in weblogic. Im not able to invoke it...coz of these roles and permissions associated with it...here's my code and the o/p i got
import java.security.Principal;
import java.util.Hashtable;
import javax.ejb.SessionContext;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
import com.convergys.geneva.j2ee.product.ProductPK;
import com.convergys.geneva.j2ee.product.ProductSession;
import com.convergys.geneva.j2ee.product.ProductSessionHome;
import com.convergys.geneva.j2ee.product.ProductSessionImpl;
public class invoke {
public static void main(String args[]) {
com.convergys.geneva.j2ee.product.ProductSessionHome productSessionHomeobj = null;
com.convergys.geneva.j2ee.product.ProductSession productSession = null;
try {
Hashtable env = new Hashtable();
com.convergys.geneva.j2ee.product.ProductPK ProductPK1=new ProductPK(1);
env.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
env.put(Context.PROVIDER_URL, "t3://172.20.212.252:10000" );
env.put(Context.SECURITY_PRINCIPAL,"wlsadmin");
env.put(Context.SECURITY_CREDENTIALS,"wlsadmin");
InitialContext ic = new InitialContext(env);
System.out.println("Got Initial context" + ic);
Object sless = ic.lookup("Convergys/ECA/Product");
System.out.println("Value of the sless object is :" + sless);
productSessionHomeobj = (ProductSessionHome) PortableRemoteObject.
narrow(sless, ProductSessionHome.class);
System.out.println("before");
SessionContext ses = null;
productSession = productSessionHomeobj.create();
productSession.readAllProductAttributeData_5_1(ProductPK1,1);
} catch(Exception e) {
e.printStackTrace();
}
}
}
and the o/p i got is
Got Initial contextjavax.naming.InitialContext@e1d5ea
Value of the sless object is :IOR:000000000000004a524d493a636f6d2e636f6e7665726779732e67656e6576612e6a3265652e70726f647563742e50726f6475637453657373696f6e486f6d653a303030303030303030303030303030300000000000000100000000000003fc000102000000000f3137322e32302e3231322e3235320000271000000000008c0042454108010300000000077365727665720000000000000000004a524d493a636f6d2e636f6e7665726779732e67656e6576612e6a3265652e70726f647563742e50726f6475637453657373696f6e486f6d653a303030303030303030303030303030300000000000000433333800000000014245412a000000100000000000000000441358834f7da8d000000006000000010000002c00000000000100200000000300010020000100010501000100010100000000030001010000010109050100010000001900000047000000000000003f687474703a2f2f3137322e32302e3231322e3235323a31303030302f6265615f776c735f696e7465726e616c2f636c61737365732f4543412e656172402f00000000001f000000040000000300000020000000040000000100000021000000580000000000000001000000000000002200000000004000000000000806066781020101010000001f0401000806066781020101010000000f7765626c6f67696344454641554c5400000000000000000000000000000000004245410300000248000000000000000c726f756e642d726f62696e000100000000000016436f6e7665726779732e4543412e50726f64756374000000000000010000004a524d493a636f6d2e636f6e7665726779732e67656e6576612e6a3265652e70726f647563742e50726f6475637453657373696f6e486f6d653a303030303030303030303030303030300000000000000100000000000001ac000102000000000f3137322e32302e3231322e3235320000271000000000008c0042454108010300000000077365727665720000000000000000004a524d493a636f6d2e636f6e7665726779732e67656e6576612e6a3265652e70726f647563742e50726f6475637453657373696f6e486f6d653a303030303030303030303030303030300000000000000433333800000000014245412a000000100000000000000000441358834f7da8d000000005000000010000002c00000000000100200000000300010020000100010501000100010100000000030001010000010109050100010000001900000047000000000000003f687474703a2f2f3137322e32302e3231322e3235323a31303030302f6265615f776c735f696e7465726e616c2f636c61737365732f4543412e656172402f00000000001f000000040000000300000020000000040000000100000021000000580000000000000001000000000000002200000000004000000000000806066781020101010000001f0401000806066781020101010000000f7765626c6f67696344454641554c540000000000000000000000000000000000000000004f7da8d0
before
java.rmi.AccessException: CORBA NO_PERMISSION 0 Maybe; nested exception is:
org.omg.CORBA.NO_PERMISSION: vmcid: 0x0 minor code: 0 completed: Maybe
at com.sun.corba.se.impl.javax.rmi.CORBA.Util.mapSystemException(Unknown Source)
at javax.rmi.CORBA.Util.mapSystemException(Unknown Source)
at com.convergys.geneva.j2ee.product._ProductSessionHome_Stub.create(Unknown Source)
at invoke.main(invoke.java:46)
Caused by: org.omg.CORBA.NO_PERMISSION: vmcid: 0x0 minor code: 0 completed: Maybe
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at com.sun.corba.se.impl.protocol.giopmsgheaders.MessageBase.getSystemException(Unknown Source)
at com.sun.corba.se.impl.protocol.giopmsgheaders.ReplyMessage_1_2.getSystemException(Unknown Source)
at com.sun.corba.se.impl.protocol.CorbaMessageMediatorImpl.getSystemExceptionReply(Unknown Source)
at com.sun.corba.se.impl.protocol.CorbaClientRequestDispatcherImpl.processResponse(Unknown Source)
at com.sun.corba.se.impl.protocol.CorbaClientRequestDispatcherImpl.marshalingComplete(Unknown Source)
at com.sun.corba.se.impl.protocol.CorbaClientDelegateImpl.invoke(Unknown Source)
at org.omg.CORBA.portable.ObjectImpl._invoke(Unknown Source)
... 2 more
Is there some kind of security in ejb?. If so how can do it? Kindly help