Today one person told to me that "Java EE programmers do not write to files". Why can I not write to files from within a Java EE container (for example from JBoss)? What is wrong?
You should do everything within the Java EE container itself: you can have no certainty that you will have any consistent access to the filesystem. There are many reasons for this, the most obvious being that applications running within a container will have:
You should also assume that you shouldn't:
The best page to look at is this one: http://www.oracle.com/technetwork/java/restrictions-142267.html
It covers in detail the restrictions over the Java EE programming model.
Apart from the point mentionned above Security, Portability, Clustering, Threading also consider transactions and error handling (File systems are not transactional).
There is however no black magic happening in the JVM and you can create files (as long as you have the corresponding rights), use static variables, and create threads if you know what you're doing.
Better take the time to understand why these restriction are usually suggested, than to jump and write a JCA connector for the sake of being compliant.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With