J2EE Interview Questions2

J2EE Interview Questions
Where can I find the XML DTDs for deployment descriptors?

There are three places where you can access the DTD files:

1. DTDs for all components are available at http://java.sun.com/dtd/.

2. Look in the download directory on your system: $J2EE_HOME/lib/dtd/.

3. Every J2EE component’s Specification includes the DTD. Look for specifications under http://java.sun.com/products/.

The use of each element is documented in the DTD file.
How do I modify the port number for the deploytool/server to avoid conflicts?

The J2EE server listen port number can be modified in the properties file at $J2EE_HOME/config/orb.properties.
How do I do connect to a J2EE server on a different machine?

Take these steps to connect to a J2EE server on a different machine:

1. Make sure that the J2SE version on both machines is the same.

2. Compile the application. Start the server on one machine.

3. Deploy the application and ask for the client stub jar file.

4. Transfer the client stubs and the compiled client class onto the other machine

5. Using the IP address or the machine name run the client as follows:
java Dorg.
omg.CORBA.ORBInitialHost= (Supply your host name.)
“ClientStub.jar:$J2EE_HOME/lib/j2ee.jar” Client
I have trouble connecting from a Windows/Solaris client to a Linux server. What should I do?

In this situation you may see the following message:
Caught an unexpected exception!
javax.naming.CommunicationException: Can’t find SerialContextProvider

After the default installation of Red Hat Linux the InetAddress.getLocalHost() method returns the loopback address ( instead of the actual host address. The fix is to assure that the method returns the actual host by updating the /etc/hosts file, or the name service configuration file, etc/nsswitch.conf, using a query to dns or nis before the InetAddress.getLocalHost() method is called. The situation is explained in following release note for J2SE SDK 1.4:


Is there a JNDI browser provided with the J2EE SDK? How do I set up a JNDI browser for the J2EE SDK?

There is no JNDI browser in the RI download, but one is available free through Forte for Java software. Here is how to set it up:

1. Download Forte for Java.

2. Start your server.

3. Deploy your application.

4. Copy cloudutil.jar and j2ee.jar to the lib/ext directory of Forte.

5. Start Forte for Java.

6. In Forte Explorer click on the “runtime” tab.

7. Go to the JNDI drop down folder.

8. Add a new provider copy from jndi.properties.

1. Add the following in the JNDI context factory: com.sun.enterprise.naming.SerialInitContextFactory

2. Add a property: java.naming.factory.url.pkgs.Naming=com.sun.enterprise.naming

9. Go back to the JNDI folder and right click on the newly added SerialInitContextFactory and click

to see if the provider has been installed. It should pop up a box saying “Provider is installed.”

10. Now right click on the same box and say “Connect using” It will throw a box similar to the configuration box. Just enter anything in the Context Label box and press OK.

11. If all has gone well, you should be able to see our naming hierarchy and drill down.
To run Java ServerPages, do I need to install the J2EE SDK or do I only need a web server?

Java ServerPages (“JSP”) require a web server and a Java 2 Platform, Standard Edition (“J2SE”) implementation to run. The J2EE SDK, has the functionality needed for running JSP pages. JSP technology is one of the J2EE SDK technologies. If you want to use JSP pages with other J2EE SDK technologies, e.g. Enterprise JavaBean (“EJB”) technology, using the J2EE SDK is a good choice.
Where is the javax.naming.* package?

The javax.naming.* package now comes with J2SE 1.3. To be able to run J2EE SDK 1.3.1, you need J2SE 1.3.1_02.
How do I debug my J2EE applications running in the J2EE SDK?

1. Download and install Forte for Java.

2. Create a new project from the project menu.

3. Mount the filesystem to point to the sources in the workspace.

4. Put the following as one line in setenv.sh in the $J2EE_HOME/bin directory:

JAVACMD=”$JAVA_HOME/bin/java Xmx128m



transport=dt_socket,server=y,address=9876 $SSL_OPTIONS $JAAS_OPTIONS ”

5. In Forte go to the Debug menu and select “Attach to Vm” and give the hostname and port (e.g., as in the above case : 9876) to connect to the vm. Make sure Degugger Type is selected as “Default Debugger (JPDA)”.

You are now ready to debug.

The memory requirements are 198 MB for Forte for Java and 128 MB for J2EE.
The following error occurred during deployment: Exception during packaging:[error] com.sun.enterprise.deployment.xml.ParseException. What does this signify?

The problem can occur if you already have Java API for XML Processing (“JAXP”) installed on your machine (e.g. as part of J2SE). Its path was added to the environment variable PATH. You should delete your J2SE installation and reinstall it without the extensions that include the JAXP and run the example again.