• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Applet Axis Client Errors

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Help!

I'm having issues with an applet I'm trying to build and no matter what advice I have found over the past 2 days, nothing seems to work.

I have built an applet in Eclipse using web services (so there are multiple jars involved). When I run the .java file as an applet in Eclipse, it works fine. But, when I embed the applet within html, I get errors. See below:

Exception in thread "AWT-EventQueue-3" java.lang.NoClassDefFoundError: Could not initialize class org.apache.axis.client.AxisClient
at org.apache.axis.client.Service.getAxisClient(Service.java:104)
at org.apache.axis.client.Service.<init>(Service.java:113)
at com.ngc.bmc2.tis.image.axis.service.ImageServiceLocator.<init>(ImageServiceLocator.java:12)
at com.ngc.bmc2.tis.image.axis.service.ImageServicePortTypeProxy._initImageServicePortTypeProxy(ImageServicePortTypeProxy.java:18)
at com.ngc.bmc2.tis.image.axis.service.ImageServicePortTypeProxy.<init>(ImageServicePortTypeProxy.java:8)
at com.ngc.sb.tis.image.axis.service.client.TisImageryClient.paint(TisImageryClient.java:18)
at sun.awt.RepaintArea.paintComponent(Unknown Source)
at sun.awt.RepaintArea.paint(Unknown Source)
at sun.awt.windows.WComponentPeer.handleEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Exception in thread "AWT-EventQueue-4" java.lang.NoClassDefFoundError: Could not initialize class org.apache.axis.client.AxisClient
at org.apache.axis.client.Service.getAxisClient(Service.java:104)
at org.apache.axis.client.Service.<init>(Service.java:113)
at com.ngc.bmc2.tis.image.axis.service.ImageServiceLocator.<init>(ImageServiceLocator.java:12)
at com.ngc.bmc2.tis.image.axis.service.ImageServicePortTypeProxy._initImageServicePortTypeProxy(ImageServicePortTypeProxy.java:18)
at com.ngc.bmc2.tis.image.axis.service.ImageServicePortTypeProxy.<init>(ImageServicePortTypeProxy.java:8)
at com.ngc.sb.tis.image.axis.service.client.TisImageryClient.paint(TisImageryClient.java:18)
at sun.awt.RepaintArea.paintComponent(Unknown Source)
at sun.awt.RepaintArea.paint(Unknown Source)
at sun.awt.windows.WComponentPeer.handleEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
-----------------------------------------------------------------------

Here is my directory structure:

C:\~~~~\EclipseProject\WebContent\Applet --> index.html file
C:\~~~~\EclipseProject\WebContent\Applet\classes --> class files from both my web service client and the web service
C:\~~~~\EclipseProject\WebContent\Applet\lib --> jar files of the applet and web service

------------------------------------------------------------------------

Here is the html code:

<html>
<title>Applet Test</title>
<body>
<h1>Applet Test</h1>
<applet codebase="classes" code="com.ngc.sb.tis.image.axis.service.client.TisImageryClient.class"
height="300" width="300" archive="../lib/applet.jar,../lib/axis.jar,../lib/jaxrpc.jar,
../lib/commons-discovery-0.2.jar,../lib/commons-logging.jar,../lib/saaj.jar,../lib/wsdl4j-1.5.1.jar">
</applet>
</body>
</html>

-------------------------------------------------------------------------

I thought that it might be a java version issue since the applet I created was in 1.6 and the web service was based on 1.5, but that cannot be right because it would not have worked when I ran it in Eclipse.

Any help would be appreciated because I have been killing myself for two straight days on this trying to find the answer.

If any other information is needed please let me know.

Thanks,
B
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Shouldn't all the "../lib/applet.jar" entries really be "lib/applet.jar" instead, since the lib directory is in the same directory as the HTML file?
 
Brendan Crisler
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I didn't think so, since I set my codebase attribute as classes which is within the Applet directory.

Even still, I tried changing it to "lib/applet.jar" instead of "../lib/applet.jar" and this time I got:

