::.jsp page is working But .java file is not working::

Hi,
I have made a jsp page in that i am able to fetch data from Oracle 10g XE,Using jboss-4.0.4.GA .Its working fine.
Problem: But when i made the same file in .java. i am able to compile the file but not able to run the file.
Evnironment setting are like:
User Variable::
JAVA_HOME
C:\Program Files\Java\jdk1.5.0_03
CLASSPATH
C:\Program Files\Java\jdk1.5.0_03\bin
C:\oraclexe\app\oracle\product\10.2.0\server\jdbc\lib;
C:\oraclexe\app\oracle\product\10.2.0\server\jdbc\lib\ojdbc14.zip;
C:\oraclexe\app\oracle\product\10.2.0\server\jdbc\lib\ojdbc14.jar;
C:\oraclexe\app\oracle\product\10.2.0\server\jdbc\lib\ojdbc14_g.jar;
C:\oraclexe\app\oracle\product\10.2.0\server\jdbc\lib\orai18n.jar;
System Variable::
PATH
C:\oraclexe\app\oracle\product\10.2.0\server\BIN
Here is my Code:
package com;
import java.sql.*;
import oracle.jdbc.pool.OracleDataSource;
import java.io.*;
class GroupedData
     public static void main(String []args) throws Exception
          OracleDataSource ods = new OracleDataSource();
          ods.setUser("system");
          ods.setPassword("shekhar");
          ods.setURL("jdbc:oracle:oci:@");
          Connection conn = ods.getConnection();
          Statement stmt1 = conn.createStatement();
          ResultSet rs1 = stmt1.executeQuery("SELECT * FROM TEST");
          //Loop through results of query.
          while(rs1.next())
          System.out.print(" |" + rs1.getString("C_IMSI") + " |");
          System.out.print( rs1.getString("C_SIM") + " |");
          System.out.print(" " + rs1.getString("C_NAME") + " |");
          System.out.print(" " + rs1.getString("C_ADDRESS") + " |");
          System.out.print(" " + rs1.getString("C_CITY") + " |");
          System.out.print(" " + rs1.getString("C_STATE") + " |");
          System.out.print(" " + rs1.getString("ASPLDESC") + " |\n");
          Statement stmt = conn.createStatement();
          ResultSet rs = stmt.executeQuery("SELECT ASPLDESC, COUNT(ID) AS OCCURANCE from TEST GROUP BY ASPLDESC");
          //Print start of table and column headers
          System.out.println("| ASPLDESC | Total Occurance |");
          // Loop through results of query.
          while(rs.next())
               System.out.println("| " + rs.getString("ASPLDESC") + " | " + rs.getString("OCCURANCE") + " |");
