There are lots of caching issues you are going to fall foul of with your current approach.
You will probably need to cluster your two instances of alfresco. And I'm not sure if shared indexes are supported yet, so you may also need to have two separate index instances.
It would be much better for your J2EE app to use one of Alfresco's remote interfaces rather than trying to run a separate local instance of alfresco.