Exception in thread "AWT-EventQueue-3" java.lang.NoClassDefFoundError: javax/xml/rpc/ServiceException
at com.ngc.sb.tis.image.axis.service.client.TisImageryClient.paint(TisImageryClient.java:18)
at sun.awt.RepaintArea.paintComponent(Unknown Source)
at sun.awt.RepaintArea.paint(Unknown Source)
at sun.awt.windows.WComponentPeer.handleEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: javax.xml.rpc.ServiceException
at sun.applet.AppletClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
... 14 more


Which leads me to believe that it could not find the jaxrpc.jar file.

Thanks though.
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I didn't think so, since I set my codebase attribute as classes which is within the Applet directory.



Let me rephrase it not as question but as a hint : You do need to change it in the way I indicated, because the archive attribute and the codebase attribute are independent of each other.

Even still, I tried changing it to "lib/applet.jar" instead of "../lib/applet.jar" and this time I got:
...
Which leads me to believe that it could not find the jaxrpc.jar file.


You need to change all the other jar file locations in the same way.
 
Brendan Crisler
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry for the confusion, but when I said:

Even still, I tried changing it to "lib/applet.jar" instead of "../lib/applet.jar"

I meant that I did change all of them.
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also make sure that none of the files has any permissions set that would prevent it from being served (try downloading through the browser).

A last resort is a look at the web server access logs, to see which files the browser is trying to access, and whether or not it's succeeding.
 
Brendan Crisler
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, checked the permissions on all of the jar files and they seem fine. I was also able to navigate through the web browser and download several jar files just to check the directory locations worked fine, with no errors. I changed the directory locations for all the jars in the archive back to "../lib/<file>". According to the error and access logs on my Apache server, there are no errors. The GETs know where to pull the jar files from and I don't see any errors. Here are the Apache server logs:

Access.log
---------------------------------------------------
127.0.0.1 - - [18/Mar/2008:15:11:50 -0500] "GET /Applet HTTP/1.1" 301 237
127.0.0.1 - - [18/Mar/2008:15:11:50 -0500] "GET /Applet/ HTTP/1.1" 200 396
127.0.0.1 - - [18/Mar/2008:15:11:50 -0500] "GET /Applet/lib/applet.jar HTTP/1.1" 304 -
127.0.0.1 - - [18/Mar/2008:15:11:50 -0500] "GET /Applet/lib/axis.jar HTTP/1.1" 304 -
127.0.0.1 - - [18/Mar/2008:15:11:50 -0500] "GET /Applet/lib/jaxrpc.jar HTTP/1.1" 304 -
127.0.0.1 - - [18/Mar/2008:15:11:50 -0500] "GET /Applet/lib/commons-discovery-0.2.jar HTTP/1.1" 304 -
127.0.0.1 - - [18/Mar/2008:15:11:50 -0500] "GET /Applet/lib/commons-logging.jar HTTP/1.1" 304 -
127.0.0.1 - - [18/Mar/2008:15:11:50 -0500] "GET /Applet/lib/saaj.jar HTTP/1.1" 304 -
127.0.0.1 - - [18/Mar/2008:15:11:50 -0500] "GET /Applet/lib/wsdl4j-1.5.1.jar HTTP/1.1" 304 -
127.0.0.1 - - [18/Mar/2008:15:11:50 -0500] "GET /Applet/classes/com/ngc/sb/tis/image/axis/service/client/TisImageryClient.class HTTP/1.1" 304 -
127.0.0.1 - - [18/Mar/2008:15:11:50 -0500] "GET /Applet/classes/com/ngc/bmc2/tis/image/axis/service/ImageServicePortTypeProxy.class HTTP/1.1" 304 -
127.0.0.1 - - [18/Mar/2008:15:11:50 -0500] "GET /Applet/classes/com/ngc/bmc2/tis/image/axis/service/ImageServicePortType.class HTTP/1.1" 304 -
127.0.0.1 - - [18/Mar/2008:15:11:50 -0500] "GET /favicon.ico HTTP/1.1" 200 1772
127.0.0.1 - - [18/Mar/2008:15:11:50 -0500] "GET /Applet/classes/com/ngc/bmc2/tis/image/axis/service/ImageServiceLocator.class HTTP/1.1" 304 -
127.0.0.1 - - [18/Mar/2008:15:11:50 -0500] "GET /Applet/classes/com/ngc/bmc2/tis/image/axis/service/ImageService.class HTTP/1.1" 304 -

--------------------------------------
Error.log
---------------------------------------
[Tue Mar 18 15:11:17 2008] [notice] Apache/2.2.6 (Win32) PHP/5.2.5 configured -- resuming normal operations
[Tue Mar 18 15:11:17 2008] [notice] Server built: Sep 5 2007 08:58:56
[Tue Mar 18 15:11:17 2008] [notice] Parent: Created child process 1848
[Tue Mar 18 15:11:17 2008] [notice] Child 1848: Child process is running
[Tue Mar 18 15:11:17 2008] [notice] Child 1848: Acquired the start mutex.
[Tue Mar 18 15:11:17 2008] [notice] Child 1848: Starting 250 worker threads.
[Tue Mar 18 15:11:17 2008] [notice] Child 1848: Starting thread to listen on port 8080.
------------------------------------------

So.... when I try to load the applet again from the browser, this shows up in my Java Console:

Exception in thread "AWT-EventQueue-3" java.lang.ExceptionInInitializerError
at org.apache.commons.discovery.jdk.JDKHooks.<clinit>(JDKHooks.java:75)
at org.apache.commons.discovery.tools.DiscoverSingleton.find(DiscoverSingleton.java:412)
at org.apache.commons.discovery.tools.DiscoverSingleton.find(DiscoverSingleton.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.java: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 com.ngc.bmc2.tis.image.axis.service.ImageServiceLocator.<init>(ImageServiceLocator.java:12)
at com.ngc.bmc2.tis.image.axis.service.ImageServicePortTypeProxy._initImageServicePortTypeProxy(ImageServicePortTypeProxy.java:18)
at com.ngc.bmc2.tis.image.axis.service.ImageServicePortTypeProxy.<init>(ImageServicePortTypeProxy.java:8)
at com.ngc.sb.tis.image.axis.service.client.TisImageryClient.paint(TisImageryClient.java:18)
at sun.awt.RepaintArea.paintComponent(Unknown Source)
at sun.awt.RepaintArea.paint(Unknown Source)
at sun.awt.windows.WComponentPeer.handleEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.security.AccessControlException: access denied (java.lang.RuntimePermission createClassLoader)
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkCreateClassLoader(Unknown Source)
at java.lang.ClassLoader.<init>(Unknown Source)
at org.apache.commons.discovery.jdk.PsuedoSystemClassLoader.<init>(PsuedoSystemClassLoader.java:73)
at org.apache.commons.discovery.jdk.JDK12Hooks.findSystemClassLoader(JDK12Hooks.java:215)
at org.apache.commons.discovery.jdk.JDK12Hooks.<clinit>(JDK12Hooks.java:73)
... 27 more

-----------------------------------------------

Now, I've seen these errors before and it seemed to lead me to Signed Jars as a solution. Is this really what I have to do? Or hopefully something else should work. Is there some type of security setting in the server I need to modify?

Thanks.
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

java.security.AccessControlException: access denied (java.lang.RuntimePermission createClassLoader)



No, that's a client thing. Signing the applet or altering your the security policy are the two ways around this; see HowCanAnAppletReadFilesOnTheLocalFileSystem for details.

I didn't know that the Axis libraries create a classloader even when used as a client. But then, I've never used them in an applet, always in applications, so security restrictions were not an issue. (Actually, it looks like the logging framework does this, which seems a way too complicated thing to do.)
[ March 18, 2008: Message edited by: Ulf Dittmer ]
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did any of this help? I am running in to the same problem.

I have tried signing my applet jar.
I have tried altering my java.policy file.
I have tried AccessController.doPrivileged().

None have worked for me! Any help is greatly appreciated!!!
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, signing all involved jar files should fix this problem (possibly also requiring the doPrivileged thing).
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
make sure you have included commons-discovery-0.4.jar and commons-logging.jar in jboss lib directory
 
reply
    Bookmark Topic Watch Topic
  • New Topic