Here is my jsp file which is working fine with JBOSS:
<%@ page import="java.sql.*" %>
<%@ page import="oracle.jdbc.pool.OracleDataSource" %>
<HTML>
<HEAD><TITLE>Simple Oracle Example</TITLE></HEAD>
<BODY BGCOLOR="#FFFFFF">
<CENTER>
<B>XID Report generation</B>
<BR><BR>
<%
OracleDataSource ods = new OracleDataSource();
ods.setUser("system");
ods.setPassword("shekhar");
ods.setURL("jdbc:oracle:oci:@");
Connection conn = ods.getConnection();
Statement stmt1 = conn.createStatement();
ResultSet rs1 = stmt1.executeQuery("SELECT * FROM TEST");
//Print start of table and column headers
out.println("<TABLE CELLSPACING=\"0\" CELLPADDING=\"3\" BORDER=\"1\">");
out.println("<TR><TH>C_IMSI</TH><TH>C_SIM</TH><TH>C_NAME</TH><TH>C_ADDRESS</TH><TH>C_CITY</TH><TH>C_STATE</TH><TH>ASPLDESC</TH></TR>");
//Loop through results of query.
while(rs1.next())
out.println("<TR>");
out.println(" <TD>" + rs1.getString("C_IMSI") + "</TD>");
out.println(" <TD>" + rs1.getString("C_SIM") + "</TD>");
out.println(" <TD>" + rs1.getString("C_NAME") + "</TD>");
out.println(" <TD>" + rs1.getString("C_ADDRESS") + "</TD>");
out.println(" <TD>" + rs1.getString("C_CITY") + "</TD>");
out.println(" <TD>" + rs1.getString("C_STATE") + "</TD>");
out.println(" <TD>" + rs1.getString("ASPLDESC") + "</TD>");
out.println("</TR>");
out.println("</TABLE>");
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("SELECT ASPLDESC, COUNT(ID) AS OCCURANCE from TEST GROUP BY ASPLDESC");
//Print start of table and column headers
out.println("<BR><BR><TABLE CELLSPACING=\"0\" CELLPADDING=\"3\" BORDER=\"1\">");
out.println("<TR><TH>ASPLDESC</TH><TH>Total Occurance</TH></TR>");
//Loop through results of query.
while(rs.next())
out.println("<TR>");
//out.println(" <TD>" + rs.getString("ID") + "</TD>");
out.println(" <TD>" + rs.getString("ASPLDESC") + "</TD>");
out.println(" <TD ALIGN='RIGHT'>" + rs.getString("OCCURANCE") + "</TD>");
out.println("</TR>");
out.println("</TABLE>");
%>
</CENTER>
</BODY>
</HTML>

user552380,
You don't need three different JDBC drivers in your CLASSPATH, only one.
Are you getting an error message?
If you are then please post the entire error message and stack trace you are getting.
Note that you can use the [ code ] and [ /code ] tags (without the spaces) to format
your code.
Good Luck,
Avi.

