Posts Tagged With ‘JEE&8217


Setting up a cluster

It took 2 days to read and learn and setup a JEE based cluster for different types of platforms. I still have some problems in linux running Fedora Core 7. Problem is setting up connection on node instances. A good start for JEE cluster can be found here.


Dependency Injection Sucks

Java EE platform has many benefits one of them is Dependency Injection. It is an useful feature provides just using annotations instead of making lookups. However you cannot use it anywhere you like, only container managed components accepts resource injection. Such as EJB beans, Servlets, and JavaServer Pages (JSP) technology tag handlers. Thus, you can not use it in your helper classes and JPS pages. Why you cannot use it is;

JSP technology pages and tag files cannot accept resource injections either. Because such pages are usually compiled only after receiving a request, an annotation included in a JSP technology page would not be available to the container at deployment time when resource injection occurs.

Tag library validators (TLVs) and TagExtraInfo (TEI) are other classes that the JSP technology container manages, but because their life cycle is limited to the compilation of the JSP technology pages, they are not valid candidates for injection.

Supporting resource injection on JavaServer Faces technology renderers, converters, or validators is not desirable because that would violate Model-View-Controller (MVC) separation of these presentation objects. If these classes need to get access to resources, they should do so through a managed bean.

You cannot use this nice feature where it is most useful, it really sucks.

Ref : A Look at Resource Injection


Netbeans IDE 6.0 Beta 1 is Out

Netbeans IDE 6.0 Beta 1 is out, here it is.


Security in Java EE Part 1

Object Oriented application development provides developers to divide application into different layers such as database layer, business layer, presentation layer … etc. Multi layer application development approach provides easy to develop and maintain large scale projects. However, this approach addresses one of the most important issue, security.

Java EE consists of components ejb, web, web services, application clients … etc. Each of these components can be deployed into different containers or same container. Security is handled by the containers; a container provides programming or declarative security. Programming security is embedded control mechanism that is used when declarative security is insufficient. Declarative security defines applications security configuration out of the application via configuration files. Also, annotations define set of security rules by class files.

Java provides some security implementation mechanisms like;

Reference:

http://java.sun.com/j2se/1.5.0/docs/guide/security/

http://java.sun.com/javase/technologies/security/


java.lang.OutOfMemoryError: PermGen space

If you are developing JEE applications with low resources (like me ) probably you have been facing “java.lang.OutOfMemoryError: PermGen space” exception and it will be your nightmare. Sample stack trace of exception:

StandardWrapperValve[Faces Servlet]: Servlet.service() for servlet Faces Servlet threw exception
java.lang.OutOfMemoryError: PermGen space
at sun.misc.Unsafe.defineClass(Native Method)
at sun.reflect.ClassDefiner.defineClass(ClassDefiner.java:45)
at sun.reflect.MethodAccessorGenerator$1.run(MethodAccessorGenerator.java:381)
at java.security.AccessController.doPrivileged(Native Method)
at sun.reflect.MethodAccessorGenerator.generate(MethodAccessorGenerator.java:377)
at sun.reflect.MethodAccessorGenerator.generateMethod(MethodAccessorGenerator.java:59)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:28)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

You should add these parameters to domail.xml to get rid of this exception ( it is not exact solution) :

-Xmx256m
-Xms64m
-Xss128k
-XX:NewRatio=2
-XX:+CMSClassUnloadingEnabled
-XX:+CMSPermGenSweepingEnabled