i searched google and this side and did some tutorials, i guess it is (like always) a one-line solution to my problem which is:
I have a "index.html" page including the following code:
<script src="http://www.java.com/js/deployJava.js"></script>
<script>
var attributes = {code:'gui.Applet.class', archive:'ComTool.jar', width:1288, height:800} ;
var parameters = {jnlp_href: 'Deploy.jnlp', draggable: 'true'} ;
var version = '1.7' ;
deployJava.runApplet(attributes, parameters, version);
</script>
and the "Deploy.jnlp" file lookes like this:
<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" codebase="" href="Deploy.jnlp">
<information>
<title>Tool</title>
<vendor>Andrea</vendor>
<homepage href="index.html"/>
<description>Tool for representing relations between components and their versions.</description>
<description kind="short">Allows to change relations between components and their versions.</description>
<description kind="tooltip">The test tool.</description>
<offline-allowed/>
<shortcut online="false">
<desktop />
</shortcut>
</information>
<resources>
<j2se version="1.6+" href="http://java.sun.com/products/autodl/j2se"/>
<jar href="WEB-INF/lib/ComTool.jar" main="true" download="lazy"/>
<jar href="WEB-INF/lib/itextpdf-5.3.2.jar" download="lazy"/>
<jar href="WEB-INF/lib/ojdbc6.jar" download="lazy"/>
</resources>
<applet-desc
name="Tool"
main-class="gui.Applet"
width="1288"
height="800">
</applet-desc>
<update check="background"/>
<security>
<all-permissions/>
</security>
</jnlp>
and both files are in the "WebContent" folder of my dynamic web project - the structure of that folder is:
WebContent/META-INF
WebContent/WEB-INF/lib/ComTool.jar
WebContent/WEB-INF/lib/itextpdf-5.3.2.jar
WebContent/WEB-INF/lib/ojdbc6.jar
WebContent/WEB-INF/web.xml
WebContent/Deploy.jnlp
WebContent/index.html
When right click the project the and chose "Run As / Run on Server" the "index.html" page is loaded but without the applet, literally. This means no error, no gray-box-of-death nothing like the page dose not find the JNLP file. The JARs are all signed and when i double click the "index.html" file in the explorer the everything works like it should work but not on the Tomcat 7.0 server managed by Eclipse Juno. The server runs and i think it is not the problem. Oh i almost forgot the web.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>CompTool</display-name>
<distributable/>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
</welcome-file-list>
</web-app>
I guess i have to add something in the web.xml file? I went through this tag list but i didn't find anything useful for me. I must also say dynamic web projects are rather new for me. I played around and found out that if i add this:
<error-page>
<location>/error.html</location>
</error-page>
works neither, of course the "error.html" is in here:
WebContent/error.html
When this works i want to generate a WAR file of this dynamic web project and deploy it on an other server. I just created a dynamic web project and inserted the files, changed and double checked all paths and deleted the unnecessary entries in the "web.xml" files, i just want to minimize error sources, now is my question what am i doing wrong? Please i need help...
Best, Andrea
This was a hard one, here my mistakes if anyone encounters the same problem sometime:
- Do not try to start a dynamic web project via "Run As" in eclipse, export it as WAR into the ...Apache-Tomcat-7.0.34/webapps folder, it gets automatically deployed and works!
- Do your homework, i thought i could load images for my GUI directly from the server, no i couldn't. Applets run always on the client, therefore use URLs and URIs to load images(ask google for more on that).
- If you want to save or create files on the server use Servlets, i got a wrong picture about that too...
- OJDBC6.jar signed (also verified by jarsigner -verify ojdbc6.jar) can cause problems on reloading a HTML page, to solve this problem use fatjar (google...) and pack all your JAR files in one file (if you use ojdbc6), then sign it. It caused also something like a "unsigned resource in ojdbc6.jar" error at the start when i saved the applications temporary.
- Use the "codebase" attribute in the jnlp to point via an URL to the applets location on the server.
i hope this helps.
A little bit less frustrated Andrea :)
i searched google and this side and did some tutorials, i guess it is (like always) a one-line solution to my problem which is:
I have a "index.html" page including the following code:
<script src="http://www.java.com/js/deployJava.js"></script>
<script>
var attributes = {code:'gui.Applet.class', archive:'ComTool.jar', width:1288, height:800} ;
var parameters = {jnlp_href: 'Deploy.jnlp', draggable: 'true'} ;
var version = '1.7' ;
deployJava.runApplet(attributes, parameters, version);
</script>
and the "Deploy.jnlp" file lookes like this:
<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" codebase="" href="Deploy.jnlp">
<information>
<title>Tool</title>
<vendor>Andrea</vendor>
<homepage href="index.html"/>
<description>Tool for representing relations between components and their versions.</description>
<description kind="short">Allows to change relations between components and their versions.</description>
<description kind="tooltip">The test tool.</description>
<offline-allowed/>
<shortcut online="false">
<desktop />
</shortcut>
</information>
<resources>
<j2se version="1.6+" href="http://java.sun.com/products/autodl/j2se"/>
<jar href="WEB-INF/lib/ComTool.jar" main="true" download="lazy"/>
<jar href="WEB-INF/lib/itextpdf-5.3.2.jar" download="lazy"/>
<jar href="WEB-INF/lib/ojdbc6.jar" download="lazy"/>
</resources>
<applet-desc
name="Tool"
main-class="gui.Applet"
width="1288"
height="800">
</applet-desc>
<update check="background"/>
<security>
<all-permissions/>
</security>
</jnlp>
and both files are in the "WebContent" folder of my dynamic web project - the structure of that folder is:
WebContent/META-INF
WebContent/WEB-INF/lib/ComTool.jar
WebContent/WEB-INF/lib/itextpdf-5.3.2.jar
WebContent/WEB-INF/lib/ojdbc6.jar
WebContent/WEB-INF/web.xml
WebContent/Deploy.jnlp
WebContent/index.html
When right click the project the and chose "Run As / Run on Server" the "index.html" page is loaded but without the applet, literally. This means no error, no gray-box-of-death nothing like the page dose not find the JNLP file. The JARs are all signed and when i double click the "index.html" file in the explorer the everything works like it should work but not on the Tomcat 7.0 server managed by Eclipse Juno. The server runs and i think it is not the problem. Oh i almost forgot the web.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>CompTool</display-name>
<distributable/>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
</welcome-file-list>
</web-app>
I guess i have to add something in the web.xml file? I went through this tag list but i didn't find anything useful for me. I must also say dynamic web projects are rather new for me. I played around and found out that if i add this:
<error-page>
<location>/error.html</location>
</error-page>
works neither, of course the "error.html" is in here:
WebContent/error.html
When this works i want to generate a WAR file of this dynamic web project and deploy it on an other server. I just created a dynamic web project and inserted the files, changed and double checked all paths and deleted the unnecessary entries in the "web.xml" files, i just want to minimize error sources, now is my question what am i doing wrong? Please i need help...
Best, Andrea
This was a hard one, here my mistakes if anyone encounters the same problem sometime:
- Do not try to start a dynamic web project via "Run As" in eclipse, export it as WAR into the ...Apache-Tomcat-7.0.34/webapps folder, it gets automatically deployed and works!
- Do your homework, i thought i could load images for my GUI directly from the server, no i couldn't. Applets run always on the client, therefore use URLs and URIs to load images(ask google for more on that).
- If you want to save or create files on the server use Servlets, i got a wrong picture about that too...
- OJDBC6.jar signed (also verified by jarsigner -verify ojdbc6.jar) can cause problems on reloading a HTML page, to solve this problem use fatjar (google...) and pack all your JAR files in one file (if you use ojdbc6), then sign it. It caused also something like a "unsigned resource in ojdbc6.jar" error at the start when i saved the applications temporary.
- Use the "codebase" attribute in the jnlp to point via an URL to the applets location on the server.
i hope this helps.
A little bit less frustrated Andrea :)
0 commentaires:
Enregistrer un commentaire