commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kedar Panse <ke...@bancbridge.com>
Subject Re: HttpClient problem
Date Tue, 14 Jun 2005 10:15:59 GMT
If its a applet, are you including httpclient classes with it?  It seems 
from the error that its not able to load the claases

Kedar

Rosa wrote:

> I am developing an applet that sends two byte arrays and two 
> parameters to the server. It uses the HttpClient library. The code 
> looks like this:
>                               ...
>                URL url = new URL(baseApp, "../guardaHr.do");
>                //HttpClient version 3.0-rc2
>                PostMethod pM = new PostMethod(url.getPath());
>                try {
>                    byte [] oA = UtilXML.creaFXML(docA);
>                    byte [] oP = UtilXML.creaFXML(docG);
>                    pM.addParameter("fI", fIniStr);
>                    pM.addParameter("fF", fFinStr);
>                    ByteArrayPartSource horA = new 
> ByteArrayPartSource("horA.xml", oA);
>                    ByteArrayPartSource horP = new 
> ByteArrayPartSource("horP.xml", oP);
>                    FilePart p1 = new FilePart("hA", horA);
>                    FilePart p2 = new FilePart("hP", horP);
>                    Part[] partes = {p1, p2};
>                    pM.setRequestEntity(new 
> MultipartRequestEntity(partes, pM.getParams()));
>                    HttpClient cliente = new HttpClient();
>                    
> cliente.getHttpConnectionManager().getParams().setConnectionTimeout(30000); 
>
>                    int estado = cliente.executeMethod(pM);
>                    if (estado == HttpStatus.SC_OK) {
>                        System.out.println(
>                            "Upload finished, response=" + 
> pM.getResponseBodyAsString()
>                        );
>                    } else {
>                        System.out.println(
>                            "Upload failed, response=" + 
> HttpStatus.getStatusText(estado)
>                        );
>                    }
>                    pM.releaseConnection();
>                }
>                catch (Exception ex) {
>                    ex.printStackTrace();
>                    pM.releaseConnection();
>                }                          ...
>
>
>
> The code compiles fine. The applet is not signed because I am not 
> accessing the file system at all. When I try to load the applet from 
> the web browser I get the following error
>
>    java.lang.NoClassDefFoundError: 
> org/apache/commons/httpclient/methods/multipart/PartSource
>
>        at java.lang.Class.getDeclaredConstructors0(Native Method)
>
>        at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
>
>        at java.lang.Class.getConstructor0(Unknown Source)
>
>        at java.lang.Class.newInstance0(Unknown Source)
>
>        at java.lang.Class.newInstance(Unknown Source)
>
>        at sun.applet.AppletPanel.createApplet(Unknown Source)
>
>        at sun.plugin.AppletViewer.createApplet(Unknown Source)
>
>        at sun.applet.AppletPanel.runLoader(Unknown Source)
>
>        at sun.applet.AppletPanel.run(Unknown Source)
>
>        at java.lang.Thread.run(Unknown Source)
>
>
> Do somebody knows what is happening?
>
> Thanks in advance
>
> Rosa
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message