Similar Messages

  • We're sorry, but this file is not a valid filetype. GIF, JPEG and PDF files are accepted. Please try again. this is the message its shows when i upload proper format. i do not whom i should ..........

    We're sorry, but this file is not a valid filetype. GIF, JPEG and PDF files are accepted. Please try again.
    We're sorry, but this file is not a valid filetype. GIF, JPEG and PDF files are accepted. Please try again.
    We're sorry, but this file is not a valid filetype. GIF, JPEG and PDF files are accepted. Please try again.
    We're sorry, but this file is not a valid filetype. GIF, JPEG and PDF files are accepted. Please try again.
    We're sorry, but this file is not a valid filetype. GIF, JPEG and PDF files are accepted. Please try again.
    We're sorry, but this file is not a valid filetype. GIF, JPEG and PDF files are accepted. Please try again.
    We're sorry, but this file is not a valid filetype. GIF, JPEG and PDF files are accepted. Please try again.We're sorry, but this file is not a valid filetype. GIF, JPEG and PDF files are accepted. Please try again.

    I got uploaded after many ways. Just logged in windows PC and opened Internet explorer and uploaded it worked.

  • TS3212 Trying to download iTunes 10.7 in Windows 7 64-bit. When I click the download now button, it immediately goes to the "Thank you for downloading" screen, but the file has not downloaded. Popups unblocked. Any thoughts? Thanks!

    Trying to download iTunes 10.7 in Windows 7 64-bit. When I click the download now button, it immediately goes to the "Thank you for downloading" screen, but the file has not downloaded. Popups unblocked. Any thoughts? Thanks!

    I'd first try downloading an installer from the Apple website using a different web browser:
    http://www.apple.com/quicktime/download/
    If you use Firefox instead of IE for the download (or vice versa), do you get a working installer?

  • I have downloaded a music file through a downloader . But the file is not found in the captured in music player . How can I locate the physical location and move the file . I cannot do via itunes also .

    I have downloaded a music file through a downloader . But the file is not found in the captured in music player . How can I locate the physical location and move the file . I cannot do via itunes also .

    Exactly what do you mean by a 'downloader'?
    Thanks
    Pete

  • I've reinstalled OS X 10.7.5 using the Apple servers but my files were not erased, has the HD been reformatted and 10.7.5 reinstalled?

    I've reinstalled OS X 10.7.5 using the Apple servers but my files were not erased, has the HD been reformatted and 10.7.5 reinstalled?

    Reinstalling OS X does not erase your files.
    Compare
    OS X Lion: Reinstall Mac OS X
    and
    OS X Lion: Erase and reinstall Mac OS X - Apple Support

  • How to sent importet RAW files into the cloud? The files was importet from Canon EOS via camera adapter to the iPad. The Files was stored in the folder importet. But the files does not sync with photostream.

    How to sent importet RAW files into the cloud? The files was importet from Canon EOS via camera adapter to the iPad. The Files was stored in the folder importet. But the files does not sync with photostream.

    Welcome to the Apple community.
    Only photos taken on the iOS device and after photo stream was enabled will be added to photo stream.

  • When i open my computer the home page is displayed but blocked, it is not possible to open any application

    when i open my computer the home page is displayed but blocked, it is not possible to open any application, even if my mouse is moving correctly

    You could try wiping the hard drive and reinstalling the OS and all your programs.
    Did you install any programs yesterday?
    If not it may be best to take it to an Apple care center and have it checked out. Take it in while it is asleep so you ccan show then what is happening.

  • Java files work but jar files do not

    Hello everyone!
    My java files run normally and I get a response that I expect (which is successful). Imagine my surprise when I collected them in a Jar and the very same files inside the jar no longer work! I get a response (still generated by my java program) from successful, it turns to Query Expire.
    My problem is, when executed as normal java programs, the expected result is produced. However, when the jars are executed, the result is expired. What is wrong? The classes and the ones in the jar are the same. Is there something different with the mechanism of Jars that make it erroneous?
    Many thanks in advance. I have been working with this for a week with no progress! =(

    Hi!
    Thanks for your reply. Here's what's happening so far:
    I created my java files using Eclipse and using the Export option, I exported them as a JAR.
    When I run my application on Eclipse with the Java files in tow, the output I expect is Done sending: wait for responses now
    Received response from billing api- A: null(0), C: 13, E: Account already registered
    Register: Failed: 1 Failure(s)Now, on to the JAR file.
    I executed the JAR file using the command java -jar <jar name.jar>
    Here's the response:
    Done sending: wait for responses now
    Received response from billing api- A: null(0), C: -1, E: Query expire w/o response
    Register: Failed: 1 Failure(s)My program communicates with a database and this generates the reply that should be received by my program. My ordinary Java file gets the expected output, but the JAR does not.
    Is it possible that the JAR file somehow slows down the transaction? The reply sent by the database isn't received by the JAR -- somehow, the message gets lost.

  • Please help, jsp page wants missing ";" but not to good with jsp?

    I have a JSP page called ftplogin.jsp
    I want the jsp page to call a ftpbean.
    It will pass server, username and login into the ftpbean.
    It will then set the directory and finaly retrieve a a document from it.
    The ftpbean works but my jsp page doesn't. Please help with compilation problem?????
    Please also tell me if the syntax of accessing the bean is correct?
    <!-- ftplogin.jsp -->
    <html>
    <head>
    <title> FTP Login </title>
    </head>
    <body>
    <%@ page import= "ftp.* " %>
    <jsp:useBean class="ftp.FtpBean" id="ftpbean" scope="session" />
    <%
    try
    String servername = request.getParameter("serverName");
    String username = request.getParameter("username");
    String password = request.getParameter("password");
    ftpbean.ftpConnect(servername, username, password);
    catch(Exception e)
    %>
    Sorry but your must have entered an incorrect login ingotmation.
    You are not allowed to login.
    Please leave the ftp portal.
    <%
    %>
    <h1> Welcome to the FTP Login. </h1>
    <FORM ACTION="ftplogin.jsp" METHOD=post>
    Please login
    Enter name of server:
    <input type="text" name="servername"><br>
    Enter user name?
    <input type="text" name="username"><br>
    Enter password
    <input type="text" name="password"><br>
    <input type="submit" name="Submit info">
    </FROM>
    <%=
    try
    // set the directory
    ftpbean.setDirectory("/home/eland/u6/k3074/w0109699/simple-bean");
    catch(Exception e)
    System.out.println(e);
    %>
    <%=
    try
    // Get the binary file '????' and save it to hard disk
    // the name will be 'local_file_name' .
    ftpbean.getBinaryFile("accessbean.jsp", "local_file_name", this);
    catch(Exception e)
    System.out.println(e);
    %>
    <%=
    try
    ftpbean.close();
    catch(Exception e)
    System.out.println(e);
    %>
    </body>
    </html>
    Location: /myJSPs/jsp/grid-portal-project/ftplogin.jsp
    Internal Servlet Error:
    org.apache.jasper.JasperException: Unable to compile Note: sun.tools.javac.Main has been deprecated.
    C:\tomcat\jakarta-tomcat-3.3.1\work\DEFAULT\myJSPs\jsp\grid_0002dportal_0002dproject\ftplogin_1.java:110: Missing term.
    out.print(
    ^
    C:\tomcat\jakarta-tomcat-3.3.1\work\DEFAULT\myJSPs\jsp\grid_0002dportal_0002dproject\ftplogin_1.java:110: ')' expected.
    out.print(
    ^
    C:\tomcat\jakarta-tomcat-3.3.1\work\DEFAULT\myJSPs\jsp\grid_0002dportal_0002dproject\ftplogin_1.java:120: Missing term.
    ^
    C:\tomcat\jakarta-tomcat-3.3.1\work\DEFAULT\myJSPs\jsp\grid_0002dportal_0002dproject\ftplogin_1.java:120: ';' expected.
    ^
    C:\tomcat\jakarta-tomcat-3.3.1\work\DEFAULT\myJSPs\jsp\grid_0002dportal_0002dproject\ftplogin_1.java:121: Invalid expression statement.
    ^
    5 errors, 1 warning
         at org.apache.tomcat.facade.JasperLiaison.javac(JspInterceptor.java:898)
         at org.apache.tomcat.facade.JasperLiaison.processJspFile(JspInterceptor.java:733)
         at org.apache.tomcat.facade.JspInterceptor.requestMap(JspInterceptor.java:506)
         at org.apache.tomcat.core.ContextManager.processRequest(ContextManager.java:968)
         at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:875)
         at org.apache.tomcat.core.ContextManager.service(ContextManager.java:833)
         at org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Http10Interceptor.java:176)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:494)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:516)
         at java.lang.Thread.run(Thread.java:536)

    Please note I have solved the compilation problem.
    But now getting runtime error. Here is the error:
    Error: 500
    Location: /myJSPs/jsp/grid-portal-project2/ftplogin.jsp
    Internal Servlet Error:
    javax.servlet.ServletException
         at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:460)
         at jsp.grid_0002dportal_0002dproject2.ftplogin_1._jspService(ftplogin_1.java:128)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java)
         at org.apache.tomcat.facade.ServletHandler.doService(ServletHandler.java:574)
         at org.apache.tomcat.core.Handler.invoke(Handler.java:322)
         at org.apache.tomcat.core.Handler.service(Handler.java:235)
         at org.apache.tomcat.facade.ServletHandler.service(ServletHandler.java:485)
         at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:917)
         at org.apache.tomcat.core.ContextManager.service(ContextManager.java:833)
         at org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Http10Interceptor.java:176)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:494)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:516)
         at java.lang.Thread.run(Thread.java:536)
    Root cause:
    java.lang.NullPointerException
         at java.net.Socket.(Socket.java:282)
         at java.net.Socket.(Socket.java:118)
         at ftp.FtpBean.ftpConnect(FtpBean.java:323)
         at ftp.FtpBean.ftpConnect(FtpBean.java:293)
         at jsp.grid_0002dportal_0002dproject2.ftplogin_1._jspService(ftplogin_1.java:91)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java)
         at org.apache.tomcat.facade.ServletHandler.doService(ServletHandler.java:574)
         at org.apache.tomcat.core.Handler.invoke(Handler.java:322)
         at org.apache.tomcat.core.Handler.service(Handler.java:235)
         at org.apache.tomcat.facade.ServletHandler.service(ServletHandler.java:485)
         at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:917)
         at org.apache.tomcat.core.ContextManager.service(ContextManager.java:833)
         at org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Http10Interceptor.java:176)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:494)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:516)
         at java.lang.Thread.run(Thread.java:536)
    Here is my directory structure for ".jsp" and ".html" pages:
    C:\tomcat\jakarta-tomcat-3.3.1\webapps\myJSPs\jsp\grid-portal-project2
    Here is my directory structure for java classes,
    C:\tomcat\jakarta-tomcat-3.3.1\webapps\myJSPs\WEB-INF\classes
    ftp
    ftp\FtpBean.java
    ftp\FtpBean.class
    Here is the modified source code:
    <html>
    <head>
    <title> FTP Login </title>
    </head>
    <body>
    <%@ page import= "ftp.* " %>
    <jsp:useBean class="ftp.FtpBean" id="ftpbean" scope="session" />
    <%
               String servername = request.getParameter("serverName");
               String username   = request.getParameter("username");   
               String password   = request.getParameter("password");
               ftpbean.ftpConnect(servername, username, password);
    %>
    <h1> Welcome to the FTP Login. </h1>
    <FORM ACTION="ftplogin.jsp" METHOD=post>
    Please login
    Enter name of server:
    <input type="text" name="servername"><br>
    Enter user name?
    <input type="text" name="username"><br>
    Enter password
    <input type="text" name="password"><br>
    <input type="submit" name="Submit info">
    </FORM>
      <% 
               ftpbean.setDirectory("/home/eland/u6/k3074/w0109699/simple-bean");
      %>
      <%
               ftpbean.getBinaryFile("accessbean.jsp", "local_file_name");
      %>
      <%
                ftpbean.close();
      %>
    </body>
    </html>

  • How to force a jsp page to reload an "include" file?

    Hi there,
    I'm using WebSphere 4.0.2 with the Java 1.3.1 API.
    Some of my JSP files includes another JSP file as follows:
    <%@include file="constants.jsp"%>The above line came from one of the files entitled "main.jsp".
    Other jsp files on our system can rewrite and update the values in constants.jsp.
    However, when they do so, main.jsp (and the other files that "include" constants.jsp) doesn't take on the new settings unless I either a) reboot the server or b) force a recompile of main.jsp
    Is there any way to have main.jsp pick up when constants.jsp is updated and use the new values without manual intervention?
    Thanks!

    You might want to use 'touch' task of ANT. it modifies the jsp page modification time thus forcing the pages to reload.

  • How to include a JSP page contained in a JAR file ?

    Hello,
    I have a Servlet in which I would like to include, in the Response, the content of a JSP page contained in an external JAR file included in my lib directory ?
    Could someone help me please ?
    Thanks in advance.
    bgOnline

    I don't think thats possible with the standard j2ee server.
    There are probably ways around it, but it would involve a large component of custom coding.

  • Jsp Page session vaiable to java class and vise versa

    Hi to all,
    I am new to jsp, i have to programs, one jsp page and another java class. in jsp page i get the user data from html form and put the id in session. here i have to call the session vaiable to my java class where it (variable)initialize a file name.
    and same i have to call the java class to jsp page which insert statements to sql server,
    Please Help Me.

    //My Java Class file
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;
    import javax.servlet.http.HttpSession;
    import java.sql.Statement;
    public class StuInfo extends Object {
    //main method begins execution of Java application
    public static void main (String args[]){
    String StuFile = "C://"+iD+".txt"; // Here i have to get the session varaible.(ID)
    try {
    In my jsp Page i initilized session as
    session.setAttribute("ID",StuId);
    I am not able to understand where i have to declear the HTTPSession#getAttribute("ID");

  • Displaying content in JSP page, want BR but not other Html tags

    I have a page and am reading files and displaying the contents of the files onto the page in a <div> Oneissue is that in the file the end of line are \n or \r\n whichever operation system. I replaced those with <BR> no problem. Now my issue is that I display that in the JSP page:
    <c:out value="${filecontents}" escapeXml="false" />I use escapeXml so that <BR> will add the line breaks. Now my issue is that the file might contains other HTML tags that I want to display simply as text - I don't want the browser to render the other HTML tags.
    Is there a way to do that? Would I have to replace HTML tags with something special?

    Hmm... your file contains HTML tags, but you don't want the browser to interpret them as HTML tags, right? So the way to do that is to use escapeXml="true" in your c:out element.
    But then that also escapes the <BR> tags that you carefully put in there. And you don't want that. You want the browser to interpret those as HTML tags.
    I guess you can't have it both ways. Can you do something like outputting one line of the file at a time with <c:out ... escapeXml="true"> followed by <br>?

  • DIR creation using a template, but template file is not in content Server

    HI Sap Gurus,
    We have a scenario where in we are planning to maintain a different template Files /documents in SAP DMS,
    The user will use this templates to update his details and save the filled in details back accordingly.
    so i have uploaded few files / templates in DC30 for a particular Workstation Application to be used as templates,
    but this templates are not stored in the content server for the client wide access, so if i have uploaded the file from my system only i can access or work with the template,
    why is it so, why is the template not stored in a content server so that every user can access this,
    is there any other better way of maintaining the templates in SAP DMS. please let me know.
    Points Awaiting
    Thanks and regards
    Sathish

    Hi
    There are two options to store templates
    1) Source File :- Where you give the File path in ur PC
    2) Source Document :- It takes the template from a DIR stored - the orginal may be stored in the content server
    Now you have used option 1)..
    Go for 2 ) and store the original in the content server. This will help all users to access the template
    Regards
    Aby

  • Java file is not getting created in gen_sqlj

    Hi All
    I have cretaed a EJB dc.
    when I creating a .sqlj file, its corresponding .java fiel is not getting created in gen_sqlj folder.
    what will be the reason for this?
    how to create that?

    I've got the same problem. Is there a solution for that?

