POF Exception , java.io.IOException: previous property index=4...

I am getting the following error when the following application code runs:
public void testPOF() {
Token T1 = new Token(1,1,"Toronto",3,5);
NamedCache aceCache = CacheFactory.getCache("ACE");
aceCache.put("TokenTest1", T1);
Token T2 = (Token) aceCache.get("AnkitAsthana");
if (T1.getNeID().equals(T1.getNeID())) {
System.out.println(" Works and equal ");
System.out.println("===============\n");
As you might already guess Token is a POF object , its artifacts are attached below. Coherence-cache-server seemed to startup fine.
<Oct 13, 2011 7:56:47 PM PDT> <Warning> <EJB> <BEA-010065> <MessageDrivenBean threw an Exception in onMessage(). The exception was:
(Wrapped) java.io.IOException: previous property index=4, requested property index=1 while writing user type 1001.
(Wrapped) java.io.IOException: previous property index=4, requested property index=1 while writing user type 1001
at com.tangosol.util.ExternalizableHelper.toBinary(ExternalizableHelper.java:215)
at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache$ConverterValueToBinary.convert(PartitionedCache.CDB:3)
at com.tangosol.util.ConverterCollections$ConverterMap.put(ConverterCollections.java:1578)
Plz help I have no idea what the issue is?
======================================================================================================================
tokens-pof-config.xml
======================================================================================================================
<?xml version="1.0"?>
<pof-config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://xmlns.oracle.com/coherence/coherence-pof-config"
xsi:schemaLocation="http://xmlns.oracle.com/coherence/coherence-pof-config coherence-pof-config.xsd">
<user-type-list>
<!-- coherence POF user types -->
<include>coherence-pof-config.xml</include>
<!-- com.tangosol.examples package -->
<user-type>
<type-id>1001</type-id>
<class-name>Token</class-name>
</user-type>
</user-type-list>
<allow-interfaces>true</allow-interfaces>
<allow-subclasses>true</allow-subclasses>
</pof-config>
======================================================================================================================
Token.java
======================================================================================================================
import java.io.IOException;
import java.io.Serializable;
import com.tangosol.io.pof.PortableObject;
import com.tangosol.io.pof.PofReader;
import com.tangosol.io.pof.PofWriter;
import java.sql.*;
import java.util.Enumeration;
public class Token implements PortableObject {
     * 1 - Unassigned
     * 2 - Available
     * 3 - Reserved
     * 4 - defunct
     private int state;
     * NE-ID(s)
     private String neID;
     * Number of tokens currently Active
     private int tokensCurrentlyActive;
     * Max - Number of tokens available
     private int maxTokensAvailable;
     * unqiue Token ID, used to identify Tokens
     private int tokenID;
     * POF index for data members
     public static final int TOKENID = 0;
     public static final int STATE = 1;
     public static final int NEID = 2;     
     public static final int CURTOKEN = 3;
     public static final int MAXTOKEN = 4;
     * @param state
     public void setState(int state) {
          this.state = state;
     * @return
     public int getState() {
          return state;
     * @param neID
     public void setNeID(String neID) {
          this.neID = neID;
     * @return
     public String getNeID() {
          return neID;
     * @param tokensCurrentlyActive
     public void setTokensCurrentlyActive(int tokensCurrentlyActive) {
          this.tokensCurrentlyActive = tokensCurrentlyActive;
     * @return
     public int getTokensCurrentlyActive() {
          return tokensCurrentlyActive;
     * @param maxTokensAvailable
     public void setMaxTokensAvailable(int maxTokensAvailable) {
          this.maxTokensAvailable = maxTokensAvailable;
     * @return
     public int getMaxTokensAvailable() {
          return maxTokensAvailable;
     * @param tokenID
     public void setTokenID(int tokenID) {
          this.tokenID = tokenID;
     * @return
     public int getTokenID() {
          return tokenID;
     public Token(int state, int tokenID, String neID, int maxTokensAvailable, int tokensCurrentlyActive){
     this.state = state;
     this.tokenID = tokenID;
     this.neID = "Toronto";
     this.maxTokensAvailable = maxTokensAvailable;
     this.tokensCurrentlyActive = tokensCurrentlyActive;
     // ----- PortableObject interface ---------------------------------------
* {@inheritDoc}
public void readExternal(PofReader reader)
          throws IOException
tokenID = Integer.parseInt(reader.readString(TOKENID));
     neID = reader.readString(NEID);
     tokensCurrentlyActive = Integer.parseInt(reader.readString(CURTOKEN));
     maxTokensAvailable = Integer.parseInt(reader.readString(MAXTOKEN));
state = Integer.parseInt(reader.readString(STATE));
* {@inheritDoc}
public void writeExternal(PofWriter writer)
          throws IOException
writer.writeString(TOKENID,Integer.toString(tokenID));
writer.writeString(NEID,neID);
writer.writeString(CURTOKEN,Integer.toString(CURTOKEN));
writer.writeString(MAXTOKEN,Integer.toString(MAXTOKEN));
writer.writeString(STATE,Integer.toString(STATE));
======================================================================================================================
coherence-cache-config.xml
======================================================================================================================
<distributed-scheme>
<scheme-name>example-distributed</scheme-name>
<service-name>DistributedCache</service-name>
<serializer>
<class-name>com.tangosol.io.pof.ConfigurablePofContext</class-name>
<init-params>
<init-param>
<param-type>string</param-type>
<param-value>tokens-pof-config.xml</param-value>
</init-param>
</init-params>
</serializer>
<backing-map-scheme>
<local-scheme>
<scheme-ref>example-binary-backing-map</scheme-ref>
</local-scheme>
</backing-map-scheme>
<autostart>true</autostart>
</distributed-scheme>

Your read and write methods are wrong.
your constants are:
public static final int TOKENID = 0;
public static final int STATE = 1;
public static final int NEID = 2;     
public static final int CURTOKEN = 3;
public static final int MAXTOKEN = 4;your readExternal and writeExternal methods are...
public void readExternal(PofReader reader)
throws IOException
    tokenID = Integer.parseInt(reader.readString(TOKENID));
    neID = reader.readString(NEID);
    tokensCurrentlyActive = Integer.parseInt(reader.readString(CURTOKEN));
    maxTokensAvailable = Integer.parseInt(reader.readString(MAXTOKEN));
    state = Integer.parseInt(reader.readString(STATE));
public void writeExternal(PofWriter writer)
throws IOException
    writer.writeString(TOKENID,Integer.toString(tokenID));
    writer.writeString(NEID,neID);
    writer.writeString(CURTOKEN,Integer.toString(CURTOKEN));
    writer.writeString(MAXTOKEN,Integer.toString(MAXTOKEN));
    writer.writeString(STATE,Integer.toString(STATE));
}so the order you are writing the fields is 0, 2, 3, 4, 1 which you cannot do as with POF you must always write the fields in numerical oeder of the POF ID.
Like this...
public void readExternal(PofReader reader)
throws IOException
    tokenID = Integer.parseInt(reader.readString(TOKENID));
    state = Integer.parseInt(reader.readString(STATE));
    neID = reader.readString(NEID);
    tokensCurrentlyActive = Integer.parseInt(reader.readString(CURTOKEN));
    maxTokensAvailable = Integer.parseInt(reader.readString(MAXTOKEN));
public void writeExternal(PofWriter writer)
throws IOException
    writer.writeString(TOKENID,Integer.toString(tokenID));
    writer.writeString(STATE,Integer.toString(STATE));
    writer.writeString(NEID,neID);
    writer.writeString(CURTOKEN,Integer.toString(CURTOKEN));
    writer.writeString(MAXTOKEN,Integer.toString(MAXTOKEN));
}For Pof ID values you can use any int you like and you can have gaps (so you could use 100, 200, 300 etc...) but they must always be written and read in order.
JK

Similar Messages

  • How to slove follwoing error "Unreported exception java.io.IOException;"

    Currently I'm using following:
    XP Professional
    J2sdk1.4.2_01
    Xerces-2_5_0
    Xalan-j_2_5_1
    Jakarta-tomcat-4.1.27
    Jdom-b9
    Current Classpath setting
    User variables
    PATH = c:\bmrt2.5\bin; c:\j2sdk\bin;%PATH%;%JAVA_HOME%\bin;
    CLASSPATH=.;c:\xerces\xmlParserAPIs.jar;c:\xerces\xercesImpl.jar;
    c:\xerces\xercesSamples.jar;c:\xalan\xercesImpl.jar;c:\xalan\xmlapis.jar;c:\xalan\xalan.jar;c:\tomcat\lib\webserver.jar;c:\tomcat\lib\jasper.jar;c:\tomcat\lib\xml.jar;c:\tomcat\common\lib\serlet.jar;c:\tomcat\lib\tools.jar; c:\tomcat\lib\tools.jar;c:\jdom\build\jdom.jar;
    CATALINA_HOME= c:\tomcat
    JAVA_HOME= c:\j2sdk
    System variables
    PATH=%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;
    c:\j2sdk\bin;%Path%;%JAVA_HOME%\bin;
    CLASSPATH=.;c:\xerces\xmlParserAPIs.jar;c:\xerces\xercesImpl.jar;
    c:\xerces\xercesSamples.jar;c:\xalan\xercesImpl.jar;c:\xalan\xmlapis.jar;c:\xalan\xalan.jar;c:\tomcat\lib\webserver.jar;c:\tomcat\lib\jasper.jar;c:\tomcat\lib\xml.jar;c:\tomcat\common\lib\serlet.jar;c:\tomcat\lib\tools.jar; c:\tomcat\lib\tools.jar;
    CATALINA_HOME= c:\tomcat
    JAVA_HOME= c:\j2sdk
    Program
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import org.jdom.*;
    import org.jdom.Element;
    import org.jdom.Document;
    import org.jdom.output.XMLOutputter;
    import org.jdom.input.SAXBuilder;
    import org.jdom.Attribute;
    import java.util.List;
    public class AddToList extends HttpServlet
         public Document getDocument(File sourceFile, PrintWriter errorsOut)
              try
                   SAXBuilder builder = new SAXBuilder();
                   Document document = builder.build(sourceFile);
                   return document;
              catch(JDOMException e)
                   errorsOut.print("there was a problem building the document: " e. getMessage()"<br/>"+ "Returning blank document.");
                   return new Document(new Element("blank"));
         public void saveDocument(Document saveDoc, File saveFile, PrintWriter errorsOut)
              try
                   FileOutputStream outStream= new FileOutputStream(saveFile);
                   XMLOutputter outToFile= new XMLOutputter(" ",true);
                   outToFile.output(saveDoc, outStream);
                   outStream.flush();
                   outStream.close();
              catch (IOException e)
                   errorsOut.print("Can't save order.xml: " + e.getMessage()+"<br />");
         public void addItem(Element orderElement, String product_id, String quant)
              Element newItem =new Element("item");
              newItem.setAttribute("product_id", product_id);
              Element quantity =new Element("quantity");
              quantity.addContent(quant);
              newItem.addContent(quantity);
              orderElement.addContent(newItem);
         public void doGet(HttpServletRequest request, HttpServletResponse response)
              throws IOException, ServletException
              String thisProduct_id=request.getParameter("addProduct_id");
              String thisQuantity=request.getParameter("addQuantity");
              response.setContentType("text/html");
              PrintWriter out= response.getWriter();
              out.print("Adding "+ thisQuantity + "of item to chart "+ thisProduct_id +" ... ");
              File orderFile = new File ("file:///c:/jdk1.3/orders.xml");
              if(!orderFile.exists())
                   out.print("Creating ordersrocks....<br />");
                   Element root= new Element("orders");
                   root.addContent(" ");
                   Document document = new Document(root);
                   saveDocument (document, orderFile, out);
              else
                   out.print("Orders File Exists.");
              Document document =getDocument(orderFile, out);
              HttpSession session =request.getSession(true);
              String session_id= session.getId();
              Element root =document.getRootElement();
              List orders =root.getChildren();
              int num_orders =orders.size();
              boolean orderExists =false;
              int orderIndex =0;
              for(int i=0; i<num_orders; i++)
                   Element iOrder=(Element)orders.get(i);
                   String iOrder_id=iOrder.getAttributeValue("order_id");
                   if (iOrder_id.equals(session_id))
                        orderExists=true;
                        orderIndex=i;
                        break;
              if(!orderExists)
                   Element order =new Element("order");
                   order.setAttribute("order_id", session_id);
                   Element status =new Element("order_status");
                   status.setText("open");
                   order.addContent(status);
                   addItem(order, thisProduct_id, thisQuantity);
                   root.addContent(order);
              else
                   Element thisOrder=(Element)orders.get(orderIndex);
                   boolean itemExists=false;
                   int itemIndex =0;
                   List items =thisOrder.getChildren("item");
                   int num_items =items.size();
                   for(int i=0; i<num_items; i++)
                        Element iItem=(Element)items.get(i);
                        String iProduct_id =iItem.getAttribute("product_id").getValue();
                        if(iProduct_id.equals(thisProduct_id))
                             itemExists =true;
                             itemIndex =i;
                             break;
                   if(itemExists)
                        Element thisItem=(Element)items.get(itemIndex);
                        String currentQuantity= thisItem.getChildText("quantity");
                        int newQuantity = Integer.parseInt(currentQuantity)+ Integer.parseInt(thisQuantity);
                        String strQuantity= new String().valueOf(newQuantity)+1;
                        thisItem.getChild("quantity").setText(strQuantity);
                   else
                        addItem(thisOrder, thisProduct_id, thisQuantity);
              saveDocument (document, orderFile, out);
         public void doPost(HttpServletRequest request, HttpServletResponse response)
              throws IOException, ServletException
              doGet(request, response);
    When I compile above program, it gives me following error.
    Error
    C:\tomcat\webapps\book\WEB-INF\classes>javac AddToList.java
    AddToList.java:19: unreported exception java.io.IOException; must be caught
    or declared to be thrown
    Document document = builder.build(sourceFile);
    ^
    1 error
    Any help regarding this will be appreciated
    Thank you
    Rocks

    Obadare
    Thank for your help, my program compile successfully. But now I�m facing different kind of error on Tomcat; why it gives me following error and how do I solve it
    http://localhost:8080/rock/servlet/AddToList
    Following Error generate by Tomcat:
    Http Status 500-
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    javax.servlet.ServletException: Cannot allocate servlet instance for path /rock/servlet/AddToList
         at org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:435)
         at org.apache.catalina.servlets.InvokerServlet.doGet(InvokerServlet.java:180)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
    (ApplicationFilterChain.java:247)
    root cause
    java.lang.NoClassDefFoundError: org/jdom/JDOMException
         at java.lang.Class.newInstance0(Native Method)
         at java.lang.Class.newInstance(Class.java:237)
         at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:903)
         at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:668)
         at org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:416)
         at org.apache.catalina.servlets.InvokerServlet.doGet(InvokerServlet.java:180)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
    (ApplicationFilterChain.java:247)
    The following is my configuration
    Classpath= .;c:\xalan\bin\xalan.jar;c:\xalan\bin\xml-apis.jar;c:\xerces\xmlParserAPIs.jar;c:\xerces\xercesImpl.jar;c:\tomcat\common\lib\servlet.jar;c:\jdom\build\jdom.jar;
    Java_Home=c:\jdk1.3
    Catalina_Home=c:\tomcat
    Server.xml
    <Engine name="Standalone" defaultHost="localhost" debug="0">
    <Host name="localhost" debug="0" appBase="webapps"
    unpackWARs="true" autoDeploy="true">
    <Context path="/rock" docBase="rock" debug="0"
    reloadable="true" crossContext="true">
    P.S When I try to build javadoc it give me following error:
    C:\jdom>build javadoc
    JDOM Build System
    Building with classpath c:\jdk1.3\lib\tools.jar;.\lib\ant.jar;.\lib\xml-apis.jar
    ;.\lib\xerces.jar;
    Starting Ant...
    Buildfile: build.xml
    [javadoc] Constructing Javadoc information...
    [javadoc] Building tree for all the packages and classes...
    [javadoc] Building index for all the packages and classes...
    [javadoc] javadoc: warning - Tag @link: Class or Package not found: javax.xml.
    transform.TransformerFactory#getFeature
    [javadoc] javadoc: warning - Tag @link: Class or Package not found: javax.xml.
    transform.TransformerFactory#getFeature
    [javadoc] Building index for all classes...
    [javadoc] javadoc: warning - Tag @link: Class or Package not found: javax.xml.
    transform.TransformerFactory#getFeature
    [javadoc] javadoc: warning - Tag @link: Class or Package not found: javax.xml.
    transform.TransformerFactory#getFeature
    [javadoc] javadoc: warning - Tag @link: Class or Package not found: javax.xml.
    transform.Transformer
    [javadoc] javadoc: warning - Tag @link: Class or Package not found: javax.xml.
    transform.Transformer
    [javadoc] javadoc: warning - Tag @link: Class or Package not found: javax.xml.
    transform.Transformer JAXP TrAX Transformer
    [javadoc] javadoc: warning - Tag @link: Class or Package not found: javax.xml.
    transform.TransformerFactory#getFeature
    [javadoc] javadoc: warning - Tag @link: Class or Package not found: javax.xml.
    transform.TransformerFactory#getFeature
    [javadoc] javadoc: warning - Tag @link: Class or Package not found: java.lang.
    Double#NaN
    [javadoc] Generating C:\jdom\build\apidocs\stylesheet.css...
    [javadoc] 10 warnings
    BUILD SUCCESSFUL
    Total time: 12 seconds

  • Exception: java.io.IOException: HTTP response 404 : LaunchDesc: null ]

    What's matter?
    I checked URL in jnlp file several times. but I coudn't know how to do.
    Error mesagge shows below,
    Exception: java.io.IOException: HTTP response 404 : LaunchDesc: null ]
         at com.sun.javaws.cache.DownloadProtocol.doDownload(Unknown Source)
    ...etc
    Anybody help, plz?

    Hi,
    this might be a proxy config issue. Check Sun's Web Start FAQ for more details.
    - Gerald

  • BLOBDestination Caught exception: java.io.IOException: ORA-01031

    Having problems getting the blobdestination feature to work. Everything looks good in the server trace, up to the distribution of the output. Any idea what the ORA-01031 complaint is about?
    [2006/12/4 4:14:20:484] Exception 50125 (): Caught exception: java.io.IOException: ORA-01031: insufficient privileges
    oracle.reports.RWException: IDL:oracle/reports/RWException:1.0
    at oracle.reports.utility.Utility.newRWException(Utility.java:756)
    at oracle.reports.utility.Utility.newRWException(Utility.java:769)
    at oracle.reports.plugin.destination.blob.BLOBDestination.sendFile(BLOBDestination.java:229)
    at oracle.reports.server.Destination.send(Destination.java:484)
    at oracle.reports.server.JobObject.distribute(JobObject.java:1582)
    at oracle.reports.server.JobManager.updateJobStatus(JobManager.java:2231)
    at oracle.reports.server.EngineCommImpl.updateEngineJobStatus(EngineCommImpl.java:134)
    at oracle.reports.server._EngineCommImplBase._invoke(_EngineCommImplBase.java:94)
    at com.sun.corba.se.internal.corba.ServerDelegate.dispatch(ServerDelegate.java:353)
    at com.sun.corba.se.internal.iiop.ORB.process(ORB.java:280)
    at com.sun.corba.se.internal.iiop.RequestProcessor.process(RequestProcessor.java:81)
    at com.sun.corba.se.internal.orbutil.ThreadPool$PooledThread.run(ThreadPool.java:106)
    [2006/12/4 4:14:20:484] State 56016 (JobManager:updateJobStatus): Job 28 status is: Executed successfully but there were some errors when
    distribute the output
    REP-50159: Executed successfully but there were some errors when distribute the output

    It's Sounds the Privilege issue..
    check these
    - What user is the user connected as ?
    - What is the SQL statement being issued ?
    - Who owns the objects referenced in the statement ?
    Various operations required SELECT as WELL AS INSERT privilege to work

  • SEVERE: HttpRequestHandler.run Exception: java.io.IOException:

    Hi all:
    I use ADF 11g tp3/ejb to develop my application.(To open a dialog by clicking a button), when I run my application developed by 11g tp2, it is right. But when I change to TP3, the error message is as below:
    08/02/29 16:50:05 SEVERE: HttpRequestHandler.run Exception: java.io.IOException: ????????????????????
         at sun.nio.ch.SocketDispatcher.write0(Native Method)
         at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:33)
         at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:104)
         at sun.nio.ch.IOUtil.write(IOUtil.java:75)
         at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:302)
         at java.nio.channels.Channels.write(Channels.java:60)
         at java.nio.channels.Channels.access$000(Channels.java:47)
         at java.nio.channels.Channels$1.write(Channels.java:134)
         at com.evermind.io.ChunkedOutputStream.close(ChunkedOutputStream.java:105)
         at com.evermind.server.http.EvermindServletOutputStream.closeFinally(EvermindServletOutputStream.java:338)
         at com.evermind.server.http.EvermindHttpServletResponse.close(EvermindHttpServletResponse.java:394)
         at com.evermind.server.http.HttpRequestHandler.doFinishProcessingRequest(HttpRequestHandler.java:854)
         at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:848)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:646)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:614)
         at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:405)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:168)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:149)
         at oracle.oc4j.network.ServerSocketReadHandler$ClientRunnable.run(ServerSocketReadHandler.java:275)
         at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
         at java.lang.Thread.run(Thread.java:595)Anyone knows what's the problem?
    Thanks
    Hart

    Hi,
    does this reproduce in a TP3 testcase that doesn't use EJB but only the code to open the dialog ? If no, then add EJB back to the equation.
    Frank

  • Java.io.IOException Exception

    i just configured the tomcat5.5 server and when i try to run my servlet from JBuilder2006 it gives me the error:
    org.apache.catalina.startup. boostrap init classloader
    severe: class loader creation threw exception
    java.io.IOException : the file name, directory name or volume label syntax is incorrect;
    its my first servlet so if u could further i ll be greateful

    * Log files for Database Tier located under $ORACLE_HOME/appsutil/log/<SID>_<hostname>
    i.e. C:\oracle\proddb\9.2.0\appsutil\log\PROD_jccsoracle
    XXXXXXX.log - Main Oracle Applications Rapid Install Wizard Install log for DB Tier
    (Where XXXXXXXX = MMDDHHMM - Date and Time of run, e.g. 02030450.log)
    * Log files for Application Tier located under $APPL_TOP/admin/<SID>_<hostname>/log
    XXXXXXX.log - Main Oracle Applications Rapid Install Wizard Install log for Apps Tier
    (Where XXXXXXXX = MMDDHHMM - Date and Time of run, e.g. 02030450.log)

  • Java.io.IOException: HTTPS hostname wrong

    Hello
    I was trying to open a connection to secure URL and post content to it.
    I got the following exception:
    java.io.IOException: HTTPS hostname wrong: should be <165.112.121.195>
    at sun.net.www.protocol.https.HttpsClient.b(DashoA12275)
    Its apparantly because the connection is
    com.sun.net.ssl.internal.www.protocol.https.DelegateHttpsURLConnection
    not
    sun.net.ssl.www.protocol.DelegateHttpsURLConnection
    I tried setting the system property
    System.setProperty("java.protocol.handler.pkgs","sun.net.www.protocol");
    to force JVM to use the newer Delegate.
    Its still doent work. I use JDK 1.4.2_05. I deploy my application in OC4J 9.0.4
    Interesting thing is, I use this code in two different applications, it works in
    one and doen't work in one. Both containers use same JDK. Both are OC4J
    containers.
    Any thoughts? I would appreciate.
    thanks
    Raghavan

    Do you mean?
    System.setProperty("java.protocol.handler.pkgs","sun.net.ssl.www.protocol");

  • Java.io.IOException: There is no process to read data written to a pipe.

    Hi all
    I am facing a problem when i run my application
    I am using jdk1.3 and Tomcat 4.0.3
    Actually my application works absolutely fine but when i check the
    local_host log file of tomcat i find the following stack trace in it
    2006-01-04 10:59:00 StandardWrapperValve[default]: Servlet.service() for servlet default threw exception
    java.io.IOException: There is no process to read data written to a pipe.
         at java.net.SocketOutputStream.socketWrite(Native Method)
         at java.net.SocketOutputStream.write(SocketOutputStream.java(Compiled Code))
         at org.apache.catalina.connector.ResponseBase.flushBuffer(ResponseBase.java(Compiled Code))
         at org.apache.catalina.connector.ResponseBase.write(ResponseBase.java(Compiled Code))
         at org.apache.catalina.connector.ResponseBase.write(ResponseBase.java(Compiled Code))
         at org.apache.catalina.connector.ResponseStream.write(ResponseStream.java:312)
         at org.apache.catalina.connector.http.HttpResponseStream.write(HttpResponseStream.java:189)
         at org.apache.catalina.servlets.DefaultServlet.copyRange(DefaultServlet.java:1903)
         at org.apache.catalina.servlets.DefaultServlet.copy(DefaultServlet.java:1652)
         at org.apache.catalina.servlets.DefaultServlet.serveResource(DefaultServlet.java:1197)
         at org.apache.catalina.servlets.DefaultServlet.doGet(DefaultServlet.java:519)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2343)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java(Compiled Code))
         at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1107)
         at java.lang.Thread.run(Thread.java:498)
    2006-01-04 10:59:00 ErrorDispatcherValve[localhost]: Exception Processing ErrorPage[exceptionType=java.lang.Exception, location=/error]
    java.lang.IllegalStateException
         at java.lang.RuntimeException.<init>(RuntimeException.java:39)
         at java.lang.IllegalStateException.<init>(IllegalStateException.java:36)
         at org.apache.catalina.connector.ResponseFacade.reset(ResponseFacade.java:243)
         at org.apache.catalina.valves.ErrorDispatcherValve.custom(ErrorDispatcherValve.java:384)
         at org.apache.catalina.valves.ErrorDispatcherValve.throwable(ErrorDispatcherValve.java:250)
         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:178)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java(Compiled Code))
         at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1107)
         at java.lang.Thread.run(Thread.java:498)
    What i dont get is in the entire stack trace i am not able to locate which of my application files is causing the errors
    I searched on net and found a few root causes but i am not able to find out exactly which class file is causing the stack trace
    Any suggestions are most welcome
    Thanking in advance

    Did you do something strange like writing the object out using the Servlet response's output stream and then attempted to redirect or forward a user to another page? That is usually how the IllegalStateException gets generated. You would still see a valid response from the caller's perspective, but since you attempted to forward or redirect after data has already been written to the stream on the server, an exception is thrown there.
    - Saish

  • Java.lang.NoSuchMethodException: Unknown property

    I am receiving this error and i cant figure out why
    This is the error log from log file on the server
    Servlet.service() for servlet jsp threw exception
    java.lang.NoSuchMethodException: Unknown property 'persondbao'
         at com.sun.org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(PropertyUtils.java:1777)
         at com.sun.faces.config.ManagedBeanFactoryImpl.setPropertiesIntoBean(ManagedBeanFactoryImpl.java:632)
         at com.sun.faces.config.ManagedBeanFactoryImpl.newInstance(ManagedBeanFactoryImpl.java:299)
         at com.sun.faces.application.ApplicationAssociate.createAndMaybeStoreManagedBeans(ApplicationAssociate.java:490)
         at com.sun.faces.el.ManagedBeanELResolver.getValue(ManagedBeanELResolver.java:82)
         at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:143)
         at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:62)
         at com.sun.el.parser.AstIdentifier.getValue(AstIdentifier.java:65)
         at com.sun.el.parser.AstValue.getValue(AstValue.java:106)
         at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:192)
         at javax.faces.component.UIOutput.getValue(UIOutput.java:173)
         at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getValue(HtmlBasicInputRenderer.java:100)
         at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getCurrentValue(HtmlBasicRenderer.java:288)
         at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeEnd(HtmlBasicRenderer.java:216)
         at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:848)
         at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:249)
         at com.sun.faces.renderkit.html_basic.GridRenderer.encodeChildren(GridRenderer.java:277)
         at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:828)
         at javax.faces.component.UIComponent.encodeAll(UIComponent.java:883)
         at javax.faces.render.Renderer.encodeChildren(Renderer.java:137)
         at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:828)
         at javax.faces.component.UIComponent.encodeAll(UIComponent.java:883)
         at javax.faces.component.UIComponent.encodeAll(UIComponent.java:889)
         at com.sun.faces.application.ViewHandlerImpl.doRenderView(ViewHandlerImpl.java:241)
         at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:153)
         at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:133)
         at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:244)
         at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:140)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
         at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:397)
         at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:850)
         at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:697)
         at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:532)
         at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:465)
         at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:353)
         at org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:775)
         at org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:742)
         at org.apache.jsp.index_jsp._jspService(index_jsp.java:95)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:111)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:353)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:412)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:318)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
         at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:397)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:278)
         at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
         at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:240)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:179)
         at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
         at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:73)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:182)
         at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
         at com.sun.enterprise.web.VirtualServerPipeline.invoke(VirtualServerPipeline.java:120)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:137)
         at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
         at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:231)
         at com.sun.enterprise.web.connector.grizzly.ProcessorTask.invokeAdapter(ProcessorTask.java:667)
         at com.sun.enterprise.web.connector.grizzly.ProcessorTask.processNonBlocked(ProcessorTask.java:574)
         at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:844)
         at com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:287)
         at com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:212)
         at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)
         at com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:75)

    Please go to this link for your answer
    http://www.discussjava.com/wforum/viewforum.php?f=20

  • ERROR:Unreportted Exception java.io.IOEcxeption

    import java.io.*;
    public class MyFileWriter{
         BufferedReader br;
         InputStreamReader isr;
         PrintWriter pw;
         FileWriter fw;
         File f;
         String data;
    public MyFileWriter(){
         isr=new InputStreamReader(System.in);
         br=new BufferedReader(isr);
         f=new File("one.txt");
         fw=new FileWriter(f);
         pw=new PrintWriter(fw);
         readData();
    public void readData(){
         try{
         while(true){
         System.out.println("enter the data except #");
         data=br.readLine();
         if(data.equals("#"))
         break;
         writeData();
    catch(IOException ie){
         System.out.println(ie);
    public void writeData(){
         try{
         pw.println(data);
         *}catch(IOException ie){*
         System.out.println(ie);
         public static void main(String []args){
         MyFileWriter mfw=new MyFileWriter();

    fw=new FileWriter(f);This might throw an IOException so better you write this in to try catch block or report the method that it might throw exception
    This can be done as
         public MyFileWriter() throws IOException
              isr=new InputStreamReader(System.in);
              br=new BufferedReader(isr);
              f=new File("one.txt");
              fw=new FileWriter(f);
              pw=new PrintWriter(fw);
              readData();
         }or by
         public MyFileWriter()
              try
                   isr=new InputStreamReader(System.in);
                   br=new BufferedReader(isr);
                   f=new File("one.txt");
                   fw=new FileWriter(f);
                   pw=new PrintWriter(fw);
                   readData();
              } catch(IOException ioe)
                            System.out.println("Any thing here");
         }And go according to your requirement
    Now for this code
         public void writeData()
              try
                   pw.println(data);
              } catch(IOException ie)
                   System.out.println(ie);
         }here pw.println() method doesnot throws any type of exception particularly IOException
    So thats why you are getting this error
    exception java.io.IOException is never thrown in body of corresponding try statement
                    } catch(IOException ie)so either remove "IOException ie" from there or use only "Exception e"
    Hope this might help you
    Better you refer java docs while coding.

  • Handling java.io.IOException ?

    Hi !
    Keep getting the following error :
    "Unreported Exception java.io.IOException; must be caught or declared to be thrown"
    Using a throw as in "public void doGet(HttpServletResuest svreq, HttpServletResponse svresp) throws IOException" works well but
    I want to catch it along with SQLException and Exception :
    ... (fragment code follows) ...
    public class LstEmpHandle extends HttpServlet
    public void doGet(HttpServletRequest svreq, HttpServletResponse svresp)
    { ... some declarations ...
    try { ... more code...
    } catch (IOException exc ) {"IOException: "+ exc.getErrorCode() + " : " + exc.getMessage();}
    catch (SQLException exc) {..;.;}
    catch (Exception exc){...}
    finally (...)
    That is the only complain the compiler has got !

    Hi !
    I do have "System.out.println" which I did not include in my fragment code.
    If I do this, there are no compile-time errors
    public void doGet(HttpServletRequest svreq, HttpServletResponse svresp) throws IOException
    {  ResultSet rs = null;
    Connection myconn = null;
    Statement mystmt = null;
    int rowCnt = 0;
    PrintWriter out =svresp.getWriter() ;
    svresp.ContentType("text/html");
    try { ... code code code ...
    } catch ( SQLException exc)
    { System.out.println("error code : " + exc.getErrorCode() + " :: " +                  exc.getErrorMessage());}
    catch (Exception exc)
    {System.out.println("Exception :" + exc.getErrorMessage());}
    finally { try ... etc ...}
    However, if I want to trap the IOException along with other exceptions I get the aforementioned error:
    public void doGet(HttpServletRequest svreq, HttpServletResponse svresp)
    { ResultSet rs = null;
    Connection myconn = null;
    Statement mystmt = null;
    int rowCnt = 0;
    PrintWriter out =svresp.getWriter() ; //javac throws compile time error here
    svresp.ContentType("text/html");
    try { ... code code code ...
    } catch (IOException exc)
    { System.out.println(IOException occurred :" + exc.getMessage());}
    catch ( SQLException exc) // here is where error is at compile time
    { System.out.println("error code : " + exc.getErrorCode() + " :: " +                  exc.getErrorMessage());}
    catch (Exception exc)
    {System.out.println("Exception :" + exc.getErrorMessage());}
    finally { try ... etc ...}

  • Error in web service creation : java.io.IOException: Non nillable element

    hi,
    i am new to web service, and i have to create web service.
    i have wsdl file and i have to develop web service using that file only.
    i am using eclipse 3.2 WTP, and apache tomcat server.
    After importing file, when i am cretaing web service, i am getting msg,
    "could not retrieve the WSDL file
    file:/D/Test/sample.wsdl Do u want to contiue to wait for this file? "
    after that when i am creating web service client, using wsdl file, which is in Webcontent/wsdl/SampleWS.wsdl, i am getting same msg.
    and when i am executing that i am getting error :
    - Exception:
    java.io.IOException: Non nillable element 'serialID' is null.
         at org.apache.axis.encoding.ser.BeanSerializer.serialize(BeanSerializer.java:215)
         at org.apache.axis.encoding.SerializationContext.serializeActual(SerializationContext.java:1502)
         at org.apache.axis.encoding.SerializationContext.serialize(SerializationContext.java:978)
         at org.apache.axis.encoding.SerializationContext.outputMultiRefs(SerializationContext.java:1053)
         at org.apache.axis.message.SOAPBody.outputImpl(SOAPBody.java:145)
         at org.apache.axis.message.SOAPEnvelope.outputImpl(SOAPEnvelope.java:478)
         at org.apache.axis.message.MessageElement.output(MessageElement.java:1208)
         at org.apache.axis.SOAPPart.writeTo(SOAPPart.java:315)
         at org.apache.axis.SOAPPart.writeTo(SOAPPart.java:269)
         at org.apache.axis.SOAPPart.saveChanges(SOAPPart.java:530)
         at org.apache.axis.SOAPPart.getContentLength(SOAPPart.java:229)
         at org.apache.axis.Message.getContentLength(Message.java:510)
         at org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:371)
         at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:138)
         at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
         at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
         at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
         at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
         at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
         at org.apache.axis.client.Call.invoke(Call.java:2767)
         at org.apache.axis.client.Call.invoke(Call.java:2443)
         at org.apache.axis.client.Call.invoke(Call.java:2366)
         at org.apache.axis.client.Call.invoke(Call.java:1812)
         at com.innotrac.INOC_ATS_LOreal_inbound_servicesBindingStub.captureOrder(INOC_ATS_LOreal_inbound_servicesBindingStub.java:362)
         at com.innotrac.INOC_ATS_LOreal_inbound_servicesPortTypeProxy.captureOrder(INOC_ATS_LOreal_inbound_servicesPortTypeProxy.java:45)
         at org.apache.jsp.sampleINOC_005fATS_005fLOreal_005finbound_005fservicesPortTypeProxy.Result_jsp._jspService(Result_jsp.java:166)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:328)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)
         at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
         at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
         at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
         at java.lang.Thread.run(Unknown Source)
    so, what is the error ?
    error is in wsdl file..?
    pls, help me...
    its urgent...

    Melanie_Green wrote:
    Thank him with duke stars :)The old dangling-dukes problems. While I really don't care about them, I think it's unfair to promise something and then not go along with the promise ...
    Give them to Mel ;-)

  • Java.io.IOException: HTTPS hostname wrong:  should be localhost

    I'm having problems verifying an SSL client using Tomcat v5.x. I create a key in a particular keystore, let's call it C:\tomcat. I start tomcat specifying this file as the keystore to use. I then connect to the server on port 8443 with Internet Explorer and save the certificate returned from the server in a file. I then import the certificate into a keystore, let's say C:\tomcat_client. In my SSL client code I am specifiying the keystore to use with a System.setProperty("javax.net.ssl.trustStore", "C://tomcat_client"); However when I try to retrieve an output stream from a HttpURLConnection I receive the above exception. Any ideas what is happening ?
    Exception : java.io.IOException: HTTPS hostname wrong: should be <localhost>
    I have tried a variety of other options including importing the certificate into jssecacerts in the lib/security directory of the jre I am using to execute the SSL client, using the same keystore file for tomcat and the SSL client, etc.

    Hi Everybody!
    I've had a lot of problems with HTTPS connection. But finally I found a solution that works for me. So here is the Servlet:
    * File name: TestServlet.java
    * Created on 2005.01.21.
    package georgie.test.servlet;
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.net.URL;
    import javax.net.ssl.HostnameVerifier;
    import javax.net.ssl.HttpsURLConnection;
    import javax.net.ssl.SSLSession;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    * @author Gy�rgy Nov�k
    public class TestServlet extends HttpServlet
        protected void doGet(HttpServletRequest request,
                HttpServletResponse response) throws ServletException, IOException
            try
                trustAllHttpsCertificates();
                String urlStr = request.getParameter("url");
                HttpsURLConnection.setDefaultHostnameVerifier(hv);
                URL url = new URL(urlStr == null ? "https://www.verisign.com/"
                        : urlStr);
                debug("URL READY");
                BufferedReader in = new BufferedReader(new InputStreamReader(url
                        .openStream()));
                debug("INPUT READY");
                int buff;
                while ((buff = in.read()) != -1)
                in.close();
                debug("EVERYTHING IS DONE!!!");
            catch (Exception e)
                e.printStackTrace();
        HostnameVerifier hv = new HostnameVerifier()
            public boolean verify(String urlHostName, SSLSession session)
                System.out.println("Warning: URL Host: " + urlHostName + " vs. "
                        + session.getPeerHost());
                return true;
        private void debug(String s)
            System.out.println("[DEBUG] -- TestServlet -- \n" + s);
        private static void trustAllHttpsCertificates() throws Exception
            //  Create a trust manager that does not validate certificate chains:
            javax.net.ssl.TrustManager[] trustAllCerts =
            new javax.net.ssl.TrustManager[1];
            javax.net.ssl.TrustManager tm = new miTM();
            trustAllCerts[0] = tm;
            javax.net.ssl.SSLContext sc =
            javax.net.ssl.SSLContext.getInstance("SSL");
            sc.init(null, trustAllCerts, null);
            javax.net.ssl.HttpsURLConnection.setDefaultSSLSocketFactory(
            sc.getSocketFactory());
        public static class miTM implements javax.net.ssl.TrustManager,
                javax.net.ssl.X509TrustManager
            public java.security.cert.X509Certificate[] getAcceptedIssuers()
                return null;
            public boolean isServerTrusted(
                    java.security.cert.X509Certificate[] certs)
                return true;
            public boolean isClientTrusted(
                    java.security.cert.X509Certificate[] certs)
                return true;
            public void checkServerTrusted(
                    java.security.cert.X509Certificate[] certs, String authType)
                    throws java.security.cert.CertificateException
                return;
            public void checkClientTrusted(
                    java.security.cert.X509Certificate[] certs, String authType)
                    throws java.security.cert.CertificateException
                return;
    }Wish You all the best:
    Georgie

  • Java.io.IOException: Corrupt form data: no leading boundary

    Hi,
    I am trying to upload pdf files using a servlet. The Enctype of the form which calls this servlet is multipart/formdata. I use O'Reilly upload component which uses the class MultipartRequest to do the uploading. The form has textboxes and textareas whose data is also submitted.
    The problem is, when I try uploading with Greek text in these text area and textbox, I get the exception
    java.io.IOException: Corrupt form data: no leading boundary: -----------------------------7d21b8c1502c0 != -----------------------------7d21c2c1502c0
    Has anyone encountered this problem? Any help will be greatly appreciated.
    Sairam

    just check this
    http://www.servlets.com/cos/faq.html
    and http://www.oreilly.com/catalog/jservlet/errata/jservlet.unconfirmed

  • Java.io.IOException: The specified module could not be found

    Hi.
    I am using Runtime.exec() to run egrep on some files, and then trying to read its ouput in the following way:
    String command2 = "egrep \"" + pattern +
    "\" " + category + "egrep.txt";
    Process p2 = Runtime.getRuntime().exec(command2);
    double counterA = 0;
    try {
    BufferedReader fin3 = new BufferedReader(new InputStreamReader(p2.
    getInputStream()));
    String reader = "";
    while ( (reader = fin3.readLine()) != null) {
    counterA++;
    if (counterA != 0)
    //System.out.println(read + " ::: " + counterA);
    fin3.close();
    catch (Exception e) {
    System.out.println("E");
    And I get the following exception:
    java.io.IOException: The specified module could not be found
    at java.io.FileInputStream.readBytes(Native Method)
    and this goes on to show exceptions in BufferedInputStream and then my code.
    This does not happen all the time, so I cannot reproduce it easily. I have searched on google and in this forum looking for information but have not found out anything useful.
    Help would be appreciated. Thanks.

    The only possible reason for this error occurring that I can think of is that it is somehow a side effect of the limited buffer size for stdin and stderr.
    For an example of emptying both output streams simultaneously, see the StreamGobbler class in this article:
    http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
    (this applies to unix, the author just mixed it in with his discussion of windows issues, just remove the "cmd.exe" and other windows stuff)
    Another thing to try if only for the sake of experimentation would be to throw in a "exitValue = p2.waitFor()" just in case there's some unpredictable resource conflict going on (although I can't imagine why for egrep, but it's something to experiment with).
    Let me know if you can narrow down the conditions for reproducing the bug.

Maybe you are looking for

  • HT2250 I have Bonjour files on my computer, but iTunes will not recognize it, how do I fix this?

    I have Bonjour files on my computer, but when I open iTunes it says that I don't. Somehow the services are turned off, but I can't just turn on a file. How do I turn it back on?

  • Rule file issue

    I am trying to put value at the [Parent adjs] level of value dimension, I am using the SetDataWithPOV function in the rule file but not able to insert the value.The rule used by me is HS.SetDataWithPOV "E#LNT Chennai.W#YTD.A#MI_BS.P#April.Y#2012.S#Ac

  • Where has the thumbnail preview gone?

    I recently upgraded from CS5 to the latest version and I'm having trouble adjusting. One of the smallest but most usable features of previous versions of photoshop has been that when I go to File > open and browse to one of my thousands of image fold

  • I have a iPod touch and it charges when it dies  but....

    I have a iPod touch and it charges when it dies and when it turns back on it does not charge what do i do

  • External LOV Problem

    Dear Users, I have defined an external lov and attached this lov to a field on the page. While creating the external lov I 've tested the query on the database and it was returning rows. I tested the query in JDev as well while creating the external