• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JSP opens in browser doesn't launch

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all, I'm a java sub-novice but was given a task of changing the way a third-party job scheduling application launches by moving the page and supporting files from an Oracle Application Server (Java 1.6) on Windows to an Oracle Weblogic Server (Java 1.7) on Windows. Its a manual install. It is designed as a stand-alone app and it is not being packaged and deployed through the console. We're doing this as a workaround to avoid deploying the default apache webserver that ships with the product as we have stringent security requirements and there is too much paperwork to introduce this into the environment.

I've copied my page with links, a .jsp file which passes parameters and launches one of four instances that I select. In the new environment that page doesn't launch it opens as text in the browser. I'm aware that the java security functions are better/different. I have set the file associations on the server to open the jsp file in IE and have set the file associations on my desktop (accessed through Citrix). I've tried it with Firefox as well and it opens the same way and doesn't launch. I think I'm on the verge of solving this but wonder if there is some server security setting or policy causing this or ....

I've posted this several places with no answers and hope somebody will take a stab at it!
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch!

You cannot just open a JSP file in the browser. It needs to be served by a servlet container such as Tomcat, Resin, Glassfish, or so on. The JSP processing takes place on the server in this servlet container and dynamically generates an HTML file to send as the response.

Just opening the JSP file in the browser doesn't cause any of the JSP server-side processing to occur.

The mechanisms for processing a JSP is detailed in this article.
 
Donald Freeman
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, so the jsp file does have to be served by the Oracle Weblogic OHS server. I'm not sure how to get it to do that. I don't know whether or not to package just the .jsp file, the .jsp file + the web directory containing all the jnlp files that make up the java application, or all of it plus the .html page containing the links in a .war file.

Previously, on the Oracle Application server, the jsp file existed in a j2ee directory under the Apache webserver. I don't know if it was enrolled or registered there. I don't know if you could get things to run just by locating them in the proper directory or not. The .jsp mime-type doesn't exist on this server but does on the old server. I updated the httpd.conf file in both the as_1 and as_inst directories under Weblogic. I'm not really a webbie guy. I'm sort of poking at it. We don't seem to have any java or web talent in this organization.

I appreciate your response, I did read the article at the link and understand why its not launching, I think. Does this have anything to do with file association? On a microsoft site they said to associate the jsp file with internet explorer. But this is server side jsp so that is not appropriate right? Does the file association have anything at all to do with getting this thing to launch or is that all client processing vs server processing?
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Donald Freeman wrote:I don't know whether or not to package just the .jsp file, the .jsp file + the web directory containing all the jnlp files that make up the java application, or all of it plus the .html page containing the links in a .war file.


A JSP almost always depends upon the Java ecosystem in which it lives. On its own, it's just a template. It needs to get its dynamic data from somewhere, and that's likely the Java code. A web app is a complicated beast -- you can't just cut pieces out of it and expect things to work. If you have a war file, why aren't you just deploying it?

Does this have anything to do with file association?


Nothing at all. That's an OS concept that has nothing at all to do with the web app.

On a microsoft site they said to associate the jsp file with internet explorer.


No. Not sure what they are saying, but just opening a JSP in IE will do nothing at all but open it as an uninterpreted HTML file (as you have discovered).

Does the file association have anything at all to do with getting this thing to launch or is that all client processing vs server processing?


What you need to do is to deploy the web app correctly in Weblogic on the server. I've moved this post to the Weblogic forum where someone with Weblogic savvy may be able to try and help.
 
Donald Freeman
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't have a war file *yet*. I was given these instructions below by Oracle. I'm starting to grasp this project and am trying to understand the architecture.
I have a couple of very high-level simple issues. 1) I don't know where the application will "live" when I upload it from the war file. I need to know that because 2) there are 5 .jnlp files which have a hard-coded path reference in them that looks like;

<jnlp codebase="http://snslcvwwls802/uc4v812a/classes/" href="../JavaHelp.jnlp">

I need to know where this app will go so I can change the references. Then I need to know whether or not to package the entire app inside the .war file with my little locally produced jsp that passes parameters to the app. Or, do I just stage it somewhere and point the jsp file at it? I think this is doable I just don't get it yet.

ERROR MESSAGE:

I got this error when I tried to create the .war file in accordance with 5) below:

D:\Compile\Appworx>C:\"Program Files"\Java\jdk1.7\bin\jar -cvf Appworx.war Appworx_build
Illegal option: F
Usage: jar {ctxui}[vfm0Me] [jar-file] [manifest-file] [entry-point] [-C dir] files ...

ORACLE SUPPORT INSTRUCTIONS:

1) Create a folder simpleapp

2) Inside the simpleapp folder create another folder WEB-INF

3) Copy your JSP files in simpleapp folder

4) Copy web.xml amd weblogic.xml in WEB-INF folder

5) Generate WAR file simpleapp.war using below command.
Go to JDK bin folder.
jar.exe -cvf simpleapp.war simpleapp

6) Now go to weblogic admin console--> click on Deployments --> click on Install -->
select the WAR file simpleapp.war click next -->
Select deployment targets -->
select "Install this deployment as an application" -->
Select deployment targets -->
select "Copy this plan onto every target for me" -->
Next-->Finish-->Save--> activate changes.

7) Now access the application.
http://<hostname>:port/simpleapp

