Problem with InputStream in a MIDlet

I am doing some client/server networking using a socket connection in a MIDlet.
When I make the socket connection I get a 220 reply.
i.e "220 smtp.comcast.net"
I read the status code from that response and then send the server my next command. (HELO). so far so good.
The server returns a status code of 250. I can see that in my packet sniffer. again, this is a good thing.
The problem is with my input stream. When I last read the input stream ch = is.read();
the input stream didn't empty itself.
So every time I get a response from the server, it appends to the last input I had.
in this case:
"220 smtp.comcast.net 250 comcast.net".
I only expect to see:
"250 comcast.net"
I've tried is.close() and then reopening it when I expect a response from the server. This does not flush it.
What can I do to rectify this?
Thanks in advance,
Mike

or better, use a buffer to write to and give the number of read bytes to it:
InputStream is; // from somewhere else in the MIDlet
String rec;
StringBuffer sb = new StringBuffer();
byte[] buf = new byte[1024];
               while( (c=is.read(buf)) != -1 ){
                    rec=new String(buf,0,c);
                    sb.append(rec);
               };c is the number of bytes which were read from the input stream.
so i save the read bytes into a new string, but only bytes 0-c from the bytearray buf.
then, i append the whole string to a stringbuffer for later use.

Similar Messages

  • EntityResolver problem with InputStream other than FileInputStream

    Hi everybody,
    I have problems with resolving entities. I tried parsing xml-data with JAXP / Xerces 2.6 Sax and needed an EntityResolver for including xml-data, stored in an external-file:
    <!ENTITY test SYSTEM "test.xml">
    <a>
    &test;
    </a>It was working, as long as I put the xml above in a file and used a fileInputStream for creating the inputSource-object. Of course I set a SystemId with the path to test.xml. When I used a fileInputStream, the EntityResolver was called (I implemented it just for tracing reasons) and my data was processed correctly. As soon as I put the xml above e.g. in a ByteArrayInputStream, and used this for creating a InputSource-object, the my EntityResolver wasn't called and it didn't work. So why is this problem with EntityResolver and other Streams but FileInputStream?? Is it a bug? Did I miss something??
    Thanks for any help!!!

    I appologize for my mistake with my first post.
    While I was copying the code for this forum today, I recognized a typing error in my xml-string:
    String xmlString = "<?xml version=\"1.0\"?> <!DOCTYPE staticinc [ <!ENTITY test SYSTEM \"test.xml\">]><a>%test;</a>";I used a percent-sign instead of amp for the test-entity, and as stupid this is - this was of course the reason for my entity resolver not being called. I get a warning by xml-editors if I have this error in a file, but not during parse of a string.
    Somehow I got on the wrong track, because of the description I found in the other thread about entityResolver problems for "none-file-sources" and it seemed to fit.
    Again, sorry !! Thanks for your offer to help!!

  • Problem with inputstreams from socket

    Hi
    This is probably a stupid question, but I really don't know much about server-client programming, and I'm a bit stuck when it comes to helping a friend (who is even more lost than me :p).
    In the code, there is a socket, mySocket. For some reason, there is two objects, one BufferedReader and one ObjectInputStream, both using the same sockets inpustream.
    mySocket = new Socket(servermaskin, PORT);
    in = new BufferedReader(new InputStreamReader(mySocket.getInputStream()));     
    out = new PrintWriter(mySocket.getOutputStream(),true);
    clientOutputStream = new ObjectOutputStream(mySocket.getOutputStream());
    clientInputStream = new ObjectInputStream(mySocket.getInputStream());"in" is used to write strings, and clientInputStream to write other objects. I really don't see why not use just the ObjectInputStream to write string as well, since strings are object too. What I am really wondering about is wether having two such object open at the same time, using the same sockets inputstream can be the cause of the problems?
    ~Ulvhild~

    When you create an ObjectOutputStream you have to flush it. Otherwise the header it writes at the start of the stream is not sent for the ObjectInputStream to read.
    clientOutputStream = new ObjectOutputStream(mySocket.getOutputStream());
    clientOutputStream.flush();

  • Problems with InputStream ()

    hi there,
    i have a litle server, that sends a file to the client. the problem is that availaible() is always 0 and i cant read out the things. i use java 1.4.1.
    SERVER CODE
    import javax.net.ServerSocketFactory;
    import java.net.Socket;
    import java.net.ServerSocket;
    import java.io.*;
    public class Listener extends Thread {
        ServerSocket socket;
        ServerSocketFactory socketFactory;
        public Listener(int port) {
            try {
                socket = ServerSocketFactory.getDefault().createServerSocket(port);
                while (true) {
                    /* connecting */
                    System.out.print("waiting");
                    Socket client = socket.accept();
                    System.out.println("         [accepted]");
                    BufferedInputStream bis = new BufferedInputStream(client.getInputStream());
                    BufferedOutputStream bos = new BufferedOutputStream(client.getOutputStream());
                    String file = "";
                    bos.write(0);
                    System.out.println("available            "+bis.available());
                    while (bis.available()!=-1) {
                        int c = bis.read();
                        System.out.println("reading: "+(char)c);
                        if(c == -1) break;
                        file += (char) c;
                    System.out.println("sending file: " + file);
                    /* sending file */
                    file = "\\test.jpg";
                    if (new File(file).exists()) {
                        FileInputStream fis = new FileInputStream(file);
                        System.out.println("filesize: " + fis.available());
                        if (file.endsWith(".jpg") || file.endsWith(".gif")) {
                            while (true) {
                                int c = fis.read();
                                System.out.println(c);
                                if(c < 0) break;
                                System.out.print(".");
                                bos.write(fis.read());
                            bos.flush();
                            fis.close();
                        System.out.println("");
                        System.out.println("OK..");
                    else{
                        bos.write(0);
                    /* closing streams*/
                    bos.close();
                    bis.close();
                    client.close();
            } catch (Exception e) {
                e.printStackTrace();
    }CLIENT CODE
    import java.net.Socket;
    import java.net.InetAddress;
    import java.io.*;
    public class StreamConnector {
        private String file;
        private InetAddress host;
        private int port;
        public StreamConnector(String file, InetAddress host, int port) {
            this.file = file;
            this.host = host;
            this.port = port;
        public boolean getImageAndSave(String newFilename) throws IOException {
            try {
                /* connect */
                Socket socket = new Socket(host, port);
                BufferedInputStream bis = new BufferedInputStream(socket.getInputStream());
                BufferedOutputStream bos = new BufferedOutputStream(socket.getOutputStream());
                /* sending path*/
                char[] sendFile = file.toCharArray();
                for (int i = 0; i < sendFile.length; i++) {
                    bos.write((int)sendFile);
    System.out.println("writing: "+sendFile[i]);
    bos.flush();
    /* getting file and save */
    FileOutputStream fop = new FileOutputStream(newFilename);
    int i=0;
    while(true){
    System.out.print(".");
    int c = bis.read();
    System.out.println(c);
    if(c < 0) break;
    fop.write(c);
    i++;
    if(i == 0 || i == 1 || i == 2){
    new File(newFilename).delete();
    socket.close();
    return false;
    File f = new File(newFilename);
    if(!f.exists()){
    socket.close();
    return false;
    socket.close();
    } catch (IOException e) {
    e.printStackTrace();
    throw e;
    return true;
    i have this problem since a few days and realy need help. thank you for your time. jules

    I don't think available() ever returns -1. If you want to read the file name byte by byte, you will need to send something to signal the end of the string. But really, it would be much easier to use a Reader and a Writer instead of streams. They are designed for handling text. If you used a PrintWriter and a BufferedReader for the file name, you could read and write the whole thing at once.

  • Problem with Thread and InputStream

    Hi,
    I am having a problem with threads and InputStreams. I have a class which
    extends Thread. I have created and started four instances of this class. But
    only one instance finishes its' work. When I check the state of other three
    threads their state remains Runnable.
    What I want to do is to open four InputStreams which are running in four
    threads, which reads from the same url.
    This is what I have written in my thread class's run method,
    public void run()
         URL url = new URL("http://localhost/test/myFile.exe");
    URLConnection conn = url.openConnection();
    InputStream istream = conn.getInputStream();
    System.out.println("input stream taken");
    If I close the input stream at the end of the run method, then other threads
    also works fine. But I do not want to close it becuase I have to read data
    from it later.
    The file(myFile.exe) I am trying to read is about 35 MB in size.
    When I try to read a file which is about 10 KB all the threads work well.
    Plz teach me how to solve this problem.
    I am using JDK 1.5 and Win XP home edition.
    Thanks in advance,
    Chamal.

    I dunno if we should be doing such things as this code does, but it works fine for me. All threads get completed.
    public class ThreadURL implements Runnable
        /* (non-Javadoc)
         * @see java.lang.Runnable#run()
        public void run()
            try
                URL url = new URL("http://localhost:7777/java/install/");
                URLConnection conn = url.openConnection();
                InputStream istream = conn.getInputStream();
                System.out.println("input stream taken by "+Thread.currentThread().getName());
                istream.close();
                System.out.println("input stream closed by "+Thread.currentThread().getName());
            catch (MalformedURLException e)
                System.out.println(e);
                //TODO Handle exception.
            catch (IOException e)
                System.out.println(e);
                //TODO Handle exception.
        public static void main(String[] args)
            ThreadURL u = new ThreadURL();
            Thread t = new Thread(u,"1");
            Thread t1 = new Thread(u,"2");
            Thread t2 = new Thread(u,"3");
            Thread t3 = new Thread(u,"4");
            t.start();
            t1.start();
            t2.start();
            t3.start();
    }And this is the o/p i got
    input stream taken by 2
    input stream closed by 2
    input stream taken by 4
    input stream closed by 4
    input stream taken by 3
    input stream closed by 3
    input stream taken by 1
    input stream closed by 1
    can u paste your whole code ?
    ram.

  • Problem with running the midlet class (Error with Installation suite )

    hi everyone...
    i have problem with running the midlet class(BluetoothChatMIDlet.java)
    it keep showing me the same kind of error in the output pane of netbeans...
    which is:
    Installing suite from: http://127.0.0.1:49296/Chat.jad
    [WARN] [rms     ] javacall_file_open: wopen failed for: C:\Users\user\javame-sdk\3.0\work\0\appdb\delete_notify.dat
    i also did some research on this but due to lack of forum that discussing about this,im end up no where..
    from my research i also find out that some of the developer make a changes in class properties..
    where they check the SIGN DISTRIBUTION...and also change the ALIAS to UNTRUSTED..after that,click the EXPORT KEY INTO JAVA ME SDK,PLATFORM,EMULATOR...
    i did that but also didnt work out..
    could any1 teach me how to fix it...
    thanx in advance... :)

    actually, i do my FYP on bluetooth chatting...
    and there will be more than two emulators running at the same time..
    one of my frens said that if u want to run more than one emulator u just simply click on run button..
    and it will appear on the screen..

  • Problems with the conection of acess db with midlet

    hey there,well its good to knw that u ppl have expirience in j2me.well , im having problem with the connection of access db with j2me.could you brief me on what exactly i should do in order to do connect it to run a query and save some info into the db frm the midlet,
    thanx.

    As I said earlyer today, just a few topics back, you can't do that. Read here:
    http://forum.java.sun.com/thread.jspa?threadID=615921&tstart=0
    Could you people please use the search option! Answering the same questions over and over is realy boring (specially if they pop up several times a day)..

  • InputStream problem with Runtime.exec

    Dear all,
    I am writing a java application which is executing an external program (through threads). I am trying to read the output of that program while is in execution. Anyway i found out that InputStreamReader is not ready unless enough output of program is coming or the program exits.
    I simplified things writing the following small C program:
    main(){
    printf("Just a print\n");
    for(;;){} //Or anything that might keep program in execution
    So i am trying to find out why i cant get the output of this program unless it exits. Is this a problem with the underlying Stream? Is there any workaround?
    Thanks for any help.

    You are right. The C code is that of an external program that i am trying to execute and get its output. Actually i am working on a bigger program that it prints Directories recursively. To keep things simpler i used that simple C program to explain my problem.
    The code i am using is the following:
    /* WindowsExec.java */
    import java.io.*;
    public class WindowsExec
         response std_out,std_err;
         public WindowsExec(){
         try{
         String[] cmd = new String[]{"dark.exe"};
    Runtime rt = Runtime.getRuntime();
    Process proc = rt.exec(cmd);
    std_out = new response(proc.getInputStream(),System.out);          std_err = new response(proc.getErrorStream(),System.err);
    std_out.start();
         std_err.start();     
    int exitVal = proc.waitFor();
    System.out.println("ExitValue: " + exitVal);
                   proc.destroy();
         } catch (Throwable t){
              t.printStackTrace();
    public static void main(String args[]){
              new WindowsExec();
    /* Response.java */
    import java.io.*;
    class response extends Thread
         InputStream is;
         PrintStream type;
         public response(InputStream is, PrintStream type){
              this.is = is;
              this.type = type;
         public void run(){
         try{
              InputStreamReader isr = new InputStreamReader(is);
    while(true){
    if(isr.ready()){
    System.out.println("Its ready!"); //HERE!!!
              break;     
    BufferedReader br = new BufferedReader(isr);
    String line = null;
    while ( (line = br.readLine()) != null){
    System.out.println(line);
                   isr.close();
                   is.close();
              catch (Exception ioe){
    ioe.printStackTrace();
    Notice that i am never getting isr.ready() = true!

  • Problems with special characters in InputStream or XPath

    Hello everyone,
    I am having problems with special characters such as ", ', - and so on, everything becomes ? (questionmark). (Not with special nordic characthers (å,æ,ø) though.)
    The encoding of the XML is UTF-8, and the server that holds the webservice is setting encoding to UTF-8 also, so no conflict there.
    What I have done is something like this:
    {code}
    String url = "http://www.formula1.com/rss/news/latest.rss"; // This is not the feed I use, it is a custom XML document
    InputSource is = new InputSource(url);
    DocumentBuilderFactory fct = DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = fct.newDocumentBuilder();
    Document doc = builder.parse(is);
    Element rootElement = doc.getDocumentElement();
    XPathFactory factory = XPathFactory.newInstance();
    XPath xPath = factory.newXPath();
    out.print(xPath.evaluate("/rss/channel/title", rootElement)); // The xml is not a RSS feed, this is just an example.
    {code}
    Please let me know what I am doing wrong, or give me a hint of how to solve this in another way.
    Best regards,
    G.Hansen
    Edited by: G.Hansen on Mar 24, 2009 2:39 AM

    Hello, thanks for you reply. I had to rewrite your code a little, and I think that your code would not really compile, if you tried yourself :-)
    I ended up with something like this:
    our environment is running in 1.4 mode, so I could not use the for-each loop :-(
    public String printEntities(String s) {
         char[] sArray = s.toCharArray();
         StringBuffer sb = new StringBuffer();
           for (int i = 0; i < sArray.length; i++) {
             if (sArray[i] > 256)
                  sb.append("&#x" + Integer.toHexString(sArray) + ";");
         } else
              sb.append(sArray[i]);
         return sb.toString();

  • Problem with HttpConnection.....Its Urgent

    hi guys
    i m new to this forum.I read many thread in this forum but unable to get the answaer for my problem.
    I m developing application to get the data from the server ,i used Httpconnection for that.Its works fine for maximum 10 minutes on Nokia 60 series emulator baut after that its showas an error message"unable to establish the connection" and 9500 nokia communicator is hang .
    Can any one help me solve this issue ?is there any problem with the Cache Memory or is it due to some other reason.
    Thanks In Advance

    hello,
    i am a quite new comer.
    i tried to establish a network connection with the server from the KToolbar, but an exception named:
    /* error msg
    Exception: java.io.IOException: Error initializing
    HTTP tunnel connection:
    HTTP/1.0 403 Forbidden
    Server: squid/2.5.STABLE1
    Mime-Version: 1.0
    Data: Sun, 28 May 2006 13:00:28 GMT
    Content-Type: text/html
    ContentLength: 1056
    Expires: Sun,28 May 2006 13:00:28 GMT
    X-Squid-Error: ERR_ACCESS_DENIED 0
    X-Cache: MISS from gw03.univdhaka.edu
    Proxy-Connection: close
    had thrown.
    my used code is:
    // HTTPMIDlet.java
    import java.io.*;
    import javax.microedition.io.*;
    import javax.microedition.lcdui.*;
    import javax.microedition.midlet.*;
    public class HTTPMIDlet extends MIDlet implements CommandListener, Runnable
         private Display mDisplay;
         private Form mMainScreen;
         public HTTPMIDlet()
              mMainScreen = new Form( "HTTPMIDlet" );
              mMainScreen.append( "Press OK to create an HTTP connection." );
              Command exitCommand = new Command( "Exit", Command.EXIT, 0 );
              Command okCommand = new Command( "OK", Command.OK, 0 );
              mMainScreen.addCommand( exitCommand );
              mMainScreen.addCommand( okCommand );
              mMainScreen.setCommandListener( this );
         public void startApp()
              if( mDisplay==null )
              mDisplay = Display.getDisplay( this );
              mDisplay.setCurrent( mMainScreen );
         public void pauseApp()
         public void destroyApp( boolean unconditional )
         // CommandListener method
         public void commandAction( Command c, Displayable s )
              if( c.getCommandType()==Command.EXIT )
                   notifyDestroyed();
              else if( c.getCommandType()==Command.BACK )
                   mDisplay.setCurrent( mMainScreen );
              else if( c.getCommandType()==Command.OK )
                   // Put up a wait screen.
                   Form waitForm = new Form( "Connecting..." );
                   mDisplay.setCurrent( waitForm );
                   // Make the connection
                   Thread t = new Thread( this );
                   t.start();
         // Runnable method
         public void run()
              //String url = "http://wireless.java.sun.com/";
              String url = "http://203.112.196.113/";
              Form resultsForm = new Form( "Results" );
              Command backCommand = new Command( "Back", Command.BACK, 0 );
              resultsForm.addCommand( backCommand );
              resultsForm.setCommandListener( this );
              HttpConnection hc = null;
              InputStream in = null;
              try
                   // Now make a connection to the server.
                   hc = ( HttpConnection )Connector.open( url );
                   if( hc==null )
                   {System.out.println( "HTTP not Connected..." );}
                   // Retrieve the response.
                   in = hc.openInputStream();
                   int length = 256;
                   byte[] raw = new byte[length];
                   int readLength = in.read( raw );
                   String message = new String( raw, 0, readLength );
                   resultsForm.append( message );
              catch( Exception e )
                   resultsForm.append( new StringItem( "Exception: ", e.toString() ) );
              finally
                   if( in!=null )
                        try
                             in.close();
                        catch( IOException ioe )
                   if( hc!=null )
                        try
                             hc.close();
                        catch( IOException ioe )
              mDisplay.setCurrent( resultsForm );
    }pls, help me with some code or cofiguration guide, if necessary.
    i am now completely stuck at this point, coz without network connection i can't proceed.
    i mailed u, as i seen that u already establish a network connection. so pls pls pls help me......
    info:
    OS: WinXP
    API: MIDP2.0, CLDC1.1
    Server: proxy.univdhaka.edu (linux OS)
    thanx in advance...
    bye...

  • Problems with kXMLParser (kXML 2)

    Hi colleagues,
    when I run my MIDlet which parses an XML file with the kXMLParser (kXML 2) I get the following exception:
    org.xmlpull.v1.XmlPullParserException: PI must not start with xml (position:unknown ���@1:7 in java.io.InputStreamReader@d590dbc)
         at org.kxml2.io.KXmlParser.exception(+47)
         at org.kxml2.io.KXmlParser.error(+42)
         at org.kxml2.io.KXmlParser.parseLegacy(+149)
         at org.kxml2.io.KXmlParser.nextImpl(+365)
         at org.kxml2.io.KXmlParser.next(+23)
         at org.kxml2.io.KXmlParser.nextTag(+4)
         at com.zesium.HelpParser.parse(+26)
         at com.zesium.HelpParser.openFile(+65)
         at com.zesium.HelpParser.run(+12)
    I don't understand what I did wrong. I serached for an explanation in the internet but I did not find anything.
    My XML file has the following structure:
    <?xml version="1.0" encoding="UTF-8" ?>
    <items>
    <item name="Funktionen">
    <paragraph>Text1</paragraph>
    </item>
    <item name="Programmbedienung">
    <paragraph>Text2</paragraph>
    <paragraph>Text3</paragraph>
    </item>
    </items>
    And my code is:
    public class HelpParser extends Thread {
    public void run() {
    openFile();
    public void openFile() {
         String helpResource = ResourceManager.getResourceString("help.file");
         InputStream in = this.getClass().getResourceAsStream("/res/"+helpResource);
         this.parse(in);
    public void parse(InputStream in) {
         // Initialize XML parser
         Reader reader = new InputStreamReader(in);
         KXmlParser kxmlParser = new KXmlParser();
         try {
              kxmlParser.setInput(reader);
              kxmlParser.nextTag();
              kxmlParser.require(XmlPullParser.START_TAG, null, "items");
              while (kxmlParser.nextTag() != XmlPullParser.END_TAG) {
                   readXMLData(kxmlParser);
              kxmlParser.require(XmlPullParser.END_TAG, null, "items");
              kxmlParser.next();
              kxmlParser.require(XmlPullParser.END_DOCUMENT, null, null);
         catch (XmlPullParserException xmlppe) {
              xmlppe.printStackTrace();
         catch (IOException ioe) {
              ioe.printStackTrace();
    private void readXMLData(KXmlParser parser) throws IOException, XmlPullParserException {
         String name = null;
         String paragraph = null;
         //Parse the element "item" in the XML file
         parser.require(XmlPullParser.START_TAG, null, "item");
         name = parser.getAttributeValue(null, "name");
         while (parser.nextTag() == XmlPullParser.START_TAG) {
              parser.require(XmlPullParser.START_TAG, null, "paragraph");
              paragraph = parser.nextText();
              parser.require(XmlPullParser.END_TAG, null, "paragraph");
         // Just for testing
         System.out.println("name: "+name);
         System.out.println("paragraph: "+paragraph);
    }     

    unlike johnson's c++ xml parser implementation, kxml is known to have problems with non-normalized xml tag patterns. kxml works like a charm with normalized structures. to solve the problem, we simply preprocess the byte stream to make it normalized -- by removing the rogue elements. however, avoid using stringbuffer in such kxml operations because it makes memory very volatile (you can see this in the sun mobility memory monitor). similar to QualComm's Brew operating system, the virtual machine does not do a stand-up job with garbage collection while using kxml. you should use GC whenever it is appropriate within the kxml parser code blocks.

  • Problem with axis2 and Tomcat

    Hello,
    I am having a strange problem with Tomcat and axis. I have a webservice that uses axis2 for wsdl2java class generation. When I compile my project in maven a Test is performed. During the test a glassfish server is established and the project is deployed -everything work great with the expected results. However when I try to deploy the webservice on tomcat it has some problems.
    At first I tried to call axis code in a POST method that takes a MultiPart message. The code is as below:
    *@Path("identifyWavestream")*
    *@POST*
    *@Consumes(MediaType.MULTIPART_FORM_DATA)*
    *@Produces(MediaType.APPLICATION_XML)*
    *public String multipartTest(com.sun.jersey.multipart.MultiPart multiPart) throws Exception {* 
    *// get first body part (index 0)*
    *//tomcat shows that the first error is here (line 122 is the nest one with bodypart)*
    BodyPart bp = multiPart.getBodyParts().get(0);
    BodyPartEntity bodyPartEntity = (BodyPartEntity) bp.getEntity();
    InputStream stream = bodyPartEntity.getInputStream();
    *//the rest of the code either saves the incoming file or implements the wsdl2java axis interface - neither works.*
    And the tomcat error is:
    java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
    java.util.ArrayList.RangeCheck(Unknown Source)
    java.util.ArrayList.get(Unknown Source)
    com.webserv.rest.resources.SearchResource.test.multipartTest(SearchResource.java:122)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    java.lang.reflect.Method.invoke(Unknown Source)
    com.sun.jersey.server.impl.model.method.dispatch.EntityParamDispatchProvider$TypeOutInvoker._dispatch(EntityParamDispatchProvider.java:138)
    com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:67)
    com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:124)
    com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:111)
    com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:71)
    com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:111)
    com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:63)
    com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:555)
    com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:514)
    com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:505)
    com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:359)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    It was strange to me since this simple approach of handling a Multipart method worked for me earlier. Then I decided skip the handling of multipart method and just call the axis code. But the results also caused an error. I then tried to call the axis code in a simple @GET method (to cross out any issues regarding the multipart) and the result where the same. Again everything works on the maven- glassfish test. In this case the tomcat error is the following:
    javax.servlet.ServletException: java.lang.NoSuchMethodError: org.apache.commons.httpclient.HttpConnectionManager.getParams()Lorg/apache/commons/httpclient/params/HttpConnectionManagerParams;
    com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:361)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    root cause
    com.sun.jersey.api.container.MappableContainerException: java.lang.NoSuchMethodError: org.apache.commons.httpclient.HttpConnectionManager.getParams()Lorg/apache/commons/httpclient/params/HttpConnectionManagerParams;
    com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:74)
    com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:124)
    com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:111)
    com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:71)
    com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:111)
    com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:63)
    com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:555)
    com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:514)
    com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:505)
    com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:359)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    root cause
    java.lang.NoSuchMethodError: org.apache.commons.httpclient.HttpConnectionManager.getParams()Lorg/apache/commons/httpclient/params/HttpConnectionManagerParams;
    org.apache.axis2.transport.http.AbstractHTTPSender.initializeTimeouts(AbstractHTTPSender.java:454)
    org.apache.axis2.transport.http.AbstractHTTPSender.getHttpClient(AbstractHTTPSender.java:514)
    org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:156)
    org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:75)
    org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:371)
    org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:209)
    org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:448)
    org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:401)
    org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:228)
    org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)
    com.webserv.rest.webapp.IntSoapServiceStub.getServerData(IntSoapServiceStub.java:2447)
    com.webserv..rest.resources.AIntSoapImpl.getServerData(AIntSoapImpl.java:112)
    com.webserv..rest.resources.SearchResource.test.pingTest(SearchResource.java:167)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    java.lang.reflect.Method.invoke(Unknown Source)
    com.sun.jersey.server.impl.model.method.dispatch.EntityParamDispatchProvider$TypeOutInvoker._dispatch(EntityParamDispatchProvider.java:138)
    com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:67)
    com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:124)
    com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:111)
    com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:71)
    com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:111)
    com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:63)
    com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:555)
    com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:514)
    com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:505)
    com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:359)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    I think it is also a good ide to post the pom.xml file :
    Edited by: 803864 on 2010-10-21 00:30

    I think it is also a good ide to post the pom.xml file:
    +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"+
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    +<modelVersion>4.0.0</modelVersion>+
    +<groupId>com.myProjects</groupId>+
    +<artifactId>audioid-rest-interface</artifactId>+
    +<packaging>war</packaging>+
    +<name>AudioID Rest Interface</name>+
    +<version>0.1</version>+
    +<dependencies>+
    +<!--+
    +<dependency>+
    +<groupId>com.sun.tools.xjc.maven2</groupId>+
    +<artifactId>maven-jaxb-plugin</artifactId>+
    +<version>1.1</version>+
    +<scope>test</scope>+
    +</dependency>+
    +<dependency>+
    +<groupId>com.sun.jersey</groupId>+
    +<artifactId>jersey-client</artifactId>+
    +<version>1.0.1</version>+
    +</dependency>+
    +<dependency>+
    +<groupId>com.sun.jersey.contribs</groupId>+
    +<artifactId>jersey-multipart</artifactId>+
    +<version>1.0.1</version>+
    +</dependency>+
    +<dependency>+
    +<groupId>com.sun.grizzly</groupId>+
    +<artifactId>grizzly-servlet-webserver</artifactId>+
    +<version>1.9.0</version>+
    +<scope>test</scope>+
    +</dependency>-->+
    +<dependency>+
    +<groupId>com.sun.jersey.contribs</groupId>+
    +<artifactId>jersey-multipart</artifactId>+
    +<version>1.0.1</version>+
    +</dependency>+
    +<dependency>+
    +<groupId>com.sun.jersey</groupId>+
    +<artifactId>jersey-client</artifactId>+
    +<version>1.0.1</version>+
    +</dependency>+
    +<dependency>+
    +<groupId>com.sun.jersey</groupId>+
    +<artifactId>jersey-bundle</artifactId>+
    +<version>1.0.1</version>+
    +</dependency>+
    +<dependency>+
    +<groupId>commons-logging</groupId>+
    +<artifactId>commons-logging</artifactId>+
    +<version>1.0.4</version>+
    +</dependency>+
    +<dependency>+
    +<groupId>commons-collections</groupId>+
    +<artifactId>commons-collections</artifactId>+
    +<version>3.1</version>+
    +</dependency>+
    +<dependency>+
    +<groupId>org.slf4j</groupId>+
    +<artifactId>slf4j-log4j12</artifactId>+
    +<version>1.5.6</version>+
    +</dependency>+
    +<dependency>+
    +<groupId>junit</groupId>+
    +<artifactId>junit</artifactId>+
    +<version>3.8.2</version>+
    +<scope>test</scope>+
    +</dependency>+
    +<dependency>+
    +<groupId>org.glassfish.distributions</groupId>+
    +<artifactId>web-all</artifactId>+
    +<version>10.0-build-20080430</version>+
    +<scope>test</scope>+
    +</dependency>+
    +<dependency>+
    +<groupId>org.glassfish.embedded</groupId>+
    +<artifactId>gf-embedded-api</artifactId>+
    +<version>1.0-alpha-4</version>+
    +<scope>test</scope>+
    +</dependency>+
    +<dependency>+
    +<groupId>com.sun.jersey</groupId>+
    +<artifactId>jersey-server</artifactId>+
    +<version>1.0.3.1</version>+
    +<scope>test</scope>+
    +</dependency>+
    +<dependency>+
    +<groupId>com.sun.jersey.contribs</groupId>+
    +<artifactId>maven-wadl-plugin</artifactId>+
    +<version>1.0.3.1</version>+
    +</dependency>+
    +<dependency>+
    +<groupId>org.hibernate</groupId>+
    +<artifactId>hibernate</artifactId>+
    +<version>3.2.5.ga</version>+
    +<exclusions>+
    +<exclusion>+
    +<groupId>javax.transaction</groupId>+
    +<artifactId>jta</artifactId>+
    +</exclusion>+
    +<exclusion>+
    +<groupId>cglib</groupId>+
    +<artifactId>cglib</artifactId>+
    +</exclusion>+
    +</exclusions>+
    +</dependency>+
    +<dependency>+
    +<groupId>org.apache.axis2</groupId>+
    +<artifactId>axis2</artifactId>+
    +<version>1.4.1</version>+
    +</dependency>+
    +<!-- <dependency> -->+
    +<dependency>+
    +<groupId>org.apache.axis2</groupId>+
    +<artifactId>axis2-aar-maven-plugin</artifactId>+
    +<version>1.4.1</version>+
    +<scope>test</scope>+
    +</dependency>+
    +<dependency>+
    +<groupId>org.apache.axis2</groupId>+
    +<artifactId>axis2-java2wsdl</artifactId>+
    +<version>1.4.1</version>+
    +<scope>test</scope>+
    +</dependency>+
    +<dependency>+
    +<groupId>org.apache.axis2</groupId>+
    +<artifactId>axis2-xmlbeans</artifactId>+
    +<version>1.4.1</version>+
    +</dependency>+
    +<!-- <dependency> -->+
    +<dependency>+
    +<groupId>com.sun.xml.bind</groupId>+
    +<artifactId>jaxb-impl</artifactId>+
    +<version>2.1.12</version>+
    +</dependency>+
    +<dependency>+
    +<groupId>cglib</groupId>+
    +<artifactId>cglib-nodep</artifactId>+
    +<version>2.1_3</version>+
    +</dependency>+
    +</dependencies>+
    +<build>+
    +<finalName>audioid-rest-interface</finalName>+
    +<plugins>+
    +<plugin>+
    +<!-- This class is just generated for wadl support!!! -->+
    +<!-- Take care that folder ../music-dna-core is existing -->+
    +<groupId>com.sun.tools.xjc.maven2</groupId>+
    +<artifactId>maven-jaxb-plugin</artifactId>+
    +<version>1.1</version>+
    +<executions>+
    +<execution>+
    +<phase>generate-sources</phase>+
    +<goals>+
    +<goal>generate</goal>+
    +</goals>+
    +</execution>+
    +</executions>+
    +<configuration>+
    +<generatePackage> com.webserv.wsparameters</generatePackage>+
    +<schemaDirectory>../audioid-rest-interface/src/main/resources+
    +</schemaDirectory>+
    +<includeSchemas>+
    +<includeSchema>**/*.xsd</includeSchema>+
    +</includeSchemas>+
    +<extension>true</extension>+
    +<strict>false</strict>+
    +<verbose>false</verbose>+
    +</configuration>+
    +</plugin>+
    +<plugin>+
    +<groupId>org.apache.maven.plugins</groupId>+
    +<artifactId>maven-javadoc-plugin</artifactId>+
    +<!-- <version>2.6</version> -->+
    +<executions>+
    +<execution>+
    +<goals>+
    +<goal>javadoc</goal>+
    +</goals>+
    +<phase>compile</phase>+
    +</execution>+
    +</executions>+
    +<configuration>+
    +<encoding>UTF-8</encoding>+
    +<verbose>false</verbose>+
    +<show>public</show>+
    +<subpackages> com.webserv.rest.rest.resources: com.webserv.rest.rest.commons: com.webserv.wsparameters+
    +</subpackages>+
    +<doclet>com.sun.jersey.wadl.resourcedoc.ResourceDoclet</doclet>+
    +<docletPath>${path.separator}${project.build.outputDirectory}+
    +</docletPath>+
    +<docletArtifacts>+
    +<docletArtifact>+
    +<groupId>com.sun.jersey.contribs</groupId>+
    +<artifactId>wadl-resourcedoc-doclet</artifactId>+
    +<version>1.0.3.1</version>+
    +</docletArtifact>+
    +<docletArtifact>+
    +<groupId>com.sun.jersey</groupId>+
    +<artifactId>jersey-server</artifactId>+
    +<version>1.0.3.1</version>+
    +</docletArtifact>+
    +<docletArtifact>+
    +<groupId>xerces</groupId>+
    +<artifactId>xercesImpl</artifactId>+
    +<version>2.6.1</version>+
    +</docletArtifact>+
    +</docletArtifacts>+
    +<additionalparam>-output+
    +${project.build.outputDirectory}/resourcedoc.xml</additionalparam>+
    +<useStandardDocletOptions>false</useStandardDocletOptions>+
    +</configuration>+
    +</plugin>+
    +<plugin>+
    +<groupId>com.sun.jersey.contribs</groupId>+
    +<artifactId>maven-wadl-plugin</artifactId>+
    +<version>1.0.3.1</version>+
    +<executions>+
    +<execution>+
    +<id>generate</id>+
    +<goals>+
    +<goal>generate</goal>+
    +</goals>+
    +<phase>compile</phase>+
    +</execution>+
    +</executions>+
    +<configuration>+
    +<wadlFile>${project.build.outputDirectory}/application.wadl+
    +</wadlFile>+
    +<formatWadlFile>true</formatWadlFile>+
    +<baseUri>http://192.168.2.149:8080/${project.build.finalName}+
    +</baseUri>+
    +<packagesResourceConfig>+
    +<param> com.webserv.rest.resources</param>+
    +</packagesResourceConfig>+
    +<wadlGenerators>+
    +<wadlGeneratorDescription>+
    +<className>com.sun.jersey.server.wadl.generators.WadlGeneratorApplicationDoc+
    +</className>+
    +<properties>+
    +<property>+
    +<name>applicationDocsFile</name>+
    +<value>${basedir}/src/main/doc/application-doc.xml</value>+
    +</property>+
    +</properties>+
    +</wadlGeneratorDescription>+
    +<wadlGeneratorDescription>+
    +<className>com.sun.jersey.server.wadl.generators.WadlGeneratorGrammarsSupport+
    +</className>+
    +<properties>+
    +<property>+
    +<name>grammarsFile</name>+
    +<value>${basedir}/src/main/doc/application-grammars.xml</value>+
    +</property>+
    +</properties>+
    +</wadlGeneratorDescription>+
    +<wadlGeneratorDescription>+
    +<className>com.sun.jersey.server.wadl.generators.resourcedoc.WadlGeneratorResourceDocSupport+
    +</className>+
    +<properties>+
    +<property>+
    +<name>resourceDocFile</name>+
    +<value>${project.build.outputDirectory}/resourcedoc.xml</value>+
    +</property>+
    +</properties>+
    +</wadlGeneratorDescription>+
    +</wadlGenerators>+
    +</configuration>+
    +</plugin>+
    +<plugin>+
    +<groupId>org.codehaus.mojo</groupId>+
    +<artifactId>exec-maven-plugin</artifactId>+
    +<version>1.1</version>+
    +<executions>+
    +<execution>+
    +<goals>+
    +<goal>java</goal>+
    +</goals>+
    +</execution>+
    +</executions>+
    +<configuration>+
    +<mainClass>com.sun.jersey.samples.generatewadl.Main</mainClass>+
    +</configuration>+
    +</plugin>+
    +<plugin>+
    +<groupId>org.apache.maven.plugins</groupId>+
    +<artifactId>maven-compiler-plugin</artifactId>+
    +<inherited>true</inherited>+
    +<configuration>+
    +<source>1.5</source>+
    +<target>1.5</target>+
    +<!--+
    exclude temporary types that are only needed for wadl and doc
    generation
    -->
    +<!--+
    +<excludes> <exclude>com/webserv/types/temporary/**</exclude>+
    +<exclude>com/webserv/rest/commons/Examples.java</exclude>+
    +</excludes>+
    -->
    +</configuration>+
    +</plugin>+
    +<plugin>+
    +<groupId>org.jvnet.jaxb2.maven2</groupId>+
    +<artifactId>maven-jaxb2-plugin</artifactId>+
    +<executions>+
    +<execution>+
    +<goals>+
    +<goal>generate</goal>+
    +</goals>+
    +</execution>+
    +</executions>+
    +</plugin>+
    +<plugin>+
    +<groupId>org.apache.axis2</groupId>+
    +<artifactId>axis2-wsdl2code-maven-plugin</artifactId>+
    +<version>1.4.1</version>+
    +<executions>+
    +<execution>+
    +<id>generate reco core</id>+
    +<goals>+
    +<goal>wsdl2code</goal>+
    +</goals>+
    +<configuration>+
    +<packageName>com.webserv.rest.webapp</packageName>+
    +<wsdlFile>src/main/java/com/webserv/wsdl/web.wsdl</wsdlFile>+
    +<databindingName>adb</databindingName>+
    +</configuration>+
    +</execution>+
    +</executions>+
    +</plugin>+
    +<plugin>+
    +<groupId>com.sun.tools.xjc.maven2</groupId>+
    +<artifactId>maven-jaxb-plugin</artifactId>+
    +<version>1.1</version>+
    +<executions>+
    +<execution>+
    +<goals>+
    +<goal>generate</goal>+
    +</goals>+
    +</execution>+
    +</executions>+
    +<configuration>+
    +<generatePackage>com.webserv.wsparameters</generatePackage>+
    +<schemaDirectory>src/main/xsd</schemaDirectory> <includeSchemas>+
    +<includeSchema>**/*.xsd</includeSchema> </includeSchemas>+
    +<extension>true</extension>+
    +<strict>false</strict>+
    +<verbose>true</verbose>+
    +</configuration>+
    +</plugin>+
    +</plugins>+
    +</build>+
    +<profiles>+
    +<profile>+
    +<id>jdk-1.5</id>+
    +<activation>+
    +<jdk>1.5</jdk>+
    +</activation>+
    +<dependencies>+
    +<dependency>+
    +<groupId>com.sun.xml.bind</groupId>+
    +<artifactId>jaxb-impl</artifactId>+
    +<version>2.1.10</version>+
    +</dependency>+
    +</dependencies>+
    +<build>+
    +<plugins>+
    +<plugin>+
    +<groupId>org.apache.maven.plugins</groupId>+
    +<artifactId>maven-javadoc-plugin</artifactId>+
    +<configuration>+
    +<docletArtifacts>+
    +<docletArtifact>+
    +<groupId>com.sun.jersey.contribs</groupId>+
    +<artifactId>maven-wadl-plugin</artifactId>+
    +<version>1.0.3.1</version>+
    +</docletArtifact>+
    +<docletArtifact>+
    +<groupId>com.sun.jersey.contribs</groupId>+
    +<artifactId>wadl-resourcedoc-doclet</artifactId>+
    +<version>1.0.3.1</version>+
    +</docletArtifact>+
    +<docletArtifact>+
    +<groupId>com.sun.jersey</groupId>+
    +<artifactId>jersey-server</artifactId>+
    +<version>1.0.3.1</version>+
    +</docletArtifact>+
    +<docletArtifact>+
    +<groupId>xerces</groupId>+
    +<artifactId>xercesImpl</artifactId>+
    +<version>2.6.1</version>+
    +</docletArtifact>+
    +<docletArtifact>+
    +<groupId>javax.xml.bind</groupId>+
    +<artifactId>jaxb-api</artifactId>+
    +<version>2.1</version>+
    +</docletArtifact>+
    +<docletArtifact>+
    +<groupId>javax.xml</groupId>+
    +<artifactId>jaxb-impl</artifactId>+
    +<version>2.1</version>+
    +</docletArtifact>+
    +<docletArtifact>+
    +<groupId>javax.activation</groupId>+
    +<artifactId>activation</artifactId>+
    +<version>1.1</version>+
    +</docletArtifact>+
    +<docletArtifact>+
    +<groupId>javax.xml.stream</groupId>+
    +<artifactId>stax-api</artifactId>+
    +<version>1.0</version>+
    +</docletArtifact>+
    +</docletArtifacts>+
    +</configuration>+
    +</plugin>+
    +</plugins>+
    +</build>+
    +</profile>+
    +<profile>+
    +<id>xsltproc</id>+
    +<activation>+
    +<file>+
    +<exists>../xsltproc_win32/xsltproc.exe</exists>+
    +</file>+
    +</activation>+
    +<build>+
    +<plugins>+
    +<!-- Create/generate the application.html using xsltproc -->+
    +<!-- Create/generate the application.html using xsltproc -->+
    +<plugin>+
    +<groupId>org.codehaus.mojo</groupId>+
    +<artifactId>exec-maven-plugin</artifactId>+
    +<version>1.1</version>+
    +<executions>+
    +<execution>+
    +<id>copy-docs-to-builddir</id>+
    +<goals>+
    +<goal>exec</goal>+
    +</goals>+
    +<phase>compile</phase>+
    +<configuration>+
    +<executable>copy</executable>+
    +<commandlineArgs>src\\main\\doc\\*.* target\\classes+
    +</commandlineArgs>+
    +</configuration>+
    +</execution>+
    +<execution>+
    +<id>prepare-xsltproc</id>+
    +<goals>+
    +<goal>exec</goal>+
    +</goals>+
    +<phase>package</phase>+
    +<configuration>+
    +<executable>copy</executable>+
    +<commandlineArgs>..\\audioid-rest-interface\\src\\main\\resources\\*.xsd+
    target\\classes</commandlineArgs>
    +</configuration>+
    +</execution>+
    +<execution>+
    +<id>exec-xsltproc: target/application.html</id>+
    +<goals>+
    +<goal>exec</goal>+
    +</goals>+
    +<phase>package</phase>+
    +<configuration>+
    +<!--<executable>xsltproc</executable>-->+
    +<executable>../xsltproc_win32/xsltproc.exe</executable>+
    +<commandlineArgs>-o target/application.html+
    src/main/doc/wadl_documentation.xsl
    target/classes/application.wadl</commandlineArgs>
    +</configuration>+
    +</execution>+
    +</executions>+
    +</plugin>+
    +</plugins>+
    +</build>+
    +</profile>+
    +</profiles>+
    +<pluginRepositories>+
    +<pluginRepository>+
    +<id>maven2-repository.dev.java.net</id>+
    +<name>Java.net Repository for Maven</name>+
    +<url>http://download.java.net/maven/2/</url>+
    +<layout>default</layout>+
    +</pluginRepository>+
    +<pluginRepository>+
    +<id>maven-repository.dev.java.net</id>+
    +<name>Java.net Maven 1 Repository (legacy)</name>+
    +<url>http://download.java.net/maven/1</url>+
    +<layout>legacy</layout>+
    +</pluginRepository>+
    +</pluginRepositories>+
    +<repositories>+
    +<repository>+
    +<id>maven2-repository.dev.java.net</id>+
    +<name>Java.net Repository for Maven</name>+
    +<url>http://download.java.net/maven/2/</url>+
    +<layout>default</layout>+
    +</repository>+
    +<repository>+
    +<id>maven-repository.dev.java.net</id>+
    +<name>Java.net Maven 1 Repository (legacy)</name>+
    +<url>http://download.java.net/maven/1</url>+
    +<layout>legacy</layout>+
    +</repository>+
    +<repository>+
    +<id>glassfish-repository</id>+
    +<name>Java.net Repository for Glassfish</name>+
    +<url>http://download.java.net/maven/glassfish</url>+
    +</repository>+
    +</repositories>+
    +</project>+
    Can anyonr contribute?

  • Problem with application server shutdown when connecting

    Hi Friends,
    I am new to J2EE applications.
    I developed a web application that uses jxl and mysql for reading excel sheets. The host I am working on is supposed to be the server. The application I am running is working absolutely fine, by creating a directory and saving the excel file in my webapps folder and inserting the data to the database. But the minute I send the file from client system, there is a sudden shutdown in my server.
    I am sending the jsp and java code related to this application and related log file..
    I guess the main problem is with sending the exact path from the remote client, rest all is fine including excel and database interactions.
    I commented the database interaction class just for now as I don't think there is a problem with it.
    I am using Tomcat 4.1, MySQL 3.23
    ====================================================
    JSP FILE
    =====================================================
    <%@ page language="java" import="pdss.*"%>
    <html>
    <head><title>File Upload</title></head>
    <body>
    <%     String action=request.getParameter("go");
    String message=request.getParameter("msg");
    String str="";
    if(message!=null)
         str="Please enter valid filename!";
    ExcelInteraction xlInt=new ExcelInteraction();
    if(action==null)
    %>
    <center><font color="red"><%=str%></font></center>
    <form name="myform" method="post">
    <input type="file" name="filename"></input>
    <input type="submit" name="go" value="Send">
    </form>
    <%
    else if("send".equalsIgnoreCase(action))
         String filename=request.getParameter("filename");
         int ex=0;
         System.out.println("************"+filename.endsWith(".xls"));
         if(filename!=null && (filename.endsWith(".xls")))
              ex=xlInt.fileTransfer(filename, getServletContext());
         else if(filename==null || ("".equals(filename)) || filename.endsWith(".xls")==false)
              response.sendRedirect("uploadFile.jsp?msg=a");
         if(ex>0)
    %>          DONE
    <%     }
         else
    %>          Data Inconsistency found
    <%     }
    %>
    </body>
    </html>
    ======================================================
    JAVA FILES
    ======================================================
    ExcelInteraction:
    package pdss;
    import pdss.*;
    import java.io.*;
    import java.lang.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class ExcelInteraction
         //PDSSUtilities pdsUtil=new PDSSUtilities();
         public int fileTransfer(String readFile, ServletContext app) throws Exception
              int i=0, j=0;
              String strDirectory = "pdssexcelfiles";
              System.out.println("..............ReadFile..."+readFile);
              File srcFile=new File(readFile);
              System.out.println(".................Created source file."+srcFile.getAbsolutePath());
              File destFile=null;
              String newDirStr="",srcFileName="",destFileLoc="", realPath="";
              try{
                   realPath=app.getRealPath("/");
                   System.out.println("newDirStr..........."+realPath);
                   newDirStr=realPath+strDirectory;
                   System.out.println("newDirStr..........."+newDirStr);
                   if((new File(newDirStr)).exists()==false)
                        boolean success = (new File(newDirStr)).mkdir();
                        System.out.println("....................success..."+success);
                        if (success) {
                             System.out.println(".................Directory...: " + strDirectory + " created");
                   srcFileName = srcFile.getName();
                   destFileLoc=newDirStr+"\\"+srcFileName;
                   System.out.println("DestFileLoc............"+destFileLoc);
                   if(srcFile.exists()){
                        destFile=new File(destFileLoc);
                        InputStream in = new FileInputStream(srcFile);
                        OutputStream out = new FileOutputStream(destFile);
                        byte[] buf = new byte[1024];
                        int len=0;
                        while ((len = in.read(buf)) > 0){
                             out.write(buf, 0, len);
                        in.close();
                        out.close();
                   System.out.println("............File copied to... "+destFile.getAbsolutePath());
                   System.out.println("......Closing Streams......");
                   /*if(destFile.exists())
                        j=pdsUtil.readXlData(destFileLoc);
                        System.out.println("..........j::"+j+"rows affected");
              catch(Exception e)
                   e.printStackTrace();
                   System.exit(0);
              return j;
    =====================================================
    LOG FILE FROM HOST SYSTEM:
    =====================================================
    2008-09-16 16:53:52 StandardContext[pdss]: Mapping contextPath='/pdss' with requestURI='/pdss/uploadFile.jsp' and relativeURI='/uploadFile.jsp'
    2008-09-16 16:53:52 StandardContext[pdss]: Trying exact match
    2008-09-16 16:53:52 StandardContext[pdss]: Trying prefix match
    2008-09-16 16:53:52 StandardContext[pdss]: Trying extension match
    2008-09-16 16:53:52 StandardContext[pdss]: Mapped to servlet 'jsp' with servlet path '/uploadFile.jsp' and path info 'null' and update=true
    2008-09-16 16:54:01 StandardContext[pdss]: Mapping contextPath='/pdss' with requestURI='/pdss/uploadFile.jsp' and relativeURI='/uploadFile.jsp'
    2008-09-16 16:54:01 StandardContext[pdss]: Trying exact match
    2008-09-16 16:54:01 StandardContext[pdss]: Trying prefix match
    2008-09-16 16:54:01 StandardContext[pdss]: Trying extension match
    2008-09-16 16:54:01 StandardContext[pdss]: Mapped to servlet 'jsp' with servlet path '/uploadFile.jsp' and path info 'null' and update=true
    =====================================================
    LOG FILE FROM CLIENT SYSTEM:
    2008-09-16 16:54:41 StandardContext[pdss]: Mapping contextPath='/pdss' with requestURI='/pdss/uploadFile.jsp' and relativeURI='/uploadFile.jsp'
    2008-09-16 16:54:41 StandardContext[pdss]: Trying exact match
    2008-09-16 16:54:41 StandardContext[pdss]: Trying prefix match
    2008-09-16 16:54:41 StandardContext[pdss]: Trying extension match
    2008-09-16 16:54:41 StandardContext[pdss]: Mapped to servlet 'jsp' with servlet path '/uploadFile.jsp' and path info 'null' and update=true
    2008-09-16 16:54:42 StandardContext[pdss]: Stopping
    2008-09-16 16:54:42 StandardContext[pdss]: Stopping filters
    2008-09-16 16:54:42 StandardContext[pdss]: Processing standard container shutdown
    2008-09-16 16:54:42 ContextConfig[pdss]: ContextConfig: Processing STOP
    2008-09-16 16:54:42 StandardWrapper[pdss:jsp]: Waiting for 1 instance(s) to be deallocated
    2008-09-16 16:54:42 StandardContext[pdss]: Sending application stop events
    2008-09-16 16:54:42 StandardContext[pdss]: Stopping complete
    =====================================================
    Regards
    Vasumitra

    The VERY FIRST message in the server log gives you a hint as to what the problem might be. The server thinks you have spaces in your PATH to the application server. Therefore, the solution is to kill the server however you need to (task manager, whatever) and then reinstall it in a path that doesn't contain spaces. That's the low-hanging fruit here; if that doesn't work, well, then we will have to find some other solution.

  • Problem with displaying BLOB images on JSP page using a servlet

    hi. I have a big problem with displaying BLOB images using JSP. I have a servlet that connects to the oracle database, gets a BLOB image , reads it, and then displays it using a BinaryStream. The problem is , this works only when i directly call that servlet, that is http://localhost:8080/ImageServlet. It doesn't work when i try to use that servlet to display my image on my JSP page (my JSP page displays only a broken-image icon ) I tried several coding approaches with my servlet (used both Blob and BLOB objects), and they work just fine as long as i display images explicitly using only the servlet.
    Here's what i use : ORACLE 10g XE , Eclipse 3.1.2, Tomcat 5.5.16 , JDK 1.5
    here is one of my image servlet's working versions (the essential part of it) :
                   BLOB blob=null;
              rset=st.executeQuery("SELECT * FROM IMAGES WHERE ID=1");
              while (rset.next())
                   blob=((OracleResultSet)rset).getBLOB(2);
              response.reset();
              response.setContentType("image/jpeg");
              response.addHeader("Content-Disposition","filename=42.jpeg");
                    ServletOutputStream ostr=response.getOutputStream();
                   InputStream istr=blob.getBinaryStream(1L);
                    int size=blob.getBufferSize();
              int len=-1;
                    byte[] buff = new byte[size];
                         while ((len=istr.read( buff ))!=-1 ) {
                   ostr.write(buff,0,len);
             response.flushBuffer();
             ostr.close(); and my JSP page code :
    <img src="/ImageServlet" border="0"  > If you could just tell me what i'm doing wrong here , or if you could show me your own solutions to that problem , i would be very greatful ,cos i'm realy stuck here , and i'm rather pressed for time too. Hope someone can help.

    I turns out that it wasn't that big of a problem after all. All i had to do was to take the above code and place it into another JSP page instead of into a servlet like i did before. Then i just used that page as a source for my IMG tag in my first JSP. It works perfectly well. Why this doesn't work for servlets i still don't know, but it's not a problem form me anymore . Ofcourse if someone knows the answer , go ahead and write. I would still appriceatte it.
    here's the magic tag : <img src="ImageJSP.jsp" border="0"  > enjoy : )

  • Problem with "System.in.read()" read() method!

    import java.io.*;
    import java.lang.*;
    class Count {
    public static void main(String args[]) throws IOException
    int count = 0;
    while (System.in.read()!=-1)
    count++;
    System.out.println("Input has " + count + " chars.");
    in this code the loop stucks and it increments the count variable infinitely of course as long as i hit enter. I am trying to understand the problem with read() method of system class's in object. in its definition it says; when the inputstream ends it returns -1, but in this code it does not return -1 ever. another question of mine is that what args[] array do? what does it store??

    Java doesn't bother much with the dos console and it a bit limited and limiting - no pretty colours /graphics options - just text - that's because java graduates to GUI's where there is laods of power and object /component support to do everything and everything you could imagine and more. System.in.read() ??? - thats a fine start!
    what args[] array do? what does it store??
    Good question !
    It provides a means of passing a parameter argument from the command line to the program - consider this;-public class HelloWithArgs {
       public static void main(String[] args) {
          System.out.println("Hello I am " + args[0]);
    }What does it do and how does it work? Or this;-public class HelloWithArgs2 {
       public static void main(String[] args) {
          try{
             String myName = args[0];
          catch(ArrayIndexOutOfBoundsException aob){
              System.out.print("No names: program will end");
              System.exit(0);
          System.out.println("Hello I am " + myName);
    }Study them and have fun. Though to answer the question -
    " public static void main(String[] args) {" // or
    " public static void main(String[] parameters) {"
    is the 'entry point' of all java programs, in order to do something it has to have a main() method and if youre going to pass on parameters, then why not a String array? If you think about it anything else would be fairly useless.

Maybe you are looking for

  • Date in WebProxy Server 3.6SP7 or previous versions missing?

    Hi everybody. I don't know if this product is valid to answers, but I will do my question in this forum: I installed iPlanet Web Proxy Server 3.6 SP7 in Solaris. When I run a telnet command to connect to default port 8080, and I write the next instru

  • Usage tracking problem

    Hi all, I am trying to set up usage tracking in obiee 11.1.1.6 but I am not able to see any data in the usage tracking table (S_NQ_ACCT). The table is always empty and no data get collected. I used the new MBean feature to set up the usage tracking d

  • Problem integrating Weblogic 6.1 (SP2) with Bowstreet4.2.1

    I have installed weblogic6.1 with SP2.I have installed bowstreet 4.2.1. On starting the weblogic server I get stringindexoutofbound exception when it tries to load bowstreet. I have put in the following jars in the weblogic classpath in the given ord

  • What's with CS4 and flash cards.

    Could we have an update on CS4 and EX1/3 flash cards? Does Premiere CS4 recognize the flash files readily and is it easy to edit or does one need to still go though an intermediate codec to edit this format properly?

  • Same folders in different business areas

    Hi, Is it possible to access folders across business areas? I was not able to do the above so I created (New folder from database) the same folder into 2 different business areas. But I cannot have the same names. Why? I see some folders created prev