File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Applets and the fly likes How to load applet in jsp... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "How to load applet in jsp..." Watch "How to load applet in jsp..." New topic
Author

How to load applet in jsp...

Ananth Chellathurai
Ranch Hand

Joined: Nov 21, 2007
Posts: 349

I am trying to load an applet in my jsp. This is my problem, when I tried to do this from a html, I have placed the html inside web-inf. Now my jsp stays outside web-inf. If I specify the codebase as WEB-INF/classes I am getting an error class not found. Please advice me on how to proceed.

Ananth


Ananth Chellathurai [Walk on software]
Ananth Chellathurai
Ranch Hand

Joined: Nov 21, 2007
Posts: 349

I now tried to make all my classes as a jar, and placed all supportive jars in the same directory where my jsp is. I am getting this error in my console.

ava.lang.NoClassDefFoundError: com/sun/org/apache/xml/internal/resolver/CatalogManager
at com.sun.xml.ws.util.xml.XmlUtil.createDefaultCatalogResolver(XmlUtil.java:206)
at com.sun.xml.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:103)
at com.sun.xml.ws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:50)
at javax.xml.ws.Service.<init>(Service.java:57)
at com.neto2.attest.lgm.LogServices.<init>(LogServices.java:49)

Any help on this? :roll:
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39548
    
  27
The classes need to be in a publicly accessible directory. Anything inside WEB-INF will not be served to a browser, so putting classes there is not possible.


Ping & DNS - updated with new look and Ping home screen widget
Ananth Chellathurai
Ranch Hand

Joined: Nov 21, 2007
Posts: 349

Can you suggest me some solution. I can create a jar with the classes, but I have all my library files inside WEB-INF lib folder. Should I have to have all the jars in 2 places? Advice me on this.

Ananth
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39548
    
  27
All the classes and jar files used by the applet need to be outside of WEB-INF. Remember that the servlet container and the applet are two separate JVMs with independent classpaths. Each needs to be set up so that it can get at all classes/kars it needs to run the code. For the applet that means a publicly accessible directory in the document hierarchy, while for the web app that means WEB-INF. They can't share directories.
Ananth Chellathurai
Ranch Hand

Joined: Nov 21, 2007
Posts: 349

ok. Do you have any idea of what this error is?

java.lang.NoClassDefFoundError
at com.sun.xml.ws.util.xml.XmlUtil.createDefaultCatalogResolver(XmlUtil.java:206)
at com.sun.xml.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:103)
at com.sun.xml.ws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:50)
at javax.xml.ws.Service.<init>(Service.java:57)
at com.neto2.attest.lgm.LogServices.<init>(LogServices.java:49)
at com.neto2.attest.psd.PSDCanvas.loadPacketFileStream(PSDCanvas.java:352)
at com.neto2.attest.psd.PSDCanvas.<init>(PSDCanvas.java:115)
at com.neto2.attest.psd.PSD.<init>(PSD.java:77)
at com.neto2.attest.psd.PSDApplet.PSDApplet(PSDApplet.java:51)
at com.neto2.attest.psd.PSDApplet.init(PSDApplet.java:72)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39548
    
  27
The JAX-WS API is not part of J2SE, it's part of JEE 5. If the applet uses it then it will need to have the JEE jar files available (e.g. in the archive attribute of the applet tag).
Ananth Chellathurai
Ranch Hand

Joined: Nov 21, 2007
Posts: 349

Can you help me how to call a servlet to read a file and give all datas as a string or byte array. The file is available in the same server.

Ananth
[ December 11, 2007: Message edited by: Ananth Chellathurai ]
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39548
    
  27
Please start a new thread for this unrelated topic.
Ananth Chellathurai
Ranch Hand

Joined: Nov 21, 2007
Posts: 349

ok. I will do it.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to load applet in jsp...
 
Similar Threads
laoding applet in struts
Applet in web application (WAR)
Applets and tomcat
How to reference Applets in a Java Web Application
Class Not Found Error