URL retrieval from a JSP

Hi,
          I've gotten everything working in our cluster except this. We have some
          JSP's that retrieve resources via a URL that points back to the cluster.
          i.e. the JSP retrieves an xml template from the server and then populates
          the nodes before returning it to the client. Here is a sample JSP
          <%@ page import="java.io.*" %>
          <%@ page import="java.net.*" %>
          <html>
          <head></head>
          <body>
          <%
          String fileURL = "http://"+request.getServerName() + ":" +
          request.getServerPort()+request.getContextPath()+
          "/xml_dataisland/posse_permissions.xml";
          java.net.URL defaultURL = new URL(fileURL);
          URLConnection connection = defaultURL.openConnection();
          if(connection == null){
          System.out.println("null connection in posse_menu.jsp");
          InputStream reply = connection.getInputStream();
          if(reply == null){
          System.out.println("null reply connection in posse_menu.jsp");
          BufferedReader from_server = new BufferedReader(new
          InputStreamReader(reply));
          String line = "";
          StringBuffer results = new StringBuffer();
          while(line != null)
          line = from_server.readLine();
          if(line != null)
          results.append(line);
          out.println(results);
          %>
          </body>
          </html>
          This is generating an exception:
          <Jan 10, 2003 10:38:37 AM MST> <Error> <HTTP> <101019>
          <[ServletContext(id=1213906002,name=posse,context-path=/posse)] Servlet
          faile
          d with IOException
          java.net.ConnectException: Tried all: '1' addresses, but could not connect
          over HTTP to server: '125.125.125.125', port: '64577'
          at weblogic.net.http.HttpClient.openServer(HttpClient.java:223)
          at weblogic.net.http.HttpClient.openServer(HttpClient.java:276)
          at weblogic.net.http.HttpClient.<init>(HttpClient.java:127)
          at weblogic.net.http.HttpClient.New(HttpClient.java:169)
          at
          weblogic.net.http.HttpURLConnection.connect(HttpURLConnection.java:111)
          at
          weblogic.net.http.HttpURLConnection.getInputStream(HttpURLConnection.java:28
          1)
          at jsp_servlet.__test._jspService(__test.java:101)
          at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
          at
          weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(Servle
          tStubImpl.java:1058)
          at
          weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
          :401)
          at
          weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
          :445)
          at
          weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
          :306)
          at
          weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(W
          ebAppServletContext.java:5412)
          at
          weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManage
          r.java:744)
          at
          weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo
          ntext.java:3086)
          at
          weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java
          :2544)
          at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:153)
          at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:134)
          >
          The 125.125.125.125 address is the ip of our load balancer (cisco css11503)
          and should just forward all traffic to one of the two cluster machines.
          Either 125.125.125.1 or 125.125.125.2. Is there something I'm missing here?
          It seems like this should work but I'm not following why it isn't.
          Cluster environment: 2 managed servers running WLS 7.0 sp1
          TIA,
          -Brett Schmoll
          ADP/SIS
          

