views:

562

answers:

3

Hi Guys,

I have a applet that runs with no issue in asp.net web application ... but when comes to ASP.MVC application ..here applet is not working throwing class not founnd exception please let me know if anyone could able to run applet in MVC application .. below is the code from view

<object  classid="clsid:8AD9C840-044E-11D1-B3E9-00805F4345D93" 
   codebase="http://java.sun.com/update/1.6.0/jinstall-6u11-windows-i586.cab#Version=6,0,0,11"                            id="DeviceControl">                            

    <param name="java_arguments" value="-Xmx256m" />
    <param name="CODE" value="/com/XYZ/application/main/SomeApplet.class" />                            
    <param name="archive" value="all jar path" />  
    <param name="type" value="application/x-java-applet;version=1.6" />                            
    <param name="scriptable" value="true" />
    <param name="mayscript" value="true" />
</object>

exception that i am gettting is

load: class com.AppName.scanner.main.ScannerApplet.class not found. java.lang.ClassNotFoundException: com.XYZ.application.main.SomeApplet.class at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source) at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source) at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: java.io.IOException: open HTTP connection failed:http://localhost:3213/Appname/com/XYZ/application/main/SomeApplet/class at sun.plugin2.applet.Applet2ClassLoader.getBytes(Unknown Source) at sun.plugin2.applet.Applet2ClassLoader.access$000(Unknown Source) at sun.plugin2.applet.Applet2ClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) ... 7 more

+1  A: 

It looks to me like you need a codebase param:

<param name="codebase" value="PATH_TO_APPLET" />

Codebase param is required if the applet is not in the same location as the webpage. This is not the physical location of the page on the server but the same directory as far as the url that is used to access the page is concerned.

Here is some info on the parameters needed to host an applet: http://java.sun.com/j2se/1.4.2/docs/guide/plugin/developer_guide/using_tags.html

Ryan Cook
can you give me any link explaining all params for object .. so that i can check it
prakash
A: 

Try manually loading the class file in your browser. I guess that the routing fails, and so the class isn't delivered to the client. (404 error) If thats the case, you have to adjust your asp.net mvc routing stuff. :)

Here are some basic infos on routing in asp.net mvc. http://www.asp.net/Learn/mvc/tutorial-05-cs.aspx You should check your global.asax(.cs) file, and possibly add a IgnoreRoute for your class file.

crazy-weasel
thanks for quick repply ..... please can you give me some more information or link for adjusting the asp.net MVC routing
prakash
A: 

Tell MVC not to process requests for .class files. I think this should do it:

routes.IgnoreRoute("{path}.class");
Patrick Steele