Maybe you are looking for

  • How do I remove an account from app store

    I would like to remove an account on my macpro. When I set up my mac I used my apple ID. I then gave the mac to my son and he is using his apple id. Whenever he needs to update a mac app like iphoto it asks for my apple id. I would like to remove my

  • How do I find the program that is creating a debug file

    Hi, I have a bunch of debug files in /usr/tmp directory on a Unix box. I am using Oracle Apps 11i. How do I find which program is causing this file? There content of the debug files does not have much information to point to any particular program. T

  • Unable to deploy the MSI in Windows 7 64-bit

    Hi there, I try to deploy Adobe Reader 10.1.1 in a new Windows 7 Pro SP1 64-bit installation with the following command line: "msiexec /i AcroRead.msi TRANSFORMS=AcroRead.mst /qn /log log.txt" through MDT 2010. I also tried in a command prompt withou

  • Info about PU12 transaction

    Hi, I am making modifications in a User Exit which is providing data to a file defined for Interface format ZTE1 through tcode PU12 interface toolbox. So, my question is what is this tcode used for ? And if my changes include making modifications to

  • Query Browser not available in Dashboards appl !?

    Hello, We installed SAP BO Dashboards 4.1 SP2 (14.1.2.1121) and want to use universe queries in the dashboard. The workspace feature "Query Browser" is empty. We don't get the icons to logon to BOXI (to universe). Is this an installation issue? What