If I understand, "SELECT count(*) ..." always returns one row.
So, just do
String count="SELECT count(*) c from anticles";
ResultSet rscount=stmt.executeQuery(count);
int countInt = 0;
if(rscount.next()){
  //get the count, an integer
countInt = rscount.getInt("c");
//print out the count. If there were errors, countInt is already set to 0.
out.println(countInt);
Hope this helps.

Similar Messages

  • How can I invoke a JSP using a URL instance from another JSP?

              Hi all.
              I've been developed a J2EE application using Oracle 9iAS.
              Now I'm migrating to WL Server and I have the following problem.
              I was using the following code to read a URL contents from another JSP:
              URL url = config.getServletContext().getResource("/path/to/url/of/textfile.xsl");
              This was working fine in a expanded directory project structure (typical during
              development time) and Oracle 9iAS.
              When I execute this code from my WL packed .ear file I get a URL not found exception.
              Which is the right way to get a resource available from the same context root?
              Thanks in advance for your answers (and sorry for my bad english ;-))
              

    The previous owner of that machine should have wiped it and install the original OS that shipped with the system leaving the system at the point where the new owner takes over and enters all there own information.
    Before you go much further with this machine you should seriously consider backing up any new stuff you have done and wiping it and starting from scratch. If you keep the system like it is you  will be plagued with problems. Even doing OS updates will prove frustrating.
    Right now the best you can do is to move the Aperture that is on the system into the trash, log into the App Store using your ID and buying Aperture. That should work but to be honest I have never had to do it so can;t say for sure.
    You might want to look at this What to do before selling or giving away your Mac from Apple to read what they recommend.
    good luck
    regards

  • How to retrieve the parameter names from a JSP page ? Urgent Please

    Hello,
    Can anybody tell me how to retrieve the parameter names from the JSP
    page. (without using getParameterNames() method.)
    The problem with the getParameterNames() method is I get the Jumbled output.
    I need it very badly
    With regards
    Ananth R
    email:[email protected]
    [email protected]

    Dear duffymo,
    My primary intention is to convert the JSP form information into a XML file.
    If I do not get the Parameter names in the correct order how can I maintain
    tag order in XML file.
    For ex: (JSP PAGE VIEW)
    Name--
    FirstName
    MiddleName
    LastName
    Address--
    Street1
    Street2
    City
    Country
    &so on
    (XML File to be generated)
    <Name>
    <FirstName>Value</FirstName>
    </Name>
    <Address>
    <street1>value</street1>
    </Address>
    & so on
    If I use getParameterNames() to get all the parameter names(Which form the tag names in the XML file ) the Enumeration object it returns will not be in the same order as the text fields in JSP.From this I can not construct a meaningful XML file.
    order means: Order of entry on the page, from top to bottom
    That's it
    Waiting for your responses

  • How do i retrieve information from the JSP into my SELECT statements?

    I need to retrieve the information that is being entered into JSP page.. So that i can use them to do an SQL statement.. but im not very sure if my codes are correct.. Following are my codes.. Pls help.. thx
    MyJSPPage.jsp
    <jsp:useBean id="user" class="user.User" scope="session"/>
    <form name="loanItem" method ="POST" action="user">
    <input type="hidden" name="userID" value="<jsp:getProperty name="user" property="userID"/>">
         <tr><td align=left height="34"> <b> <font size="4">Member ID:</font>
    </b> </td>
              <td height="34">
              <jsp:getProperty name="user" property="userID"/></td>
         </tr>     
    ==================================================================================
    MyManager.java --> this file is where all my SQL statements are ..
    [l]String itemType = session.getParameter("itemType");[l] (--->> is how i retrieve info from the JSP page?)
              if (itemType.equals("Book"))
                   String sqlQuery1 = "select loanDuration from ItemPolicy where itemType ='" + itemType+ "'";
                   System.out.println(sqlQuery1);
                   ItemPolicy itempolicy = null;
                   try {
                        db = new Database();
                        rs = db.readRequest(sqlQuery1);
                        if (rs != null && rs.next()) {
                             itempolicy = new ItemPolicy();
                             itempolicy.setLoanDuration(Integer.parseInt(rs.getString("loanDuration")));
                        db.close();
                   } catch (SQLException se) {
                                  se.printStackTrace();
                                  throw (new UserException("Unable to retrieve from Database!"));
                             } catch (Exception e) {
                                  e.printStackTrace();
                                  throw (new UserException("Unknow error encountered!"));
                   String dueDate = util.getDueDate(itempolicy.getLoanDuration());
              else if (itemType.equals("Magazine"))
    ==================================================================================
    Thanks in advance...

    you should change to request.getParameter("itemType").
    or just System.out.print the itemType to see it got the value.
    Hope it helps.

  • HOW TO MOVE FROM ONE JSP TO ANOTHER BY HIDING URL CHANGES

    HOW TO MOVE FROM ONE JSP TO ANOTHER BY HIDING URL CHANGES IN AN ADDRESS BAR

    Please check before posting that you have not accidentally turned on the CAPS LOCK feature of your keyboard.
    To answer your question. You can't do that. There are alterate ways to solve this sort of problem. What exactly is the nature of the problem you are seeking to solve?

  • How to retrieve the data from a jsp page for print?

    i have a dynamic jsp file which will get the data at runtime.I have a print button in the jsp.When i chick the print button it should capture the data from the jsp and print it as LANDSCAPE mode. Now i am using Java Api for this
              Following code is a working sample which prints some data in LANDSCAPE mode..This is working fine....How can i modify this to get the data from a jsp?....I am using weblogic workshop for development
              package Awtjava;
              //working example
              import java.awt.*;
              import java.awt.print.*;
              public class testPrint implements Printable {
              private static String s[];
              private static Font f;
              private static int nLines;
              public static void main (String arg[]){
              s = new String[10];
              f = new Font("Arial", Font.PLAIN, 11);
              int i;
              s[0] = "This is a printer test";
              for (i=1; i<10; i++){
              s[i] = "The next line";
              nLines = 10;
              testPrint.printa();
              public static void printa(){
              System.out.println("public static void printa () ");
              PrinterJob pj=PrinterJob.getPrinterJob();
              Book b = new Book();;
              PageFormat pf = new PageFormat();
              pf = pj.defaultPage(pf);
              b.append(new testPrint(), pf, 2);
              pj.setPageable (b);
              try{
              if (pj.printDialog()){
              pj.print();
              catch (Exception e) { System.out.println ("Error"); }
              public int print (Graphics g1, PageFormat pf, int n){
              System.out.println("public int print");
              int x,y,i,fa,fh;
              FontMetrics fm;
              Graphics2D g = (Graphics2D) g1;
              pf.setOrientation(PageFormat.LANDSCAPE);
              fm = g.getFontMetrics (f);
              fa = fm.getMaxAscent();
              fh = fm.getHeight();
              x = (int)pf.getImageableX();
              y = (int)pf.getImageableY() + fa;
              g.setFont (f);
              g.setColor(Color.black);
              if (n==1){
              for (i=0; i<10; i++){
              g.drawString (s, x, y);
              y += fh;
              return PAGE_EXISTS;
              else {
              for (i=10;i<10; i++){
              g.drawString (s[i], x, y);
              y += fh;
              return PAGE_EXISTS;
              Hope you will reply soon...
              Thanks in advance
              Maria

    Hey, I got a doubt that who will call the print method in the same program and what about the g.drawString() it is showing any output effect. Finally how the variable n will get initializing to 0 and 1 for two times respectively. Can u please elaborate on this...

  • How to call a report from a jsp page

    Hi
    1) Can anyone please tell me how can i view Discoverer report from a jsp page instead of opening it directly thru plus/viewer.
    2) Please clarify do i need to install Infrastructure and OID for it.
    Please advice.
    Thanks

    You need the AS infrastructure if you want to use connections. If you do not intend using connections, you do not require the infrastructure.
    Note that you cannot pass in passwords in the URL any longer. You do not need to pass passwords if you pass in a Discoverer connection id (but then again - if you don't use connections, then you do need to still pass in the connection information - username, password, database, language, EUL)
    I have a post on my blog that describes how to pass a password using an HTML Form submit - http://oraclebi.blogspot.com/2005/08/passing-password-to-viewer.html
    Thanks
    Abhinav
    Oracle Business Intelligence Product Management
    BI on Oracle: http://www.oracle.com/bi/
    BI on OTN: http://www.oracle.com/technology/products/bi/
    Discoverer: http://www.oracle.com/technology/products/discoverer/
    BI Software: http://www.oracle.com/technology/software/products/ias/devuse.html
    Documentation: http://www.oracle.com/technology/documentation/appserver1012.html
    BI Samples: http://www.oracle.com/technology/products/bi/samples/
    Blog: http://oraclebi.blogspot.com/

  • How can I display a list of records from a JSP to my Midlet ??

    Hi there !
    I'm new in J2ME. I have been strugling with this problem for weeks now. All I find on the net is some theory and is not helping me much. Here the deal
    I have created a Midlet that shoud display a certain list which is from the remote database. The list comes from a JSP file in the server. When I use the browser I can see the list.
    The problem comes when I have to take the same list and output it in my midlet file. Then finding the selected index of the selecte item of the same list and using it somewhere else.
    I would appreciate it if somone could help me !!
    My head is speaning now !!! If you want me to post my code so one could identidy the proble, I don't mind !! Help please !!

    Here is my Code !!
                 String url = "http://10.2.25.3:8080/CreateAppointment/doctorsList.jsp";
        String dateUrl = "http://10.2.25.3:8080/CreateAppointment/date.jsp";
       String myUsername,myPassword;
       // Custom declaration code starts here
       public CreateAppointment_GUI()
                //Creating a login Form
                loginScreen = new Form("Login");
                //Login form Textfields
                username = new TextField("Username:", null, 200, TextField.ANY);
                password = new TextField("Password:", "Initial text", 200, TextField.ANY|     TextField.PASSWORD);
                loginScreen.append(username);
                loginScreen.append(password);
                //Adding the commands
                loginScreen.addCommand(loginCommand);
                loginScreen.addCommand(cancelCommand);
                loginScreen.setCommandListener(this);
                loginScreen.setItemStateListener(this);
                // Creating my selection list
                String[] selectionList = { "1.Appointments", "2.Add New Patient", "3.Patient Details" };
                listSelectAction = new List("Select Action", List.IMPLICIT, selectionList, images);
                listSelectAction.addCommand(backCommand);
                listSelectAction.addCommand(nextCommand);
                listSelectAction.setCommandListener(this);
             public void startApp() throws MIDletStateChangeException
               display = Display.getDisplay(this);
               display.setCurrent(loginScreen);
            public void pauseApp()
            public void destroyApp(boolean unconditional) throws MIDletStateChangeException
                 notifyDestroyed();
            public void itemStateChanged(Item item)
       void getDoctors(String url) throws IOException {
                    HttpConnection connection = null;
            InputStream is = null;
            OutputStream os = null;
            StringBuffer stringBuffer = new StringBuffer();
            TextBox textBox = null;
            String newStr =null;
            String newStr2=null;
            Vector v = new Vector();
           try {
              connection = (HttpConnection)Connector.open(url);
              connection.setRequestMethod(HttpConnection.POST);
              //connection.setRequestProperty(String key, String value)
              connection.setRequestProperty("IF-Modified-Since","20 Jan 2001 16:19:14 GMT");
              connection.setRequestProperty("User-Agent","Profile/MIDP-2.0 Confirguration/CLDC-1.0");
              connection.setRequestProperty("Content-Language", "en-CA");
              connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
              os = connection.openOutputStream();
              is = connection.openInputStream();
              int ch;
              while ((ch = is.read()) != -1) {
                stringBuffer.append((char) ch);
                System.out.print((char)ch);
                   }//while
              newStr = stringBuffer.toString();
                    newStr2=newStr.trim();
                    int start = 0;
                    position = newStr2.indexOf("%", 0);
                    while ((position = newStr2.indexOf("%",start)) > -1) {
                      String aName = newStr2.substring(start,position);
                      v.addElement(aName); // store the substring
                      start = position + 1; // so the next time we start checking following the space
              String[] theNames = new String[v.size()]; // create an array big enough to store the strings
              v.copyInto(theNames); // Now theNames is a String array with the list of names
               // now we can create a List using this array:
               listDoctors = new List("Select Doctor", List.IMPLICIT, theNames,null);
               listDoctors.addCommand(backCommand);
               listDoctors.addCommand(nextCommand);
               listDoctors.setCommandListener(this);
          } //try
           finally {
               if(is!= null) {
                  is.close();
               } //if
               if(os != null) {
                  os.close();
               }//if
               if(connection != null) {
                  connection.close();
               }//if
            }//final
         display.setCurrent(listDoctors);
        } //invoke
    public void commandAction(Command c, Displayable d)
                     if (c == loginCommand)
                      myUsername = username.getString();
                      myPassword = password.getString();
                         Thread thread = new Thread() {
                               public void run() {
                                   try {
                                      getDoctors(url);
                                      display.setCurrent(listSelectAction);
                                   }// Try
                                   catch (IOException ioe) {
                                      ioe.printStackTrace();
                                   }// catch
                               }// Public void
                         };//Thread
                          thread.start();
                     else if (c == cancelCommand && d == listSelectAction)
                     else if (c == nextCommand && d == listSelectAction)
                        int selectedAction = listSelectAction.getSelectedIndex();
                            Alert displayNewText =
                            new Alert("Selected","Screens are still being developed", null, AlertType.INFO);
                                displayNewText.setTimeout(1000);
                         if (selectedAction == 0)
                             Thread thread = new Thread() {
                               public void run() {
                                   try {
                                      getDoctors(url);
                                      display.setCurrent(listSelectAction);
                                   }// Try
                                   catch (IOException ioe) {
                                      ioe.printStackTrace();
                                   }// catch
                               }// Public void
                         };//Thread
                          thread.start();
                         if (selectedAction == 1)
                               display.setCurrent(displayNewText);
                         if (selectedAction == 2)
                               display.setCurrent(displayNewText);
                     }//Else
                     else if (c == backCommand && d == listDoctors)
                          display.setCurrent(listSelectAction);
                     else if (c == nextCommand && d == listDoctors)
                             Thread thread1 = new Thread() {
                               public void run() {
                                   try {
                                      getDate(dateUrl);
                                      display.setCurrent(listDate);
                                   }// Try
                                   catch (IOException ioe) {
                                      ioe.printStackTrace();
                                   }// catch
                               }// Public void
                         };//Thread
                          thread1.start();
                     else if (c == backCommand && d == listDate)
                          display.setCurrent(listDoctors);
    }That is my midlet !! Now here is the code for my JSP !!
                        <%@ page import="java.sql.*" %>
    <%@page import="java.util.*,java.text.*" %>
    <%
    String name="";
    String id = "";
    String connectionURL = "jdbc:microsoft:sqlserver://10.2.25.223;DatabaseName=NDOH_PAAB";
    Connection connection = null;
    Statement statement = null;
    ResultSet rs = null;
    %>
    <%
    try
                            Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
                    catch (Exception ex)
                            out.println(ex.toString());
                            connection = DriverManager.getConnection(connectionURL,"remotepaab_user","mohwiti2004");
                            statement = connection.createStatement();
                            String mysql ="SELECT * from physicians";
                            //out.println(mysql);
                            rs = statement.executeQuery(mysql);
    %>
    <%
          while (rs.next()) {
                 name= rs.getString("name");
                 id = rs.getString("id");
                 out.print(name + "%");
                 out.print(id + "%");
    %>
    <%
    %>
    <% rs.close(); %>In the JSP the name variable is the one that has my List. The problem is how do I say in my Midlet = display the list contained in name. Or in id. I need to use both of them "name + id". the id I will use to find out which name a user ha selected !! Not sure how !!!
    Any help would be appreciated !! Thanks !!

  • Viewing a url selection from a JTree

    Hi,
    I was just wondering if someone can give me some help. I am trying to get a selected node from a JTree which is a url which has been converted into a string to add to the JTree. I use the following code to obtain the selected node by the user:
    TreePath node = tree.getSelectionPath();
    System.out.println(node);I have used system.out.println to see what is actually retreived. The following is retrieved from the tree:
    [Test, http://www.whatever.com]
    test is the node of the tree, all I want is to remove the root from the selection and get the url so I can connect to the net to display the page. How would i do this?
    Many Thanks

    Hi,
    This is the code that I have used:
    TreePath node = tree.getSelectionPath();
    DefaultMutableTreeNode currentNode = (DefaultMutableTreeNode)
    (node.getLastPathComponent());
    System.out.println(currentNode);Found an example, I learn better when I see examples. Do you know anything for connecting to the web to view the url or anywhere where i can find an example?
    Many Thanks
    p.s. sorry for snapping my deadline is at the end of the month and got lots of write up to do as well :(

  • Opening a seeded OAF page from custom JSP page.

    Hi All,
    We have requirement to open a seeded OAF page from custom JSP page.
    When we try to open URL of an OAF page after passing URL input parameters, we are always getting following error:
    'You have insufficient privileges for the current operation. Please contact your System Administrator.'
    On directly accessing the seeded OAF page, its encoding all the input parameters passed in URL. Also some more encoded parameters are getting added to the URL dynamically.
    Is there any standard way exists to invoke seeded OAF pages without passing encrypted parameters to it? Also where can we get more details about
    encrypting OAF URL parameters.
    Any pointers would be appreciated.
    Thanks in advance!
    Saurabh

    Have you duplicated entire Customer Service module's menu in your responsibility?
    or Also ping me the menu name..
    --Prasanna                                                                                                                                                                                                                                                               

  • Invoking BPEL Process from a JSP Page 500 Internal Server Error

    Hi,
    I try to invoke a BPEL Process from a JSP Page and receive the following error. I just pasted the example from the Oracle PM Developer's Guide tutorial. Previously I deployed the CreditRatingService BPEL Process.
    Can anyone help me, please?
    D.
    Here is a sequence from my JSP / and the error I get:
    String ssn = request.getParameter("ssn");
    if(ssn == null)
    ssn = "123-12-1234";
    String xml = "<ssn xmlns=\"http://services.otn.com\">"
    + ssn + "</ssn>";
    Locator locator = new Locator("default","welcome1");
    IDeliveryService deliveryService =
    (IDeliveryService)locator.lookupService
    (IDeliveryService.SERVICE_NAME );
    // construct the normalized message and send to oracle bpel process manager
    NormalizedMessage nm = new NormalizedMessage( );
    nm.addPart("payload", xml );
    NormalizedMessage res =
    deliveryService.request("CreditRatingService", "process", nm);
    Map payload = res.getPayload();
    out.println( "BPELProcess CreditRatingService executed!<br>" );
    out.println( "Credit Rating is " + payload.get("payload") );
    500 Internal Server Error
    java.lang.Exception: Erstellen von "ejb/collaxa/system/DeliveryBean"-Bean nicht erfolgreich. Es wurde folgende Exception gemeldet: "javax.naming.NameNotFoundException: ejb/collaxa/system/DeliveryBean not found
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.3.0) ].server.rmi.RMIServerContext.lookup(RMIServerContext.java:207)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.3.0) ].server.ApplicationContext.unprivileged_lookup(ApplicationContext.java:257)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.3.0) ].server.ApplicationContext.lookup(ApplicationContext.java:197)
         at javax.naming.InitialContext.lookup(InitialContext.java:351)
         at com.oracle.bpel.client.util.BeanRegistry.lookupDeliveryBean(BeanRegistry.java:279)
         at com.oracle.bpel.client.delivery.DeliveryService.getDeliveryBean(DeliveryService.java:250)
         at com.oracle.bpel.client.delivery.DeliveryService.request(DeliveryService.java:83)
         at com.oracle.bpel.client.delivery.DeliveryService.request(DeliveryService.java:53)
         at _InvokeBP._jspService(_InvokeBP.java:65)
         [InvokeBP.jsp]
         at com.orionserver[Oracle Containers for J2EE 10g (10.1.3.3.0) ].http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:462)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.3.0) ].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:713)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.3.0) ].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.3.0) ].server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.3.0) ].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.3.0) ].server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:221)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.3.0) ].server.http.HttpRequestHandler.run(HttpRequestHandler.java:122)
         at com.evermind[Oracle Containers for J2EE 10g (10.1.3.3.0) ].server.http.HttpRequestHandler.run(HttpRequestHandler.java:111)
         at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
         at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:239)
         at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:34)
         at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:880)
    Message was edited by:
    user603180
    Message was edited by:
    user603180
    Message was edited by:
    user603180
    Message was edited by:
    user603180
    Message was edited by:
    user603180
    Message was edited by:
    user603180
    Message was edited by:
    user603180
    Message was edited by:
    user603180
    Message was edited by:
    user603180

    Here is the solution:
    Properties props = new Properties();
    props.setProperty("orabpel.platform", "oc4j_10g");
    props.setProperty("java.naming.factory.initial",
    "com.evermind.server.rmi.RMIInitialContextFactory");
    props.setProperty("java.naming.provider.url", "ormi://localhost/orabpel");
    props.setProperty("java.naming.security.principal", "oc4jadmin");
    props.setProperty("java.naming.security.credentials", "welcome1");
    and several jars have to be added to the project:
    Orabpel.jar , Orabpel-common.jar, oc4j*.jar,
    %ANT_HOME%\lib\ant.jar;
    %ANT_HOME%\lib\xercesImpl.jar;
    %ANT_HOME%\lib\xml-apis.jar;
    %AXIS_HOME%\lib\axis.jar;
    %AXIS_HOME%\lib\axis-ant.jar;
    %AXIS_HOME%\lib\commons-discovery.jar;
    %AXIS_HOME%\lib\commons-logging.jar;
    %AXIS_HOME%\lib\jaxrpc.jar;
    %AXIS_HOME%\lib\log4j-1.2.8.jar;
    %AXIS_HOME%\lib\saaj.jar;
    %AXIS_HOME%\lib\wsdl4j.jar;

  • Executing a report from a JSP

    I built a report in Reports Builder and I want to execute it from a JSP, especifically in the action of the form, something like this:
    <form name="forma2" method= "post" action ="">.
    Am I right?
    What should I write in the action ???
    Thanks for your help.
    Pätricia

    Patricia,
    There are 2 kinds of layout in the report - web layout and paper layout. Web layout is totally JSP-code based. Here you can write normal JSP code, and get the output as an HTML page (just like any other normal JSP). As I wrote in my earlier post, the URL for running the web layout of a report is:
    http://machine:port/<your_application_context_root>/MyReport.jsp?server=...+userid=...
    In this case, just like the output format of any JSP will always be HTML, similarly, the output of a JSP Report will always be HTML. It cannot be any other format like PDF.
    The other type of layout in the report is the paper layout. This layout is graphical, so you can design text boxes, put in color, choose font, etc using the GUI tool in Report Builder. The URL for running the paper layout of a report is:
    http://machine:port/reports/rwservlet?report=...+server=...+userid=...+destype=...+desformat=...+desname=...
    In this case, you can have different output formats, like PDF, RTF, XML, HTML etc.
    Hope this is clear. Another point - just because your report is saved as a *.JSP file, does not mean that it contains only web layout. The same report can contain web layout as well as paper layout. So, in case your JSP report contains paper layout, you can run it using the second URL above, and get the output in PDF.
    You can open your report in Report Builder, and verify whether a paper layout has been defined or not.
    Navneet.

  • Tomcat 6 – Calling a  Java Servlet from a JSP Page

    Below is a very simple JSP Page that calls a Java Servlet. The question is given Tomcat security constraints, is it possible to call a servlet from a JSP and get the correct output without getting an error message? If so, how would you code the web.xml file?
    c:\apache-tomcat-6.0.18
    Under conf
    catalina
    localhost
    HelloWorldExample.xml is directly under localhost
    The application would have this directory structure:
    webapps
    HelloWorldExample
    hello.jsp is directly under HelloWorldExample
    Under HelloWorldExample
    src
    WEB-INF
    classes
    Under classes
    jservlets
    HelloWorld.java is in src folder
    HelloWorld.class is in jservlets folder
    HelloWorldExample.xml
    <Context path="/HelloWorldExample" docBase="HelloWorldExample" debug="0"
          reloadable="true" crossContext="true">    
    </Context>**************************
    hello.jsp
    <HTML>
    <HEAD>
    <TITLE>Hello</TITLE>
    </HEAD>
    <BODY>
    <FONT SIZE="4">
    <P>
    Please enter your name:
    <FORM 
       METHOD="Post"
       ACTION="servlet/jservlets.HelloWorld">
    <TABLE BORDER="3" CELLPADDING="1" WIDTH="100%" ALIGN="CENTER">
    <TR>
        <TD><B>Name:</B></TD>
        <TD><INPUT TYPE="text" NAME="Name" VALUE="" SIZE="65"> </TD>      
    </TR>
    </TABLE>
    <P>
    <INPUT TYPE="SUBMIT" VALUE="Submit">
    </FORM>
    </FONT>
    </BODY>
    </HTML>******************
    HelloWorld.java
    package jservlets;
    import java.io.*;
    import java.util.Date;
    import java.util.*;
    import java.text.*;
    import java.sql.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class HelloWorld extends HttpServlet
       PrintWriter out;
       PrintWriter err; 
       String strName;
    public void displayMessage(HttpServletRequest request, HttpServletResponse response)
          throws Exception
             try
                if (!strName.equals("") && strName != null)
                   out.println("Hello " + strName + "" + "<P>");
                    out.println("Hello World" + "<P>");
                else
                    out.println("Hello World" + "<P>");
            catch (Exception e)
                out.println("Exception: Could not display message." + "<P>");
                err.println (e.getMessage () ) ;
                out.println("<P>");
    public void doPost(HttpServletRequest request, HttpServletResponse response)
               throws ServletException, IOException
          try
               response.setContentType("text/html"); 
               out = response.getWriter();
               err = response.getWriter();
               strName = request.getParameter("Name").trim();
               out.println("<html><head><title>");        
              out.println("</title></head><body>");
               out.println("<FORM");
               out.println("METHOD=POST");
               out.println("ACTION=http://localhost:8080/HelloWorldExample/hello.jsp>");
             out.println("<TABLE ALIGN='RIGHT'>");
             out.println("<TR>");
             out.println("<TD>");          
               out.println("<INPUT TYPE=\"SUBMIT\" VALUE=\"Hello World Page\";>");
               out.println("</INPUT>");
              out.println("</TD>");
             out.println("</TR>");
             out.println("</TABLE>");
             out.println("</FORM>");
             out.println("<BR CLEAR='all'>");
               out.println("<P>");        
               displayMessage(request, response);
               out.close();
             out.println("</body></html>");               
           catch(Throwable e)
              e.printStackTrace();
          public void doGet(HttpServletRequest request, HttpServletResponse response)
             throws ServletException, IOException
             doPost(request, response);
    web.xml
    <servlet>
          <servlet-name>HelloWorld</servlet-name>
          <servlet-class>jservlets.HelloWorld</servlet-class>
    </servlet>  
    <servlet-mapping>
            <servlet-name>HelloWorld</servlet-name>
            <url-pattern>/servlet/HelloWorld</url-pattern>
    </servlet-mapping>      ******************************
    HelloWorld.java can be compiled by using javac.
    Once compiled, HelloWorld.class would be moved to the jservlets folder.
    FYI, coding the above url-pattern results in:
    HTTP Status 404
    The requested resource (/HelloWorldExample/servlet/jservlets.HelloWorld) is not available
    The following url-pattern in the web.xml file permits the servlet to be executed but results in a null pointer exception:
    <servlet-mapping>
            <servlet-name>HelloWorld</servlet-name>
            <url-pattern>/ </url-pattern>
    </servlet-mapping>      **************************************************
    Robin

    This problem was resolved.
    In hello.jsp
    ACTION="servlet/jservlets.HelloWorld">
    was replaced with
    ACTION="servlet/HelloWorld">
    Robin

  • How to store data in KM from a JSP file

    Hi
    In our portal we have a JSP file with a text view where the user can add notes/things to remember etc. I need somewhere to store that information. I don't want to store it directly on the portalserver or the backendsystem. Is there a way to store the information of each user in KM from the jsp page? Is there a service/api I can use ?
    Thanks
    /Jakob

    Hi
    I used following code to upload file in km using wd java:
    /*Get an object of current Portal user */ IWDClientUser wdClientUser =
    WDClientUser.getCurrentUser(); com.sap.security.api.IUser sapUser = wdClientUser.getSAPUser();
    /*create an ep5 user from the retrieved user
    IUser ep5User =WPUMFactory.getUserFactory().getEP5User(sapUser);
    ResourceContext context = new ResourceContext(ep5User);
    /*Give the path to KM in the variable path */
    RID rid = RID.getRID(path);
    IResourceFactory factory =
    ResourceFactory.getInstance();
    ICollection folder = (ICollection) factory.getResource(rid,context);
    Using the upload element we can upload the files to a location in the server drive
    /*temperory location for writing */
    String location = u201Cgive the location hereu201D;
    String fileName = location+fileelement.getFilename();
    file = new File(fileName);
    /Create an output stream for writing to the temperory location/
    FileOutputStream out = new FileOutputStream(file);
    out.write(fileelement.getFiledata());
    out.close();
    /From the temporary location read the file using an input stream/
    FileInputStream fin = new FileInputStream(fileName);
    fin.read();
    /*Using this input stream we can write to the repository
    Content content = new Content(fileelement.getFiledata(),fileelement.get) */
    Content content = new Content(fin,"byte", -1);
    IResource newResource = folder.createResource(fileelement.getFilename(),null, content);

  • Error: The report source could not be retrieved from the state object.

    I have been trying to create a report in a JSF page. The relevant parts are below:
    Inside the JSP page, this is the code:
                  <jsp:useBean id="MyBean" class="com.nm.facade.rto.POJOViewerBean" scope="session" />
                    <jsp:setProperty name="MyBean" property="reportLocation" value="Report1.rpt" />
                   <v:reportPageViewer reportSource="#{MyBean.reportSource}"
                                           displayToolbarPrintButton="true"
                                           printMode="ActiveX"
                                           zoomPercentage="100"
                                           displayToolbarExportButton="true"
                                           displayToolbarRefreshButton="true"
                                           viewerName="My Viewer"
                   ></v:reportPageViewer>
    In the backing bean, this is the relevant code:
        public Object getReportSource() throws ReportSDKException
            if (propertiesChanged || reportSource == null)
                propertiesChanged = false;
                if (reportLocation == null)
                    throw new RuntimeException("The reportLocation property must be set before a report source is retrieved");
                ReportClientDocument rcd = new ReportClientDocument();
                rcd.setReportAppServer(ReportClientDocument.inprocConnectionString);
                rcd.open(reportLocation, 0);
                DatabaseController dbc = rcd.getDatabaseController();
                //Create the POJO collection and populate it with data
                ReportData[] data =
                  new ReportData("B.B.", "King", 6, new Date(25, 9, 16)),
                    new ReportData("Muddy", "Waters", 7, new Date(15, 4, 4)),
                    new ReportData("John Lee", "Hooker", 8, new Date(16, 8, 16)),
                    new ReportData("Otis", "Rush", 9, new Date(34, 4, 29)),
                    new ReportData("Buddy", "Guy", 10, new Date(36, 7, 30))
                //Create the result set from the collection of POJOs
                POJOResultSetFactory factory = new POJOResultSetFactory(ReportData.class);
                factory.setVerbose(true);
                POJOResultSet results = factory.createResultSet(data);
                ResultSetMetaData metaData = results.getMetaData();
                //Set the resultset as the report datasource
                      //Get the table name from the 'Set Datasource Location' dialog in the Crystal Reports designer
                String reportTable = "getReportDataDataSource";
                dbc.setDataSource(results, reportTable, reportTable);       
                IReportSource reportSource = rcd.getReportSource();
                if (reportSource == null)
                    throw new RuntimeException("Unable to get a report source.");
            return reportSource;
    In the CRConfig.xml, this is what is there:
    <?xml version="1.0" encoding="utf-8"?>
    <CrystalReportEngine-configuration>
        <reportlocation>../reports</reportlocation>
        <timeout>0</timeout>
        <ExternalFunctionLibraryClassNames>
             <classname></classname>
        </ExternalFunctionLibraryClassNames>
    </CrystalReportEngine-configuration>
    The report template 'Report1.rpt' is packaged under WEB-INF/reports in the war file.
    When I try to generate the report by accessing the JSF page, I am getting an error: "The report source could not be retrieved from the state object. "
    I am not sure what is wrong. Can someone help me in resolving this issue?
    Edited by: renshai on Jul 9, 2009 3:21 AM

    My formatting gets lost and the message looks unintelligible. After some experimentation, I found that if the message exceeds some length, the formatting is removed. Since I couldn't find any way to delete this post, I made another post with the same subject. Please ignore this post and help me to find a solution for the problem posted in the other thread with the same subject. Thanks in advance.

Maybe you are looking for