Page 2 of 3 FirstFirst 123 LastLast
Results 21 to 40 of 44
  1. #21
    Starvation is offline Member
    Join Date
    Jun 2010
    Posts
    23
    Rep Power
    0

    Default

    Sorry but I'm not sure that I've understood your question as this is the first Applet that i wrote

    Those things are necessary because the applet calls a WS (I've simulated the user input, infact ip is 127.0.0.1 and the query is a generic one) that is located in "Apache Tomcat/webapps/axis2/.../services" and to demo the code you should at least call a WS from an applet

    The WS is wrote in Java, even the applet and the client...they communicate with HTTP requests automatically using Axis

    The applet is in the same directory of the client (which works)...this is why I can't understand why it didn't work

  2. #22
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default

    the applet calls a WS
    What is a WS? Is it the server that the applet was loaded from?

    I modified your posted code for testing on my machine. it is able to connect to my server(no DB) with no problems.

    I've attached the code:
    Attached Files Attached Files
    Last edited by Norm; 06-18-2010 at 07:22 PM.

  3. #23
    Starvation is offline Member
    Join Date
    Jun 2010
    Posts
    23
    Rep Power
    0

    Default

    Dude, thanks for what you are doing :)

    WS is a Web Service

    Those classes are auto-generated from Axis (except QueryWS and QueryWSClient)

    p.s. I will attach the QueryWSStub in another message because i had to split it in 4 files
    Attached Files Attached Files

  4. #24
    Starvation is offline Member
    Join Date
    Jun 2010
    Posts
    23
    Rep Power
    0

    Default

    here is the Stub

    (sorry for the split but...
    "QueryWSStub.txt:
    Your file of 72.3 KB bytes exceeds the forum's limit of 19.5 KB for this filetype." )

    But I don't think you can do something only with those classes because Axis libraries are used in the code :(
    Attached Files Attached Files
    Last edited by Starvation; 06-18-2010 at 07:56 PM.

  5. #25
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default

    Thanks for all that, but I don't have the WS and probably can't test with your code.
    I was trying to determine what the relationship was between where your applet is loaded from and who it tries to communicate with. If there is only one client where the applet is loaded and one server where the applet comes from and who it talks to, then I don't know who refuses the connection.

  6. #26
    Starvation is offline Member
    Join Date
    Jun 2010
    Posts
    23
    Rep Power
    0

    Default

    the WS is the method "interroga" in QueryWS.txt

    I was thinking the same....The "absurd" thing is that the client class works, but the same class in the applet no....it must be an Axis problem, I'd better buy this book

    https://www.packtpub.com/creating-we...he-axis-2/book

    but I don't know if I'll find the answer in this book...

  7. #27
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default

    but the same class in the applet no
    Applets are restricted, applications are not.

    applet is in the same directory of the client
    How are you loading the applet into the browser?
    Last edited by Norm; 06-18-2010 at 09:21 PM.

  8. #28
    Starvation is offline Member
    Join Date
    Jun 2010
    Posts
    23
    Rep Power
    0

    Default

    Quote Originally Posted by Norm View Post
    Applets are restricted, applications are not.
    Mmmmm, so that may be a problem

    Quote Originally Posted by Norm View Post
    How are you loading the applet into the browser?
    At the moment i'm just running the applet with eclipse, now I try to load it into the browser and I will post the code


    TestApplet.html:
    Java Code:
    <HTML>
    
    <HEAD>
    <TITLE>Testing an applet</TITLE>
    </HEAD>
    
    <BODY>
    <OBJECT CLASSID="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" height="500" width="500" CODEBASE="http://java.sun.com/products/plugin/autodl/jinstall-1_4-windows-i586.cab#Version=1,4,0,0" >
    
    <PARAM NAME=CODE VALUE="queryws/Applet.class">
    
    <PARAM NAME="type" VALUE="application/x-java-applet;version=1.4">
    
    <PARAM NAME="scriptable" VALUE="false">
    
    <PARAM NAME="ip" VALUE="127.0.0.1">
    
    <PARAM NAME="query" VALUE="SELECT * FROM ruolo">
    
    <NOEMBED>
    !! Abilitare JAVA !!
    </NOEMBED>
    </OBJECT>
    </BODY>
    
    </HTML>
    stops at the same point of eclipse at " res = stub.interroga(queryDb); "
    Last edited by Starvation; 06-19-2010 at 11:22 AM.

  9. #29
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default

    i'm just running the applet with eclipse, now I try to load it into the browser
    Are you loading it from the server? NOT from the local disk.

  10. #30
    Starvation is offline Member
    Join Date
    Jun 2010
    Posts
    23
    Rep Power
    0

    Default

    Quote Originally Posted by Norm View Post
    Are you loading it from the server? NOT from the local disk.
    Probably you have hit the point...I think I'm loading it from the local disk

    I said "I think" because I don't know how to tell to Eclipse "load from the server" instead of "load from the local disk" (which I think it's setted by default)

  11. #31
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default

    how to tell to Eclipse "load from the server"
    You use a browser to load an applet from the server, not the IDE.
    The URL would be like: http://serveraddress/path-to-appletPage/AppletPage.html

  12. #32
    Starvation is offline Member
    Join Date
    Jun 2010
    Posts
    23
    Rep Power
    0

    Default

    Unfortunately it gives the same problem...

    By the way I've seen that if I run the client class with Apache Tomcat turned off it gives the same error of the applet...it's like if when I call that client class from the applet that client can't work with axis but if I run it directly it works

  13. #33
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default

    if I run the client class with Apache Tomcat turned off it gives the same error of the applet
    Don't understand what that means. If the server is NOT running then you can NOT load an html page into your browser from the server.
    it gives the same problem
    What is the "it" you are doing? Please explain exactly what you are doing, where you are doing it from and what the state of the server is.

    Please copy and paste the FULL text of the browser's Java console here.

  14. #34
    Starvation is offline Member
    Join Date
    Jun 2010
    Posts
    23
    Rep Power
    0

    Default

    Sorry if I expressed myself badly, I was just trying to say that is like the applet calls the client BUT the client don't use axis....instead, the error, (I think) is because the Applet should be signed or the java.policy don't grant permissions to my applet

    This is the java console:

    Java Code:
    Java Plug-in 1.6.0_20
    Uso della versione JRE 1.6.0_20-b02 Java HotSpot(TM) Client VM
    
    
    Exception in thread "AWT-EventQueue-2" java.lang.NoClassDefFoundError: org/apache/axis2/databinding/ADBBean
    	at java.lang.ClassLoader.defineClass1(Native Method)
    	at java.lang.ClassLoader.defineClassCond(Unknown Source)
    	at java.lang.ClassLoader.defineClass(Unknown Source)
    	at java.security.SecureClassLoader.defineClass(Unknown Source)
    	at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
    	at java.lang.ClassLoader.loadClass(Unknown Source)
    	at java.lang.ClassLoader.loadClass(Unknown Source)
    	at queryws.QueryWSClient.querydb(QueryWSClient.java:17)
    	at queryws.Applet.paint(Applet.java:102)
    	at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
    	at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
    	at javax.swing.RepaintManager.seqPaintDirtyRegions(Unknown Source)
    	at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknown Source)
    	at java.awt.event.InvocationEvent.dispatch(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: org.apache.axis2.databinding.ADBBean
    	at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
    	at java.lang.ClassLoader.loadClass(Unknown Source)
    	at java.lang.ClassLoader.loadClass(Unknown Source)
    	... 21 more
    Caused by: java.io.IOException: open HTTP connection failed:http://localhost:8080/test/bin/org/apache/axis2/databinding/ADBBean.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)
    	... 24 more

  15. #35
    Starvation is offline Member
    Join Date
    Jun 2010
    Posts
    23
    Rep Power
    0

    Default

    little update:
    I've signed the applet and I've moved right classes in the right places, now java console says:

    Java Code:
    log4j:WARN No appenders could be found for logger (org.apache.axis2.description.AxisService).
    log4j:WARN Please initialize the log4j system properly.
    java.security.AccessControlException: access denied (java.util.PropertyPermission axis2.repo read)
    	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.checkPropertyAccess(Unknown Source)
    	at java.lang.System.getProperty(Unknown Source)
    	at org.apache.axis2.deployment.FileSystemConfigurator.<init>(FileSystemConfigurator.java:55)
    	at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContextFromFileSystem(ConfigurationContextFactory.java:184)
    	at org.apache.axis2.client.ServiceClient.configureServiceClient(ServiceClient.java:150)
    	at org.apache.axis2.client.ServiceClient.<init>(ServiceClient.java:143)
    	at queryws.QueryWSStub.<init>(QueryWSStub.java:91)
    	at queryws.QueryWSStub.<init>(QueryWSStub.java:77)
    	at queryws.QueryWSStub.<init>(QueryWSStub.java:128)
    	at queryws.QueryWSClient.querydb(QueryWSClient.java:21)
    	at queryws.Applet.paint(Applet.java:102)
    	at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
    	at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
    	at javax.swing.RepaintManager.seqPaintDirtyRegions(Unknown Source)
    	at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknown Source)
    	at java.awt.event.InvocationEvent.dispatch(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)

    Edit: Maybe I haven't added all the necessary classes to the certificate? (I haven't added all the classes that I've posted some posts ago in txt) I'm working on this

    Edit2: Nothing....the problem still exists...I'm going mad :eek:
    Last edited by Starvation; 06-21-2010 at 11:46 AM.

  16. #36
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default

    access denied (java.util.PropertyPermission axis2.repo read)
    Try this as an experiment to see if you can give permission using the .java.policy file.
    Using the policy editor add this permission to the codebase <ALL> entry:
    permission java.util.PropertyPermission "*", "read";

    This would show that its possible to give permission. If it works, you'll need to figure out how to sign your applet to give the required permission.

  17. #37
    Starvation is offline Member
    Join Date
    Jun 2010
    Posts
    23
    Rep Power
    0

    Default

    if I add
    Java Code:
    grant codebase <ALL>{
    permission java.util.PropertyPermission "*", "read"; 
    };
    to the java.policy, the Java console says " expected [quoted string], found [<] "

  18. #38
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default

    The codebase you enter in policytool should be empty. It shows an empty codebase as <ALL> on the initial panel.
    Do you have an existing .java.policy file?

  19. #39
    Starvation is offline Member
    Join Date
    Jun 2010
    Posts
    23
    Rep Power
    0

    Default

    sure, i was adding it by myself, not with the policy tool, now I try


    Nothing....the applet gives the same error............it's "impossible"
    Last edited by Starvation; 06-21-2010 at 05:37 PM.

  20. #40
    Starvation is offline Member
    Join Date
    Jun 2010
    Posts
    23
    Rep Power
    0

    Default

    Hi, I'm back..
    I've solved the previous problem by adding this to the policy:

    Java Code:
    grant {
      permission java.util.PropertyPermission 
      "axis2.repo", "read";
    };
    Java Code:
    grant {
      permission java.util.PropertyPermission 
      "axis2.xml", "read";
    };
    But now I'm having this new error:

    Java Code:
    java.lang.IllegalArgumentException: Null InputStream is not a valid argument
    	at com.ctc.wstx.stax.WstxInputFactory.createSR(WstxInputFactory.java:614)
    	at com.ctc.wstx.stax.WstxInputFactory.createXMLStreamReader(WstxInputFactory.java:317)
    	at org.apache.axiom.om.util.StAXUtils$2.run(StAXUtils.java:137)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at org.apache.axiom.om.util.StAXUtils.createXMLStreamReader(StAXUtils.java:133)
    	at org.apache.axis2.util.XMLUtils.toOM(XMLUtils.java:596)
    	at org.apache.axis2.util.XMLUtils.toOM(XMLUtils.java:581)
    	at org.apache.axis2.deployment.DescriptionBuilder.buildOM(DescriptionBuilder.java:97)
    	at org.apache.axis2.deployment.AxisConfigBuilder.populateConfig(AxisConfigBuilder.java:86)
    	at org.apache.axis2.deployment.DeploymentEngine.populateAxisConfiguration(DeploymentEngine.java:641)
    	at org.apache.axis2.deployment.FileSystemConfigurator.getAxisConfiguration(FileSystemConfigurator.java:116)
    	at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContext(ConfigurationContextFactory.java:68)
    	at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContextFromFileSystem(ConfigurationContextFactory.java:184)
    	at org.apache.axis2.client.ServiceClient.configureServiceClient(ServiceClient.java:150)
    	at org.apache.axis2.client.ServiceClient.<init>(ServiceClient.java:143)
    	at queryws.QueryWSStub.<init>(QueryWSStub.java:91)
    	at queryws.QueryWSStub.<init>(QueryWSStub.java:77)
    	at queryws.QueryWSStub.<init>(QueryWSStub.java:128)
    	at queryws.QueryWSClient.querydb(QueryWSClient.java:21)
    	at queryws.Applet.paint(Applet.java:102)
    	at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
    	at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
    	at javax.swing.RepaintManager.seqPaintDirtyRegions(Unknown Source)
    	at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknown Source)
    	at java.awt.event.InvocationEvent.dispatch(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)
    If you have some ideas on how resolve this problem, please, answer :)

Page 2 of 3 FirstFirst 123 LastLast

Similar Threads

  1. Replies: 3
    Last Post: 02-07-2010, 08:34 PM
  2. Getting .mp3 properties
    By Leprechaun in forum New To Java
    Replies: 1
    Last Post: 02-06-2008, 05:55 AM
  3. List of System properties
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 12-29-2007, 04:56 PM
  4. Getting System Properties
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 11-19-2007, 05:00 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •