Hi Dims,
Thanks for the response.
I managed to figure out what is causing this issue last night. Note the
source code is using
an endpoint with a host of "localhost". This is the first error. Of
course you would think that this
would work fine as long as you were working only on the localhost. But
since I am developing
a WEB application that happens to require SOAP I should not have
programmed the endpoint
for "localhost".
Still not clear why this hostname would have been a problem. At any rate
I would recommend not using localhost at all, even if you are just
testing locally.
The last issue was that I needed to sign the client jar file. In my
case it was the TestClient.jar applet jar
file containing the class file representing the source provided below.
I also had to setup a .java.policy file
in my home directory. This required that I come up to speed with the
keytool and jarsigner applications
(Java security 101.)
Here is the text of the policy file I am using.
******** .java.policy file ***********
/* AUTOMATICALLY GENERATED ON Tue Nov 01 15:53:06 EST 2005*/
/* DO NOT EDIT */
keystore "file:/Users/pgonia/phils_store";
grant signedBy "pgonia" {
permission java.security.AllPermission;
};
************************************
The line pointing to a keystore is not required. I decided to create a
client keystore and import
the public key part of the certificate I used to sign my applet jar
file. What this does is prevent the
browser from popping up the certificate dialog for the users review and
acceptance. I used AllPermission
because it was not clear what was needing cleared by the security
manage (based on the stacktrace.)
Once I had this done and included all required jar files in the applet
tag (see below) the TestClient applet runs
without any problems.
Here is the new applet tag:
<applet code="testclient.TestClient.class"
archive="/TestClient/DVA/TestClient.jar,/TestClient/DVA/axis.jar,
/TestClient/DVA/jaxrpc.jar,/TestClient/DVA/commons-logging-1.0.4.jar,
/TestClient/DVA/commons-discovery-0.2.jar,/TestClient/DVA/saaj.jar,
/TestClient/DVA/xercesImpl.jar,/TestClient/DVA/xml-apis.jar"
height="600"
width="800">
</applet>
All of the listed jar files are required by this little Axis aware
applet application. Needless to say, Axis
is a heavy tool so make be sure you eat your spinach before using this
bar of SOAP. :-)
BTW, here is a few links I used to come up to speed on Java security
and which provided the needed
skills to correct this issue.
http://www.ericsson.com/mobilityworld/sub/open/technologies/
open_development_tips/docs/odt_sign_applets
http://java.sun.com/products/javawebstart/1.2/docs/developersguide.html
The best link for this topic:
http://java.sun.com/docs/books/tutorial/security1.2/toolsign/index.html
Axis, a slippery slope or just very clean? Keep it clean, use Axis.
Phil
On Nov 1, 2005, at 3:07 PM, Davanum Srinivas wrote:
Philip,
Can you please try this tip?
http://marc.theaimsgroup.com/?l=axis-dev&m=112300337608595&w=2
thanks,
dims
On 10/31/05, Gonia, Philip T <[EMAIL PROTECTED]> wrote:
******** Source Code *************
/*
* TestClient.java
*
* Created on October 28, 2005, 4:20 PM
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package testclient;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import javax.xml.namespace.QName;
/**
* Based on the TestClient code provided by the Apache Axis project.
Axis
* version 1.3. (User Guide -- "Consuming Web Services with Axis")
*
* The intent of this applet is to test Axis support for Applet
applications.
* This will in turn support the WEB Enabling of the Visitor
Information Centers
* Robotic hardware systems for educational out reach.
*/
public class TestClient extends java.applet.Applet {
// Points to where our service is located.
private static String endpoint =
"http://localhost:8080/axis/services/echo";
/** Initialization method that will be called after the applet is
loaded
* into the browser.
*/
public void init() {
System.out.println("\n**********\nStarting up!\n");
makeSoapCall("Hello!");
System.out.println("\n**********\n");
}
// Makes a call to the defined endpoint. In this case the echo
service.
private static void makeSoapCall( String message ){
String my_Message = message;
try{
Service serv = new Service();
Call theCall = (Call) serv.createCall();
theCall.setTargetEndpointAddress( new java.net.URL(
endpoint ));
theCall.setOperationName(new
QName("http://soapinterop.org/", "echoString"));
String ret = (String) theCall.invoke( new Object[] {
my_Message } );
System.out.println("Sent 'Hello!', got '" + ret + "'");
}
catch( Exception error){
System.err.println( error.toString());
}
}
}
****************************
******** Error Message ************
**********
Starting up!
java.lang.ExceptionInInitializerError
at
org.apache.commons.discovery.jdk.JDKHooks.<clinit>(JDKHooks.java:75)
at
org.apache.commons.discovery.tools.DiscoverSingleton.find(DiscoverSing
le
ton.java:412)
at
org.apache.commons.discovery.tools.DiscoverSingleton.find(DiscoverSing
le
ton.java:378)
at
org.apache.axis.components.logger.LogFactory$1.run(LogFactory.java:45)
at java.security.AccessController.doPrivileged(Native Method)
at
org.apache.axis.components.logger.LogFactory.getLogFactory(LogFactory.
ja
va:41)
at
org.apache.axis.components.logger.LogFactory.<clinit>(LogFactory.java:
33)
at
org.apache.axis.handlers.BasicHandler.<clinit>(BasicHandler.java:43)
at
org.apache.axis.client.Service.getAxisClient(Service.java:104)
at org.apache.axis.client.Service.<init>(Service.java:113)
at testclient.TestClient.makeSoapCall(TestClient.java:40)
at testclient.TestClient.init(TestClient.java:30)
at sun.applet.AppletPanel.run(AppletPanel.java:354)
at java.lang.Thread.run(Thread.java:552)
Caused by: java.security.AccessControlException: access denied
(java.lang.RuntimePermission createClassLoader)
at
java.security.AccessControlContext.checkPermission(AccessControlContex
t.
java:269)
at
java.security.AccessController.checkPermission(AccessController.java:
401)
at
java.lang.SecurityManager.checkPermission(SecurityManager.java:524)
at
java.lang.SecurityManager.checkCreateClassLoader(SecurityManager.java:
586)
at java.lang.ClassLoader.<init>(ClassLoader.java:210)
at
org.apache.commons.discovery.jdk.PsuedoSystemClassLoader.<init>(Psuedo
Sy
stemClassLoader.java:73)
at
org.apache.commons.discovery.jdk.JDK12Hooks.findSystemClassLoader(JDK1
2H
ooks.java:215)
at
org.apache.commons.discovery.jdk.JDK12Hooks.<clinit>(JDK12Hooks.java:
73)
... 14 more
*******************************************