what's wrong,my ejb example?
I programed a example of sesion bean whit jbuilder4.0+weblogic5.1,but when ran project,some problems were showed in the server Tab :
java.security.AccessControlException: access denied (java.lang.RuntimePermission createSecurityManager)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:272)
at java.security.AccessController.checkPermission(AccessController.java:399)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:545)
at java.lang.SecurityManager.<init>(SecurityManager.java:301)
at weblogic.boot.ServerSecurityManager.<init>(ServerSecurityManager.java:11)
at weblogic.Server.main(Server.java:59)
at weblogic.Server.main(Server.java:55)
Exception in thread "main"
i didn't understand these information.
please tell me what's wrong and method to slove it.
thanks.
[922 byte] By [
airfei] at [2007-9-26 1:45:42]

Check for the permissions in weblogic.properties and weblogic.policy files .
msyal at 2007-6-29 2:42:33 >

thank you very muchlet me have a look.
what is your code trying to do?
ulase at 2007-6-29 2:42:33 >

i want to print a sentence,and coding is easy.
==============================
package ejbtest;
import java.rmi.*;
import javax.ejb.*;
public class ETBean implements SessionBean {
private SessionContext sessionContext;
public void ejbCreate() {
}
public void ejbRemove() {
}
public void ejbActivate() {
}
public void ejbPassivate() {
}
public void setSessionContext(SessionContext context) {
sessionContext = context;
}
//my coding
public String getETName(){
return "Hello,EJB!";
}
}
=========================
in the ejb client test
public ClientSB() {
try {
//get naming context
Context ctx = getInitialContext();
//look up jndi name
Object ref = ctx.lookup("ETHome");
//cast to Home interface
eTHome = (ETHome) PortableRemoteObject.narrow(ref, ETHome.class);
//my coding
ET et=eTHome.create();
String t=et.getETName();
System.out.println("I study EJB."+t);
}
catch(Exception e) {
e.printStackTrace();
}
}
i think there are some problems at the configuration about jbuiler4.0+weblogic5.1,but i set up step by step
in accordance with the file on the netsite.
i'm very anxious,please do me a favour.thank you!!!
The problem is with the JNDI.For the Lookup u need to set up the system proerties and the server.
cause the BJB is residing in the server.
follow this code **** wrt the client
String url= "t3://localhost:7001";
try {
Properties h = new Properties();
h.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
h.put(Context.PROVIDER_URL, url);
h.put(Context.SECURITY_PRINCIPAL, "system");
h.put(Context.SECURITY_CREDENTIALS, "administrator");// system password
Context ctx = new InitialContext(h);
HelloEJBHome objHome = (HelloEJBHome)ctx.lookup("HelloServerEJB");
HelloEJBRemote remote = (HelloEJBRemote)objHome.create();
} catch (Exception ex) {
System.err.println("Caught an exception." );
ex.printStackTrace();
}
for executing the client set the classpath which add the following jar' and classes.
weblogicaux.jar and weblogic\classes
E:\weblogic\lib\unpacked_jars\jndi.jar
E:\weblogic\classes\
E:\weblogic\lib\weblogicaux.jar
Make sure ur JNDI matches with the client and deployed without error's
best of luck
The problem is with the JNDI.For the Lookup u need to set up the system proerties and the server.
cause the BJB is residing in the server.
follow this code **** wrt the client
String url= "t3://localhost:7001";
try {
Properties h = new Properties();
h.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
h.put(Context.PROVIDER_URL, url);
h.put(Context.SECURITY_PRINCIPAL, "system");
h.put(Context.SECURITY_CREDENTIALS, "administrator");// system password
Context ctx = new InitialContext(h);
HelloEJBHome objHome = (HelloEJBHome)ctx.lookup("HelloServerEJB"); // change the Home Name
HelloEJBRemote remote = (HelloEJBRemote)objHome.create(); // change the Remote Name
// remote.getETName(); // ur method.
} catch (Exception ex) {
System.err.println("Caught an exception." );
ex.printStackTrace();
}
for executing the client set the classpath which add the following jar' and classes.
weblogicaux.jar and weblogic\classes
E:\weblogic\lib\unpacked_jars\jndi.jar
E:\weblogic\classes\
E:\weblogic\lib\weblogicaux.jar
Make sure ur JNDI matches with the client and deployed without error's
this should work,
best of luck
The problem is with the JNDI.For the Lookup u need to set up the system properties and the server.
cause the EJB is residing in the server.
follow this code **** wrt the client
String url= "t3://localhost:7001"; // Default or ur server name while setting up the server
try {
Properties h = new Properties();
h.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
h.put(Context.PROVIDER_URL, url);
h.put(Context.SECURITY_PRINCIPAL, "system");
h.put(Context.SECURITY_CREDENTIALS, "administrator");// system password
Context ctx = new InitialContext(h);
HelloEJBHome objHome = (HelloEJBHome)ctx.lookup("HelloServerEJB"); // change the Home Name and the JNDI name
HelloEJBRemote remote = (HelloEJBRemote)objHome.create(); // change the Remote Name
// remote.getETName(); // ur method.
} catch (Exception ex) {
System.err.println("Caught an exception." );
ex.printStackTrace();
}
for executing the client set the classpath which add the following jar' and classes.
weblogicaux.jar and weblogic\classes
E:\weblogic\lib\unpacked_jars\jndi.jar
E:\weblogic\classes\
E:\weblogic\lib\weblogicaux.jar
Make sure ur JNDI matches with the client and deployed without error's
this should work,
best of luck
