Discussions

Web tier: servlets, JSP, Web frameworks: Migration of Existing JSP to 10g Environment

  1. Migration of Existing JSP to 10g Environment (2 messages)

    We have bunch of .JSP's around 300 in numbers and few Java Classes(which is our bean library).
     
    I want to import those .jsp's and my library inside our Jdeveloper development environment. And i have achieved this task.
     
     o In Jdeveloper I choosed Application Workspace (No Templates All Technologies).
     o Then i created my java classes (our bean library) by clicking new Java Classes wizard and compiled them.
     o Then i created a jsp file and cut & pasted my actual code into this jsp file.
     o i compiled this also and run the jsp which called few functions in our java classes.
     o It started Embedded OC4J and it executed my jsp well.
     
    Now i had the problem when deploying it to my Oracle App Server.
     
     o Now i created a new web deployment profile .war file
     o I named it and specified the J2EE Web Context root as "builders".
     o I left every other option to default and clicked ok.
     o Now i right clicked the .deploy file and "Deploy to war file".
     o Then I right clicked and choosed deploy to my application server.
     o I got the messge Deployment finished.
     
    I tried to access the application which i just deployed.
     
    It displays the first page index.html (which is in
       <welcome-file-list>
          <welcome-file>index.html</welcome-file>
       </welcome-file-list>
    in Web.xml file)
     
     From that index.html i have a link to jsp in the same directory. When i clicked the link i got java.io.FileNotFoundException.
     
    This happens even to the html file(But 404 file not found exception) if i remove the <Welcome-file-list> from web.xml file.
     
    This is the scenario.
     
    Could anyone of you please let me know what are all the steps i should take care while deploying jsp's. Like deployment profile, Descriptor kind of stuff.
     
    I tried doing my hand.

    I tried to deploy using the following directory structure.
     
    c:\oc4jtest\builders\
         display.jsp
         web-inf\
         web-inf\classes\New_Portal_Java_Classes\*.class ( Java class file which jsp will refer for database object)
         web-inf\web.xml
         index.html
     
     
    I issued a command to create a war file
    C:\oc4jtest\builders\jar -cvf builders.war *
     
    Then i copied builders.war a directory back Now,
     
    c:\oc4jtest\builders
        \builders.war
        \META-INF
        \META-INF\application.xml
        \META-INF\Manifest.MF
     
    Now I issued a command to create a ear file
    c:\oc4jtest\builders\jar cvf builders.ear builders.war META-INF
     
    Now I have
    c:\oc4jtest\builders
          \builders.war
          \builders.ear
     
     Then I deployed using Oracle 10g Appserver Console.
     
    Then i tried to view to page:
     
    http://192.168.0.22/builders
     
    It displayed the page index.html file then i enter something and clicked on submit i got
     
    JSP ERROR:
     
    Request URI:/builders/display.jsp
     
    Exception:
    java.io.FileNotFoundException
     
     
    Could you please suggest me where i am doing wrong. what are all the important things which i should take care of. I have provided the code listing below. Which technology i should choose, what are all the things i should consider when creating deployment profile,descriptor etc.
     
    Thanks
    Shahul Hameed
     
    application.xml listing
     
    <?xml version="1.0"?>
    <!DOCTYPE application PUBLIC "-//Sun Microsystems, Inc.//DTD J2EE Application 1.2//EN" "http://java.sun.com/j2ee/dtds/application_1_2.dtd">
    <application>
       <display-name>Is Web Cache Working</display-name>
       <module>
          <web>
             <web-uri>builders.war</web-uri>
             <context-root>/builders</context-root>
          </web>
       </module>
    </application>
     
     
     
    Web.xml listing
     
    <?xml version = '1.0' encoding = 'windows-1252'?>
    <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
      <description>Empty web.xml file for Web Application</description>
        <welcome-file-list>
          <welcome-file>index.html</welcome-file>
       </welcome-file-list>
      <session-config>
        <session-timeout>35</session-timeout>
      </session-config>
      <mime-mapping>
        <extension>html</extension>
        <mime-type>text/html</mime-type>
      </mime-mapping>
      <mime-mapping>
        <extension>txt</extension>
        <mime-type>text/plain</mime-type>
      </mime-mapping>
    </web-app>
     
     
    index.html source
    <HTML>
    <HEAD><TITLE>The Welcome User JSP</TITLE></HEAD>
    <BODY>
    Enter name:
    <FORM action="display.jsp">
    <INPUT TYPE="text" NAME="user" SIZE=15>
    <INPUT TYPE="submit" VALUE="Submit name">
    </FORM>
    </BODY>
    </HTML>
     
    display.jsp Source
    <%@ page language="java" import="New_Portal_Java_Classes.*, java.util.*;" %>
    <HTML>
    <HEAD><TITLE>The Welcome User JSP</TITLE></HEAD>
    <BODY>
    <% String user=request.getParameter("user"); %>
    <H3>Welcome <%= (user==null) ? "" : user %>!</H3>
    <P> Today is <%= new java.util.Date() %>. Have a fabulous day! :-)</P>
    </BODY>
    </HTML>
  2. Check the WAR[ Go to top ]

    If you unpack the WAR, or just examine it in an Archiving tool like WinZip or Ark do you see everything you expect to see e.g
    The classes you have under WEB-INF as well as the web.xml and jsps.
    I just created a JSP project from scratch just like this - the only additional step I carried out was to edit the project properties and add JSP & Servlets to the Technology scope.
    The WAR file ended up with just my class under WEB-INF (upper case), my jsp in the root and web.xml under WEB-INF as well.
  3. I unpacked the war. Everything is same as you have said. The one thing i left is i haven't added JSP & Servlets to the Technology scope. Now I did that stuff also and deployed it to war file and then deployed to my app server.

    But the result is still the same.. i am still getting FileNotFoundException.