|
From: FReAK La M. <fre...@qu...> - 2003-02-12 14:43:17
|
Hi there,
I am new to the wrapper and new to this list, so I have to say hello
everybody.
Now there's my problem.
I wanted to thest the wrapper using a small RMI application. I have a
server program that reads names from a properties file and the clients can
ask the server for names.
Wehn I run the program without the wrapper, everything is fine, but when I
run it using the wrapper, I get following messages.
>Wrapper.exe -c conf\wrapper.conf
wrapper | --> Wrapper Started as Console
wrapper | Launching a JVM...
jvm 1 | Wrapper (Version 2.2.9)
jvm 1 |
jvm 1 | reading names.properties
jvm 1 | ERROR while reading names.properties
jvm 1 | java.security.AccessControlException: access denied
(java.io.FilePerm
ission .\names.properties read)
wrapper | <-- Wrapper Stopped
I have following policyfile
grant {
permission java.security.AllPermission;
permission java.io.FilePermission "<<ALL FILES>>", "read, write, delete,
execute";
permission java.net.SocketPermission "*:1024-65535","connect,accept";
permission java.net.SocketPermission "*:80", "connect";
};
that should grant allPermission and more :-)
My config file looks that way:
wrapper.java.command=java
wrapper.java.mainclass=com.silveregg.wrapper.WrapperSimpleApp
wrapper.java.classpath.1=./lib/wrapper.jar
wrapper.java.classpath.2=./
wrapper.java.library.path.1=./lib/
wrapper.java.additional.1=-Djava.security.policy=RMI.policy
wrapper.java.initmemory=16
wrapper.java.maxmemory=64
wrapper.app.parameter.1=Server
wrapper.port=1777
for starting the program on the console I have to type "java
-Djava.security.policy=RMI.policy Server"
Hope someone can help and thank you for reading,
FReAK
Oh, last but not least, that is my Server program
import java.io.*;
import java.rmi.Naming;
import java.rmi.RMISecurityManager;
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
import java.util.*;
public class Server extends UnicastRemoteObject implements
RMIPropertiesReader
{
Properties names;
public Server() throws RemoteException
{
readNames();
}
private void readNames()
{
System.out.println("reading names.properties");
names = new Properties();
try
{
FileInputStream namesFile = new
FileInputStream("./names.properties");
names.load(namesFile);
}
catch (Exception e)
{
System.out.println("ERROR while reading names.properties\n"+e);
System.exit(1);
}
System.out.println("done reading names.properties");
}
public String getName(String id) throws RemoteException
{
return names.getProperty(id);
}
public static void main(String[] args)
{
if (System.getSecurityManager() == null) {
System.setSecurityManager(new RMISecurityManager());
}
String name = "//10.0.0.11/RMIPropertiesReader";
try
{
RMIPropertiesReader reader = new Server();
Naming.rebind(name, reader);
System.out.println("RMIPropertiesReader bound");
//System.out.println(reader.getName("sample.name.1"));
}
catch(Exception e)
{
System.err.println("ComputeEngine exception: " +
e.getMessage());
e.printStackTrace();
}
}
}
_____________________________________________
Free email with personality! Over 200 domains!
http://www.MyOwnEmail.com
Looking for friendships,romance and more?
http://www.MyOwnFriends.com
|