Most of the Java EE technologies are used with a framework. This is the main difference with the plain old Java programming. So you must become familiar to the framework usage.
Framework vs library
A framework or a library is a code that you use but you don't write on your own. Consider the following code:
The code on the left is calling the code on the right. If you use a library, you are writing the code on the left and you don't write the code on the right, so the library is on the right:
If you use a framework, you are writing the code on the right and you don't write the code on the left, so the framework is on the left:
This means that you will not launch your own code. You will launch a product that will read your code and use it. You don't know how your code will be used.
Frameworks in Java EE
- When you build a Java EE, you generate a
.warfile. This file is respectively executed in an application server or a servlet container. Application servers and servlet containers are frameworks. The most used Java EE application servers are Glassfish, JBoss and Geronimo. The most used Java EE servlet container is Apache Tomcat.
- When you write a servlet, it will be executed in a servlet container, which is a framework.
- When you write a
.jsp, it will be read by the JSP compiler, which is a framework. The Apache Tomcat JSP compiler is Tomcat Jasper.
There are lots of other frameworks that are used in Java EE. They do lots of things you wouldn't be able to write on your own.
Do not debug your code as you would debug it with a library. Java EE coding needs other practices than Java coding. Even if you have the source code of the framework, do not try to read it. Most of the time, it is impossible to understand and you will waste your time. You will never find the way the framework is calling your code (a framework often generates some classes at runtime).
When you have an error, you have to read the framework specifications. It is the only way to find a solution. Most of the time, the stacktraces are very long. Only read the part that mentions your own code. If the stacktrace mentions an error code, search the error code in the framework specifications.
Sometimes, the framework specifications are not enough to find the bug. In this case, do not try to understand the error on your own, if the error is in a framework class. The best thing to do is to find someone who already encounters this error and knows the solution. It can be colleagues or people on an internet forum. The most famous is Stack Overflow.