JSSE with Servlet problem

Hi there, i face a problem with JSSE when i try to implement it, My JSSE client program is work fine but when i try to change it into servlet, it doesn't work
So my few questions are
1. is JSSE implemetable in Servlet ?
2. is there problem with the servlet to read files ?
3. is there any problem with the following code ?
System.setProperty("javax.net.ssl.trustStore","c:/keystorefiles");
because if i disable this, my servlet will work fine, i need above code because i'm going to post some data to the https website.
i think it is funny thou to use https classs to post data to https website using servlet.
anyway, if u don't get what i mean. here is the illustration.
Customer enter information on Company A website(which will submit to the servlet). The servlet will process the information and generate the Signature of the Company A website then will forward the information to the Company B website (must be done using POST method rather than redirect or GET method)
That's why i need to read my keystore files which always give me problem.
so anyone can help me on this ?
waiting for help...
Thanks in advance

mm it is ok.. i put the class files wrong...

Similar Messages

  • NetBeans problem: Issue with servlets and Chinese character encoding

    Java Version: JDK1.5.0_01, JRE1.5.0_01 (International version)
    Netbeans Version: Netbeans IDE 4.0
    OS: Windows XP Personal Edition
    Dear Sirs,
    First at all thanks for reading this post. I am having the following issue. I am creating an application using html pages and servlets. I am using Chinese and English languages on them (html encoding UTF-8).
    I created a project in Netbeans and added an idex.html screen reporting to a servlet. Both index.html and in the servlet generated html page contains the line:
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    Additional, I setup the character code settings in Netbeans:
    (tools-options-Java sources-Expert-default encoding=UTF-8
    When I run the project, index.html displays itself perfectly, with the Chinese characters displayed properly. The problem comes when the html created servlet is displayed, which instead of the Chinese characters some strange characters are displayed (�� instead of Chinese).
    I have tried different encodings from http://java.sun.com/j2se/1.4.2/docs/guide/intl/encoding.doc.html without any luck. I also setup the encoding of the file itself (using right click-properties in the project menu of Netbeans).
    Also, when I am editing the servlet, the characters are displayed properly. I type them directly without any issue, but then the display is wrong at runtime.
    Also, just in case this have something to do with the problem, my PC was bought in US, therefore the default character set is not Chinese. I had to install the Chinese typing stuff later on. But like I said earlier, the html page is displayed properly, so I really think is some problem with Netbeans.
    After a week trying to find a solution, I decided to post it here in the hopes that someone will show me the way of the light.
    Thanks in advance for any ideas or help provided
    Aral.

    Ok, I found out some problems with Netbeans as well.
        public void doGet(HttpServletRequest request,
                          HttpServletResponse response)
            throws IOException, ServletException
            response.setCharacterEncoding("UTF-8");
            request.setCharacterEncoding("UTF-8");
            response.setContentType("text/html");
            PrintWriter out = response.getWriter();
            byte[] st = {-25,-75,-124,-27,-100,-106,-17,-68,-102,-27,-80,-113,-27,-72,-125,-26,-118,-75,-26,-105,-91,-27,-82,-93};
            out.println("this works: ");
            out.println(new String(st,"UTF-8"));
            out.println("<br>");
            out.println("this doesn't: ");
            out.println("some chinese copied from the Internet<br>");Right click the .java file and choose properties -> encoding UTF-8
    Then I make a copy of the .java file, rename it to html and open it with IE sure enough
    the Chinise is allready unreadable (not it's still readable in the IDE);
    When I compile the file with F9 I get the following error:
    whatever.java:101: warning: unmappable character for encoding Cp1252
    Tried to set the encoding to UNICODE but then the file doesn't compile.
    I gues you have to download the Japanese version for it to work correctly.

  • Problem with Servlets

    Hi,
    I am Tejas , a newbie with servlets. Now, I have a servlet which contains a Javascript method. On clicking a link , the Javascript method is called.
    But however, I find that there is some trouble. I created a class called MainFrames.java, the object of which I am instantiating in the Javascript method.
    But this code doesnt work properly. I have given the snippet below
    out.println("<script type='text/javascript'>");
    out.println("function threader()");
    out.println("{");
    out.println("alert('Inside Threader');");
    out.println("<%@ page import=\"XcForm.MainFrames\"%>"); //I have a hunch that this statement is the problem
    out.println("<%");
    out.println("MainFrames mainframes = new MainFrames();"); //without the import statement above, the MainFrames.java class is not being recognised
    out.println("%>");
    out.println("}");
    out.println("</script>");
    Thanks in advance,
    Tejas

    Do not put presentation code in servlets. Put them in JSPs. And mixing serverside code (scriptlets) and clientside code (javascript) this way is indeed not going to work. That code will certainly not be executed in the order as you write. Serverside code is executed at the server and is finished when the response is completed. So any serverside code inside clientside code is alreay executed. Clientside code is executed at the client and will only execute when the response is completed (onload, etc) or when the client invokes it (onclick, onsubmit, etc). Further on, do not put business code in presentation code. Put them in servlets.

  • Some problems with servlet.jar and tomcat 4.1.27

    Hello everybody,
    I used to work with tomcat 3.3.1 and i've decided to use tomcat 4.1.27 now. The manual explains that we have to change de version of servlet.jar, it's done with servlet-2.3.jar but on tomcat starting i have this message:
    jar not loaded. See servlet spec [...]. Offending class: javax/servlet/Servlet.class
    what can i do, i've red all de documentation and i think all versions a OK??
    thanks per advance
    antoine

    I am running Tomcat 4.1.18, so your configuration may be slightly different. I found the Servlet.class file you are missing residing in the Tomcat/common/lib directory in the Servlet.jar file. Check your path and also make sure your Servlet.jar file contains the missing class.

  • Help needed. Problem with servlet.

    Hello ppl. Ok. I've never really needed to implement servlets in my projects before but I experimented by writing a simple helloworld servlet. It compiled successfully and I tested it in the examples servlet dir and it worked. To test it in the ROOT dir, I placed the servlet in the ROOT/WEB-INF/classes folder and edited the web.xml file with:
    <servlet>
              <servlet-name>HelloWorldExample</servlet-name>
              <servlet-class>HelloWorldExample</servlet-class>
         </servlet>
         <servlet-mapping>
              <servlet-name>HelloWorldExample</servlet-name>
              <url-pattern>servlet/*</url-pattern>
         </servlet-mapping>
    When I try and execute the servlet by using this URL: localhost:8080/servlet/helloworld I get an internal server error and the server crashes. I removed the entry from the web.xml file and Tomcat started up again. What went wrong? Can someone enlighten me in how to get my test servlet working becuase i may use them in the future. Thanks.

    Nope, Still didnt work. As soon as I put in:
    <servlet>
         <servlet-name>HelloWorldExample</servlet-name>
         <servlet-class>HelloWorldExample</servlet-class>
         </servlet>
         <servlet-mapping>
         <servlet-name>HelloWorldExample</servlet-name>
         <url-pattern>servlet/HelloWorldExample</url-pattern>
         </servlet-mapping>
    Tomcat went offline!
    I have another entry which is:
    <servlet>
              <servlet-name>org.apache.jsp.index_jsp</servlet-name>
              <servlet-class>org.apache.jsp.index_jsp</servlet-clas
    >
         </servlet>
         <servlet-mapping>
              <servlet-name>org.apache.jsp.index_jsp</servlet-name>
              <url-pattern>/index.jsp</url-pattern>
         </servlet-mapping>
    Do you think they may be conflicting? Thanks.Tomcat going offline is quite weird. However,
    <url-pattern>/index.jsp</url-pattern>
    this is perfectly valid. Lemme ask you this: did u come up with this stuff on your own or was it generated for you by the container? It looks like it was generated upon compilation of the jsp. If that is the case it should cause any conflicts. However now if you want to invoke the servlet/jsp you must use a URL like:
    http://localhost:<PORT_NO>/index.jsp
    Cheers

  • Problem in midlet interact with servlet application

    while i was trying to connect midlet with servlet
    there found a warning like this
    Warning: To avoid potential deadlock, operations that may block, such as
    networking, should be performed in a different thread than the
    commandAction() handler.
    why this because

    The warning exactly states why, what else is there to ask... Besides, this question has been asked many times before. A simple search would have given you an answer in no-time.

  • Need Urgent Help with Servlets!!!

    I was just assigned a java project few days back and the thing is that i noe nuts abt JAVA!!! My first time and i admit i'm a slow learner.
    I was tasked to develop a servlet for web based query of inventory status in FIFO storage from QIS database.
    Basically, i heard according to my supervisor that this is a very simple project that may be completed in just days..but as i said this is my first Java program and i really need u guys to help me!!!! I have no idea how to start the entire coding process.
    The main page where the option buttons are is actually a form. This program have a HTTP extension i think. Below i have indicate the System and User Requirements.
    System Requirements
    * A Servlet
    * 2 option buttons
    * 1 for retrieving a Summarised Report
    * 1 for retriveving an Detailed Report
    * 1 command button for retrieval of data
    * Retrieved data will be displayed on another frame
    User Requirements
    * Be able to view Summarised Report at a click of a mouse
    * Be able to view Detailed Report also at a click of a mouse
    PLS HELP!!!!!!!!

    Justa comment...
    << according to my supervisor that this is a very simple project that may be completed in just days
    If your supervisor is so confident, then, maybe he/she should just get it done himself/herself. I really mean it. However, if that does happen, he/she should provide post-implementation support himslef/herself.
    In the meanwhile you can continue thinking about doing it the right way. Which is to first get some grasp of sorts about the various Java and other technologies and concepts you are talking about. Then have some kind of plan and follow it.
    I think at the end both you, and more importantly, your supervisor would see the difference in the result with respect to quality of work.
    Forums such as these provide an excellent wealth of information mostly because they are a means to consolidate knowledge gained by individuals from their past experience.
    However, in my opinion, it would be wrong to expect that one would be able to design and implement a real-life application just from information gathered from such forums. An example problem if you do it that way is: who will provide guaranteed support if something does not work in your real-life application. Your supervisor ?
    Instead, do the study part systematicaly. Try to convince your supervisor that thats the way to do it. Then do it. And come back with specific problems you might have.
    Best luck.

  • How to use JNI with Servlets

    Hi
    i was trying to do some example with JNI. I can use JNI with standalone Java application but I just cannot figure out how I can use JNI with Servlet.
    Can some one show me a sample code using JNI with Servlets.
    thanks very much

    hi,
    I am also facing the same problem,
    when I am using JNI with stand alone application it works fine but when i tried to use it with a servlet It gives unsatisfied linker error
    stack: java.lang.UnsatisfiedLinkError: createSocket
         at RelayConnector.createSocket(Native Method)
         at RelayServlet.doGet(RelayServlet.java:70)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.iplanet.server.http.servlet.NSServletRunner.invokeServletService(NSServletRunner.java:891)
         at com.iplanet.server.http.servlet.NSServletRunner.Service(NSServletRunner.java:458)
    It seems i have to do some path settings in my iplenet web server.
    If some one have faced the problem i would be glad to know the solution for this, i am literally bugged up,....

  • Forward with servlets

    Im using tomcat 4.06 and i have some problems with servlets and forwarding:
    This is my servlet:
    import java.io.PrintWriter;
    import java.io.IOException;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import javax.servlet.RequestDispatcher;
    import javax.servlet.ServletContext;
    public class NTenant extends HttpServlet {
    public void doPost(HttpServletRequest request, HttpServletResponse response)
    throws IOException, ServletException {
    String email = request.getParameter("tenant");
    //insert new tenant into database.
    System.out.println("Redirigiendo");
    ServletContext sc = getServletConfig().getServletContext();
    RequestDispatcher rdNext = sc.getRequestDispatcher("/tenantForm.html");
    rdNext.forward(request, response);
    System.out.println("Redirigido");
    I get this error:
    type Status report
    message Servlet invoker is currently unavailable
    description The requested service (Servlet invoker is currently unavailable) is not currently available.
    This is my dir structure:
    webapps\form\NewTenant.html
    webapps\form\tenantForm.html
    webapps\form\WEB-INF\web.xml
    webapps\form\WEB-INF\classes\NTenant.class
    webapps\form\WEB-INF\classes\TenantServlet.class
    The problem is that i cannot find my html, what must i write here? sc.getRequestDispatcher("/tenantForm.html"); <-----
    Thank you very much

    I heve tried with "../tenantForm.html"
    java.lang.IllegalArgumentException: Path ../tenantForm.html does not start with a "/" character
         at org.apache.catalina.core.ApplicationContext.getRequestDispatcher(ApplicationContext.java:572)
         at org.apache.catalina.core.ApplicationContextFacade.getRequestDispatcher(ApplicationContextFacade.java:174)
         at NTenant.doPost(NTenant.java:19)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    Now Im trying with:
    RequestDispatcher rdNext = sc.getRequestDispatcher "/../tenantForm.html");
    And I got:
    type Exception report
    message Internal Server Error
    description The server encountered an internal error (Internal Server Error) that prevented it from fulfilling this request.
    exception
    java.lang.NullPointerException
         at NTenant.doPost(NTenant.java:20)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:465)
         at org.apache.catalina.servlets.InvokerServlet.doPost(InvokerServlet.java:216)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
         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.valves.CertificatesValve.invoke(CertificatesValve.java:246)
         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.StandardContext.invoke(StandardContext.java:2347)
         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:1027)
         at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125)
         at java.lang.Thread.run(Thread.java:536)
    Any other idea?

  • Portal Release 1 (1.2.2.2) with servlet portlets Error

    Hi,
    Iam trying to get a servlet to work as portlet but I am getting the following error:
    Can anybody help me with this problem.
    [31/07/2003 13:29:38:484 CEST] sample/init
    [31/07/2003 13:29:41:171 CEST] vertis/Response status: 500 : java.lang.NoSuchMethodError: javax.servlet.http.HttpServletRequest: method setAttribute(Ljava/lang/String;Ljava/lang/Object;)V not found
         at com.nl.vertis.pd.controller.PdController.doGet(PdController.java:56)
         at com.nl.vertis.pd.controller.PdController.doPost(PdController.java:68)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:521)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:588)
         at oracle.portal.provider.v1.http.Servlet20Renderer.renderBody(Servlet20Renderer.java:155)
         at oracle.portal.provider.v1.RenderManager.render(RenderManager.java:165)
         at oracle.portal.provider.v1.http.ServletProviderResponse.showPortlet(ServletProviderResponse.java:524)
         at oracle.portal.provider.v1.http.HttpProvider.dispatchProviderAction(HttpProvider.java:660)
         at oracle.portal.provider.v1.http.HttpProvider.service(HttpProvider.java:390)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:588)
         at org.apache.jserv.JServConnection.processRequest(JServConnection.java, Compiled Code)
         at org.apache.jserv.JServConnection.run(JServConnection.java, Compiled Code)
         at java.lang.Thread.run(Thread.java, Compiled Code)Below is the provider config I use for this servlet-portlet
       <portlet class="oracle.portal.provider.v1.http.DefaultPortlet">
          <id>1</id>
          <name>LOIServletController</name>
          <title>LOI Servlet Controller</title>
          <description>LOI Servlet Controller description</description>
          <timeout>10</timeout>
          <timeoutMessage>LOI/PD controller timed out</timeoutMessage>
          <hasHelp>false</hasHelp>
          <hasAbout>false</hasAbout>
          <showDetails>false</showDetails>
          <showEdit>false</showEdit>
          <showEditDefault>false</showEditDefault>
          <acceptContentType>text/html</acceptContentType>
          <renderer class="oracle.portal.provider.v1.RenderManager">
             <appPath>&virtualRoot;</appPath>
             <appRoot>&physicalRoot;</appRoot>
             <contentType>text/html</contentType>
             <charSet>UTF-8</charSet>
             <renderContainer>true</renderContainer>
             <showPage class="oracle.portal.provider.v1.http.Servlet20Renderer">
                <servletClass>com.nl.vertis.pd.controller.PdController</servletClass>
             </showPage>
          </renderer>
          <personalizationManager class="oracle.portal.provider.v1.FilePersonalizationManager">
             <dataClass>oracle.portal.provider.v1.http.BaseCustomization</dataClass>
             <useHashing>true</useHashing>
          </personalizationManager>
       </portlet>

    Thanx,
    But how do I do that???
    Ive got the following servlet that functions as a controller. How do I recode it to work with jserv and pdk V2/1 or can u point me to some portal/servlet related examples?
    And then especially the get/setAttribute and dispatch functions.
    package com.nl.vertis.pd.controller;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.PrintWriter;
    import java.io.IOException;
    import java.util.Map;
    import java.util.Set;
    import java.util.Iterator;
    import java.util.Enumeration;
    import java.util.Vector;
    import oracle.portal.provider.v1.*;
    import oracle.portal.provider.v1.http.*;
    import com.nl.vertis.util.GenericConfigObject;
    import com.nl.vertis.pd.data.*;
    import com.nl.vertis.blueprint.model.Constants;
    import com.vertis.util.log.*;
    import com.vertis.util.log.handler.*;
    public class PdController  extends HttpServlet implements Constants {
      private static final String CONTENT_TYPE = "text/html; charset=windows-1252";
      private String _firstAction = "Search.do";
      private Config _cnf = null;
      private AppModuleLOIImpl _app = new AppModuleLOIImpl();
      private GenericConfigObject _obj = null;
      private BasicLog _logger = null;
      public void init(ServletConfig config) throws ServletException {
        try {
          if (config.getInitParameter("cFirstAction") != null) {
            _firstAction = config.getInitParameter("cFirstAction");
          if (_logger == null) {
            _logger = new BasicLog();
            _logger.addHandler(new FileHandler(LOG_PATH,LOG_FILENAME));
          // Even de configuratie inlezen.
          if (_cnf == null) {
            _cnf = new Config();
        } catch(Exception e) {
          e.printStackTrace();
        super.init(config);
      public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        _logger.activate();
        _logger.info("PdController","doGet","Starting..");
        GenericConfigObject _action = getActionObject(request);
        _logger.info("PdController","doGet","the action name = "+_action.getString("action"));
         request.setAttribute("actionObject",_action);
        _logger.info("We zijn voorbij een setAttribute gekomen");
        HttpSession _session = request.getSession();
        if (_session.getAttribute("appModule") == null) {
          _session.setAttribute("appModule",_app);
        RequestDispatcher dispatcher = request.getRequestDispatcher(_action.getString("action"));
        dispatcher.forward(request,response);
      public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doGet(request,response);
      private GenericConfigObject getActionObject(HttpServletRequest request) {
        String _objnName = null;
        if (request.getParameter("path") != null) {
          _logger.info("request.getParameter(\"path\") != null");
          _objnName = (_cnf.getGlobalForward(request.getParameter("path"))).getString("name");
          _logger.info("global forward 2 action name = "+_objnName);
        } else {
          _logger.info("request.getParameter(\"path\") == null");
          _logger.info("first action name = "+_firstAction);
          _objnName = (_cnf.getGlobalForward(_firstAction)).getString("name");
          _logger.info("global forward 2 action name = "+_objnName);
        return _cnf.getAction(_objnName);
    }

  • Help with servlet

    I have a project with servlets in the 2 following folders
    myprojects and myclasses
    In my projects I have the helloProject and inside it I have the helloHtml folder and the helloPackage.
    So in the helloHtml folder I have the hello.html file and in the helloPackage I have the Hello.java (which is the servlet)
    when I compile this .java file the class file is inserted in the file myclasses\helloProject\helloPackage
    First in the file hello.html I have the code
    action="http://localhost:8080/servlet/helloPackage.Hello
    and so the servlet is executed fine.
    The problem is that I need to put a button in the code of Hello.java
    so that I can have reloaded the first page which is the hello.html
    But I am confused if I write onclick=history.go(-1) I have what I want but this page is not reloaded so I have some parameters there that I do not want
    Can I write sth like onclick=location.href=http://locahost:8080/.....??
    Could you please give me an advice considering the above description of my files??
    Thank tou very much....

    use sendRedircet(String AbsoluteURL) to send the Browser a redirect header so the browser send a new (fresh) request to the serlvet (with any parameter you specified).

  • Gzip with servlet

    Hi,
    I am facing a problem with servlet which compresses the MS Excel files in gzip format,
    when i try opening the Template.gz file using winzip or gzip.exe,it throws me an error as either " invalid zip file" or " archive directory not valid"
    Can someone pls help in resolving this porblem,
    Its very very urgent for me to solve this problem,
    My servlet code snippest is as below,
    I am using Microsoft Internet Explorer 6.0 to download template.gz file which supports gzip and deflate formats,
    --------TemplateGenerator.java-----------------
    public void doPost(HttpServletRequest req, HttpServletResponse res)
    String encodings = req.getHeader("Accept-Encoding");
    System.out.println(encodings);
    res.setHeader("Content-Encoding", "gzip");
    res.setHeader("Content-Disposition", "attachment;filename=Templates.gz");
    try{
    //First create User directory
    String dir = "C:/";
    String separator = System.getProperty("file.separator");
    //Read the files in the current directory and write to zip file
    GZIPOutputStream zip = new GZIPOutputStream(res.getOutputStream());
    File dir1 = new File(dir);
    File[] list = dir1.listFiles();
    if(list == null)
    System.out.println("No files");
    else
    for(int k=0;k < list.length; k++)
                                       int filelen = (int)list[k].length();
                                       System.out.println("File Length :"+filelen);
                                       FileInputStream fis = new FileInputStream (list[k]);
                                       byte[] tempfile = new byte[filelen];
                                       int bytesRead = fis.read( tempfile,0,filelen );
                                       // checking bytesRead not shown.
                                       fis.close();
                                       // write the contents into the zip element
                                       zip.write( tempfile , 0, filelen );
                                       zip.finish();
    // close the entire zip
    zip.flush();
    zip.close();
    -------------------------------------------------

    Hi !
    I am using following code to do that in my project, It might help you..
       String message = "your String" ;
                ByteArrayInputStream bais = new ByteArrayInputStream(message.getBytes());
                InputStreamReader isr = new InputStreamReader(bais);
                XmlPullParser pp = new KXmlParser();
                pp.setInput(isr);-Jestan

  • Forms6i Servlet problem--Ora-12222 No such protocol adapter

    Hi, everyone,
    Our platform: Oracle 9ias 1.0.2.2 with Forms
    server 6i patch 4 ( default installation ubder Enterprise Edition).
    Forms service using CGI is fine, which means
    I can run http://myserver/dev60cgi/ifcgi60.exe?form=mytest_form
    without any problem; But if I run it using
    servlet, as instructed in Forms patch 4 white paper,the logon appears and when I type my username/passwd/database to logon,
    I always get the error message:
    " Ora-12222, no such protocl adapter".
    The following is my diagnosis:
    1. tnsnmaes.ora under both iSuites and
    806 is configured as protocl=TCP and
    Sql*Plus under both Oracle_home can
    connect to the database.
    2. Forms CGI mode is working fine w/o
    any connection problem.
    3. when I run Servlet troubleshooting
    illustrated in White paper, I can run
    Step 1 with no problem:
    Forms 6i Listener Servlet displays
    and Testing native method call is
    running fine.
    At this point I think the Forms Servlet is
    configured correctly, I am just wondering
    which Oracle Home Net the Listener is looking
    for? \iSuites\network Or \806\net80?
    Under both directories I believe I got the
    right tnsnames.ora.
    Has anybody got similar problem as mine?
    Any suggestions are greatly appreciated.
    sean zhang
    [email protected]
    null

    I had a similar problem after I installed Forms6i on a machine I had already installed Oracle8i. I of course added an entry to Forms6i's tnsnames.ora. I could still log into Oracle8i with SQL*Plus 8.1.7, but I could not log into the database with SQL*Plus 8.0.6 or Forms6i. I would get error "ORA-12222: No such protocol adapter".
    It turned out that the Oracle8i installer had added an ORACLE_HOME environment variable for the userid I installed the software with that was set to C:\Oracle\Ora81. When I removed the environment variable, I was able to log in from both Oracle8i's utilities and Forms6i. I then added a TNS_ADMIN entry in the Windows registry under HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE, specifying the location of my Oracle8i tnsnames.ora file so both distributions would use the same Net8 configuration.

  • Applet failed to communicate with servlet for https, on tomcat5.0+apache2.0

    Hi
         I have a problem, we have a tomcat5.0 and apache 2.0 with jk connector, and an application where an applet comunicate to servlet.
    we need to set the ssl , the apache is configured with the ssl( openssl,).
    when I run the application with standalone tomcat with ssl
    connector (port 8443)enable, it runs fine for both http and https.
    i use httpsURLconnection for https communication from applet to servlet.
    But at production envoirment (Tomcat 5.0 , apache 2.0 and j connector with ssl enable at apache) it fails for https, all the jsps runs properly, but the applet isn't communicating with servlet. can anyone guess what is the problem.
    the exception dump is
    ava.io.IOException: Unable to tunnel through proxy. Proxy returns "HTTP/1.1 401 SSL Connection Not Granted"
         at sun.net.www.protocol.http.HttpURLConnection.doTunneling(Unknown Source)
         at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source)
         at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
         at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source)
         at com.blu.HttpMessage.sendGetMessage(HttpMessage.java:65)
         at com.blu.HttpMessage.sendGetMessage(HttpMessage.java:38)
         at com.blu.applet.ServerDAO.sendDummyRequest(ServerDAO.java:66)

    Make sure your deployment is using a supported network configuration, we do not support running under localhost. Your SGD  server needs a valid DNS name configured.
    See
    2.1. SGD Server Requirements and Support
    for more details

  • JAXWS servlet problem

    I made couple of samples that works just fine, but here I am, stuck with this problem for over a week.
    I followed examples, tutorials and other stuff, and I done several succesfull projects. I done dispatch and provider version, and now i can't do basic hello word example!@# I'm using Glassfish and NetBeans 5.5.
    I get
    Allocate exception for servlet *Servlet.
    at com.sun.enterprise.webservice.JAXWSServlet.init( JAXWSServlet.java 110)
    There is a sea of exmaples. It's all mixed up. So can someone show me the right way to do web services?
    Thanks in advance

    Hi
    I've got the same problem. Do you resolve it?. I'm for 3 days to try to save the problem. I don`t find the solutions.
    If you has found the solutions. Please tell me it.
    Thank you in advance

Maybe you are looking for

  • How to resolve preview when crashing on print?

    Preview crashing when asked to print pdf or ping files. Only adobe works to print but preview was much more convenient to use when it was working the same printer before. So I'd like it to stop crashing if possible. Should I delete and re download th

  • Can I have same Itunes library in two computers?

    I would like to have the same library in two computers. If I use home share to import the whole library, Does that mean the library will disappear from the "old" computer? or Will I be able to keep the same library in both computers? What will happen

  • How can I export Keywords when creating a Web Gallery?

    I would like to include the keywords applied to an image when exporting to a Web Gallery. I have learned how to include the caption, and there's a possibility of copy and paste the keywords to the caption before export, but as you can tell, that adds

  • How do I convert email and all attachments into pdf?

    I have multiple emails with attachments that need to be converted to PDF.  Using Adobe Pro 11 I can create an email that is pdf with the attachments embedded in their original format, but not as pdf.  I can "un-embed" the attachments and convert to p

  • GUI sending data to C program

    Hi I am pretty comfortable making a Swing GUI...but i was told today by my mentor that he wants the data ( that user puts in Text fields and etc) to be sent to a c program. so JAVA GUI is just there for the user...all the back ground work is done by