java/j2ee tips and blueprints
java/j2ee tips and blueprints
It is a very sad thing that nowadays
there is so little useless information.
Oscar Wilde
Workflow Framework Comparison
Workflow / bpm have very short history. But now there a several mature frameworks you can use in open source world.
Today there are lots of projects talking about workflow. most of them have totally different domains. (ERP/CRM/internal) and in response there are lots of frameworks to solve this problem. Here is my experience:
more...
Moving from Tomcat to JBoss
<!–<scope>compile</scope>–>
<scope>provided</scope>
After 5 years I have returned to jboss because I wanted to evaluate JBPM (I’ll write about it later). But this I already knew pitfulls of JEE . Avoid EJBs!.
I downloaded latest stable version of jboss and run it empty to test: no errors, perfect!
I configured my ide (idea 7.0) and run it with a simple jsp application . Awesome still no error. Idea 7.0 realy has a good integration with jboss. Only imported point i you should name exploded folder name with proper suffix (.jar/.war/.ear)
At this what u have out of box :
Jboss-ws
JMS
Hibernate
Quartz
javax.mail
javax.activation
This means when u move from tomcat/jetty to jboss you should change maven dependecies of these projects. They are already ready and running
more...
Java7 Wish: Object/Bean Factory
One of the most critic point for java
return Class.forName(className).newInstance();
Upon since it seems this method bring the ultimate extensibility power to java.
But Now server & client applications became more and more complicated this feature became insufficient.
more...
Annotations have been more successful than XML
Annotations came to JDK with JDK5 (2004) since then they evaluated and are accepted so widely and even became more powerful and useful than XML in just 4 years.
While you are developing a project with java at any scale you’ll need a very large number of XML files defined in very different API’s and DTD/XSDs. Which makes configuration very complex.
eg:struts.xml,tiles.xml,validation.xml,hibernate.cfg.xml,spring-context.xml,web.xml,and so on
Although it is easy to read and modify there are lots files
Now with annotations:
more...
JGroups-Spring In Action
If your are new with jgroups ,take a look JGroups Basic and other jGroups posts
Some Sample Code you may use for adding networking utilities to your Application
Two FactoryBeans for JGroups
- ChannelBeanFactory for creating JChannel Instances
- ReplicatedHashMapFactory for ReplicatedHashMapFactory Instances
more...
JAXB quickstart via maven2
JAXB is a java framework to XML-Java transformations.
JAXB is 2.1 has a very simple API like castor and jibx And annotation driven transformers. Although those configurations can be written manually JAXB has a code generator to generate java files from XSD files. Here is sample JAXB tutorial using maven2:
more...
hibernate native id generator bug 3.2.4-ga
hibenate native id generator for mysql not working just update to 3.2.5
Caused by: java.sql.SQLException: No value specified for parameter 11 at com.mysql.jdbc.PreparedStatement.fillSendPacket(PreparedStatement.java:2212) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1724) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1596) at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:101) at org.hibernate.id.IdentityGenerator$GetGeneratedKeysDelegate.executeAndExtract(IdentityGenerator.java:73) at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:33)
more...
Clustering Acegi via JGroups (DistributedHashtable)
in my previous blog I suggest to use jms or caching for a distributable SessionRegistry
but I found a more simple solution JGroups -
DistributedHashtable :JGroups gives us such a perfect simple class to distributed maps.
- All read-only operations runs on local copies
- perfect merge strategies.
- easy implementation and configuration
- vs..
more...
DistributableEventPublisher for Spring via JGroups
Messaging is really easy through a single JVM. For a distributed environments JMS is strongly recommended. but for smaller and simple projects here is and example implementation via JGroups.
Usage
DistributableEventPublisher distributableEventPublisher=….
distributableEventPublisher.castEvent(TEXT_MESSAGE/XML/Serializable);
requirements:
- springframework 2+
- JGroups 2.6.1
- JUnit (for test)
more...
light-weight distributed messaging via JGroups
JGroups is a framework that provide seamless networking utilities for java/j2ee applications. As a light-weight alternative to JMS here is an example.
more...
You can know the name of a bird in all the languages of the world, but when you're finished, you'll know absolutely nothing whatever about the bird... So let's look at the bird and see what it's doing -- that's what counts. I learned very early the difference between knowing the name of something and knowing something.
Richard Feynman