Dear All,
I tried to implement web service. I use Java
MulticastSocket to do publish-subscribe communication.
Service is subscriber, the third part, not web service
client, is publisher.
So in service side, I use a groupIpAddres (224.9.9.2 )
and port (10020) to create a MulticastSocket to do
subscibing. When I test service function, there
existed some following errors for MulticastSocket to
join group. The error information is from server log.
at
com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:281)
at
com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:83)
Caused by: java.security.AccessControlException:
access denied (java.net.SocketPermission 224.9.9.2
connect,accept,resolve)
at
java.security.AccessControlContext.checkPermission(AccessControlContext.java:264)
at
java.security.AccessController.checkPermission(AccessController.java:427)
at
java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
at
java.lang.SecurityManager.checkMulticast(SecurityManager.java:1188)
at
java.net.MulticastSocket.joinGroup(MulticastSocket.java:269)
The error information indicates that the problem is :
java.security.AccessControlException: access denied
(java.net.SocketPermission 224.9.9.2
connect,accept,resolve).
Actually If I do not web service, it does work very
well. This means that java web service has some
special limits to access 224.*.*.* address. Thank you
so much.
Yin
The java source code are as
follows:
try{
groupAddress =
InetAddress.getByName(MULTICAST_ADDR);
}catch (IOException e){
System.out.println("error in getting group
address by Name:\t");
}
try{
multiSocket = new
MulticastSocket(MULTICAST_PORT);
System.out.println("Successfully create a
MulticastSocket:\t");
}catch (IOException e){
System.out.println("error in defining
MulticastSocket:\t");
System.out.println("MultiSocket Error.");
}
try{
multiSocket.joinGroup(groupAddress);
System.out.println("Successfully joining the
Group:\t"+groupAddress);
}catch (IOException e){
System.out.println("error in joining the
Group:\t");
}
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com