cancel
Showing results for 
Search instead for 
Did you mean: 

Two J2EE application on same repository !!

alex54
Champ on-the-rise
Champ on-the-rise
Hello,

I develop an J2EE application. This application has its own business.

This application can call Alfresco Repository (use of all needed repository services access via JARs).

All is well configured (custom XML files (db connection links and type, specification of the 'alf_data' folder, etc…), custom Model, etc..).

I use Alfresco in a Tomcat, in order to have like an 'administrative' application (to manage space, contents, etc… as an administrative way). The Alfresco native Web interface is perfect for this Smiley Wink

In my stand-alone 3-tiers application, I developped some personal services (my own business).
Theses services call sometimes Alfresco services (SearchService, NodeService,etc…): These Alfresco services are injected by my Spring during the start of my Tomcat server.

When I start servers, all is fine:
==> Alfresco is runnig on the localhost:8080/alfresco
==> My Application is runing on the localhost:8082/myApplication ( Alfresco context is also loaded via Spring, and Alfresco services are found and well injected into my own services.)
==> Both application are running in the same time: No problem with that. The both application are link to the same 'alf_data' folder , and use the same database  Smiley Wink
All works fine: I can call my services, and get GOOD result from Alfresco respository…  Smiley Happy

BUT I HAVE A PROBLEM CONCERNING DATA RENDER BY ALFRESCO SERVICES (in my application I mean) WHEN A CONTENT IS CHANGED IN ALFRESCO APPLICATION WEB INTERFACE ! (and Vice-versa !)

Example of Test process:
- MyApplication (on localhost:8082/myApplication): I Call myCustomSearchService => this call Alfresco SearchService, in order to get one content named "myFile.txt" in a special Space: I get the node (OK)   Smiley Very Happy
- Alfresco Web interface (on localhost:8080/alfresco): I modify the name of "myFile.txt" into "myNewFile.txt" (OK) Smiley Very Happy
- MyApplication: I RECall myCustomSearchService => this call Alfresco SearchService, in order to get one content named "myFile.txt" in a special Space (THIS MUST RETURN NULL because the file don't exist anymore: the name was changed), But I get the node !! ==> This is NOT OK !! Smiley Indifferent   (Because this content/node don't exist anymore !!)

The only solution to get the goo result is to restart Tomcat (localhost:8082) where MyApplication is deployed.  Smiley Surprisedops:
In this case only, changed are noticed, and the searchService (or nodeService) return good result …

MyApplication and Alfresco seems to live their own live (transaction problem ?? caching problem (LR2)??)

This is strange, because in myApplication, like in Alfresco application, both are accessing to the same database, and the same content alf_data (same indexes)

I hope that you are able to help me
Thanks a lot in advance.   Smiley Happy

Note: I don't want use Alfresco Web services (personnals reasons Smiley Wink )

——————————————
Alfresco version
- Version of Alfresco: 3.1.0
- Operating System: Windows
- Database: MySQL
- Web Application Server: Tomcat
- Browser version: IE or Firefox
2 REPLIES 2

mrogers
Star Contributor
Star Contributor
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.

alex54
Champ on-the-rise
Champ on-the-rise
Thanks you…
Concerning the index, I prefer to don't use a double shared instance.
The target of the Alfresco Web interface instance is to have an administrative tool. Any change by this interface must be detected (in the same time !!) by my J2EE application !
I will continu to search informations concerning the 'cache' issue…

It is strange that nobody else worked with this type of architecture.
For example, a lot of J2EE application dealing with Alfresco (via JCR repository), to the same repository, because all J2EE application must be aware about all data, in the same time…  Smiley Indifferent