Solved

Some miscellaneous questions about J2EE 1.4 and deployment

Posted on 2004-10-19
4
284 Views
Last Modified: 2010-04-01
Hi,

I'm looking at j2ee 1.4 tutorials and deployed a few examples.  Trouble is that I don't understand many things.  

1. For example,the ConverterApp example, under ConverterWAR object, EJB Ref tab, there are the Home Interface and the Local/Remote Interface.  The value of Home Interface is "converter.ConverterHome."  What does the "converter." preceding ConverterHome refer to?  Is is a directory, is it a path for the url using context root as the reference point or what?

2. For a simple JSP app w/ one entity bean and one table (used pointbase), do I have a need for a JAR file or do I only need a WAR file?

3. My jsp page begins w/ the following line:

      <%@ page import="converter.Converter, converter.ConverterHome, javax.ejb.*, java.math.*, javax.naming.*, javax.rmi.PortableRemoteObject, java.rmi.RemoteException" %>

What does "converter." in "converter.Converter" from above stand for?  Again is it a directory, a url reference or what?

4. In a JSP file, I have the following code:
         Object objRef = ic.lookup("java:comp/env/ejb/TheConverter");

What does "java:comp/env/ejb/TheConverter" refer to?

5. Do all JSPs require jspInit() and if not, when not needed?

6. Why is it that Context Root is sometime preceded by a "/" as in "/converter" and sometimes not?

7. When do you need to enter information into the Resource Ref's (tab) section for a WAR file (eg. jdbc/ItemDB as coded name)?
0
Comment
Question by:skip1000
  • 2
4 Comments
 
LVL 8

Accepted Solution

by:
kiranhk earned 500 total points
ID: 12350790
1) converter is the package where the Converter remote interface has been defined. In the file system it will be a folder
2) any EJB (Session/Entity Bean/Message Driven Bean) will be packaged into a jar file with their respective deployment descriptors XML's
3) Refer to answer 1 above
4) It refers to the JNDI name of the EBJ which is deployed on the server
5) If you have to initialize any kind of resource or do something when ur Servlet starts up then u can have that code in ur init method. If u dont have anything like that then u can leave it.
6) Context root is basically the web application Alias name which the Web Server maps to the directory while serving the pages.
7) If your web layer is using up any Resources provided by the Application Server u can enter it.


Meanwhile you can check out these links to understand it better

http://java.sun.com/developer/onlineTraining/index.html

Going thro' these tutorials will help u understand better

Kiran
0
 

Author Comment

by:skip1000
ID: 12354829
Hi Kiran,

Thanks for your response.  I want to elaborate a little more:

1) Speaking of packages, I noticed that some ejb java files contain the following line of code as in this example:

      package converter;

The converter refers to the directory converter right?  When do you need to include it in the java files?  Do you include them when the client file, say Client.class and index.jsp file is 1 level above the ejb directory (in this case the converter directory)?  For example, Client.class and index.jsp is in C:\temp\ dir and ConverterBean.class is in c:\temp\converter\ dir

2) Does the Sun deployment tool create all the xml descriptor files I need for a simple app w/ 1 jsp, 1 ejb, and 1 table -- jsp just output content of table to page using ejb.

6) When do you need the "/" as in "/Converter".  I've also seen context root w/o the "/".

Thanks.
0
 
LVL 35

Expert Comment

by:TimYates
ID: 12355934
1)
I think you are confused about packages...

http://java.sun.com/docs/books/tutorial/java/interpack/packages.html
http://mindprod.com/jgloss/package.html

Should help...yes, it is to do with directory, but that is not really the point...  It's more a way of keeping classes together in a structured way so you can import just those classes which perform a certain function

2)
I think the sun deployment tool only does EJB jar files, so won't have anything to do with your jsp

6)
Normally (in your JSPs), you won't need to put the context "/Converter", as you will already be there...
0
 
LVL 8

Expert Comment

by:kiranhk
ID: 12358687
1) Check out the answer by TimYates or check out the J2SE tutorial from the link which i gave you.
2) Which deployment tool are you speaking of?? is it the Sun Reference Implementation Server or u have other Application Servers like Weblogic, Websphere or Jboss.
Check out the code from the links below. The XML deployment descriptors can be taken from any of these sample code and modified according to your classes.

http://dev2dev.bea.com/code/ejb.jsp

http://www.bablokb.de/ejb/

6) In your JSP if you refer to anything like other JSP/JPEG images etc..  with a "/" like "/converter" it means it will take from the root context like it will be appended after http://localhost:8080/converter
If you dont refer to it with a "/" it means it is the relative path which is taken from the path of the current JSP/Servlet you r executing


hope this helps
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
unit test DAO layer 1 142
Fisheye tool 2 121
maven set up 2 187
junit example issue 2 22
While it may be true that the internet is a place of possibilities, it is also a hostile environment lurking with many dangers. By clicking on the wrong link, trusting the wrong person or using a weak password, you are virtually inviting hackers to …
This article summaries thoughts and ideas from two years of sustained use. It provides good reasoning to make the jump to Windows 10.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question