Here i am attaching sample application browsestore.war for your reference.
 
Ranch Hand
Posts: 376
2
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Donald Freeman wrote:ERROR MESSAGE:

I got this error when I tried to create the .war file in accordance with 5) below:

D:\Compile\Appworx>C:\"Program Files"\Java\jdk1.7\bin\jar -cvf Appworx.war Appworx_build
Illegal option: F
Usage: jar {ctxui}[vfm0Me] [jar-file] [manifest-file] [entry-point] [-C dir] files ...



probably your path (C:\"Program Files") is confusing to jar.exe
it is better to add JDK to the PATH, so you can call it from anywhere.
 
Donald Freeman
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
German, You seem to be correct about the C:|"Program Files". Its not enough to fail with a "Invalid directory or file name" error but not true enough for the command to work. I created an environment variable JAVA_HOME and changed the problem to an incorrect syntax issue. I suspect that I need a manifest file. The way this thing was deployed previously as a single .jsp file feeding my app on java 1.6 I didn't need it. To package this thing successfully in java 1.7 do I have to have one? If so, do I have to write it or is the manifest file an output of some tool? Do I need a manifest file for a single jsp file (plus web.xml and weblogic.xml). I apologize for being extremely noobish about this but, up until now, not part of my skill set. I'm willing to learn it but not sure how to proceed. I appreciate that I have gotten some help on this forum so thanks!

The commands I am using to try and jar this are:

D:\Compile\Appworx>C:\%JAVA_HOME%\jar -cvf Appworx.war Appworx_build
D:\Compile\Appworx>C:\%JAVA_HOME%\jar cvf Appworx.war -C Appworx_build
D:\Compile\Appworx>C:\%JAVA_HOME%\jar -cvf Appworx.war -C Appworx_build
D:\Compile\Appworx>C:\%JAVA_HOME%\jar -cvf Appworx.war Appworx_build

I'm not sure Oracle support is using exactly the same thing I am or they are cutting and pasting commands not appropriate for this Windows server. I can't get into the server and grab the specific error right how but the first one is the syntax as given from Oracle. It fails and the server returns all the command help which seems to show the -C is not optional and does not include a - in front of the flags.

Usage: jar {ctxui}[vfm0Me] [jar-file] [manifest-file] [entry-point] [-C dir] files ...
Options:
-c create new archive
-t list table of contents for archive
-x extract named (or all) files from archive
-u update existing archive
-v generate verbose output on standard output
-f specify archive file name
-m include manifest information from specified manifest file
-e specify application entry point for stand-alone application
bundled into an executable jar file
-0 store only; use no ZIP compression
-M do not create a manifest file for the entries
-i generate index information for the specified jar files
-C change to the specified directory and include the following file
If any file is a directory then it is processed recursively.
The manifest file name, the archive file name and the entry point name are
specified in the same order as the 'm', 'f' and 'e' flags.

Example 1: to archive two class files into an archive called classes.jar:
jar cvf classes.jar Foo.class Bar.class
Example 2: use an existing manifest file 'mymanifest' and archive all the
files in the foo/ directory into 'classes.jar':
jar cvfm classes.jar mymanifest -C foo/ .
 
Donald Freeman
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For whatever reason I couldn't get this thing into a war file on Windows. I copied my source up to our Solaris server and on the third try it jarred up. This is literally the first time I have done any of this stuff ...I'll move it to weblogic and try to load it...
 
German Gonzalez-Morris
Ranch Hand
Posts: 376
2
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
using an IDE (such us Eclipse) will be easier to create a war file.
 
Donald Freeman
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Re: IDE.... I got that from a 15 minute audience with a java expert working for a competing company on-site. Our customer arranged the consult and what I got was, "Install the JDK and JDeveloper" and use that to package it with. I got a few steps into jdeveloper but couldn't get it to do what I wanted. Everything I am trying to do opens up another can full of worms...installing jdeveloper....etc... every one of those things leads to other diverting problems and uncertainty.

I moved the files up to Solaris and got it to compress and brought it back to the Windows Weblogic Server. I'm following Oracle's instructions but its like bouncing along the wave tops. There are steps missing between the steps he lists. To jump ahead I navigate to my application war file and select next and it kicks me completely out of Weblogic. Now I'm guessing that my Windows Weblogic won't accept a war file packaged on Solaris or there is a problem with my web.xml or weblogic.xml file. I can't get it to compact on Windows at all. The 'cut and paste' instructions I got from Oracle don't work on Windows.

I'd like to figure out if I can deploy this in exploded format, not packaged at all. I found some original BEA instructions for Weblogic from a few years ago and I'm thinking I should just be able to drop this jsp file into a 'magic" folder under some directory structure and have it served. I just can't figure out where it makes sense to do that. I think there is an autodeploy folder but I'm not sure if that is meant for jsp files or what other requirements there are. I'll take another look at that. I am oscillating between various ideas.


Here are Oracle's instructions. This gets me unceremoniously ejected from Weblogic.

6) Now go to weblogic admin console--> click on Deployments --> click on Install --> select the WAR file simpleapp.war click next --> Select deployment targets --> select "Install this deployment as an application" --> Select deployment targets --> select "Copy this plan onto every target for me" --> Next-->Finish-->Save--> activate changes.

7) Now access the application. http://<hostname>:port/simpleapp
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic