On 14/05/2015 12:30, Javier Calvach Regidor wrote:
Hi Francesco,

I made a new syncope's project from scratch, and I configured log's and conf's path specifically for new instance. New and old core's instances just share the bundle's path. On the other hand, both conf paths are empty. So, where are all jpa variables of persistenceContext.xml load from? Wouldn't a properly persistence.properties configuration be enough? It would be great if you could shed a little bit more of light on here.

Configuration paths are obviously empty since no one has copied nothing in there.

As said below, the general idea is that properties file are first looked from configuration directory; if not found (your case), the correspondent file is loaded from classpath, e.g. from within the WAR file, in the general case.

FYI, this is configured in [3].

Regards.

El Jueves 14 de Mayo de 2015 12:01, Francesco Chicchiriccò <[email protected]> escribió:


On 14/05/2015 10:32, Javier Calvach Regidor wrote:
Hello,

I am trying to deploy two instances of syncope in the same tomcat. For database, I would want to user two different databases in the same MySQL instance. I already have the database of the first syncope's intance (with all the connectosr/resources/users/... info) so I have duplicated it and I have imported it into a new database called syncope2. I have granted all permissions to user syncope (which access to syncope database as well) and I have changed the persistence.properties files of the second instance to "jpa.url=jdbc:mysql://localhost:3306/syncope2?characterEncoding=UTF-8". Nevertheless, both instances of Syncope are pointed to database syncope, not syncope2. This is quite strange, I can't figure out what's going on.

Any of you have tried this before?

The Spring datasource used for all (JPA and non-JPA) database access is defined in [1] so that if JNDI resource with name " java:comp/env/jdbc/syncopeDataSource" is found, that is returned; if not found, a local datasource is built via Commons DBCP and parameters taken from persistence.properties.

Moreover, you need to take into account the configuration directory you have passed during build (see [2]): as a general behavior, in fact, properties files will considered at first from configuration directory, then from classpath (e.g. from inside the actual deployed WAR file).

Possibly, in your case - especially if you just copied the first syncope WAR into a second WAR then changed the second persistence.properties - you still have your second persistenceContext.xml pointing to values from persistence.properties in the directory (-Dconf.directory=....) you've specified during build (e.g. the configuration directory used by the first instance).

HTH
Regards.

P.S.: I have instantiated a new console instance pointing to the second core, so I am not managing the first core with both consoles. In addition, when I access two syncopes in different tomcats, I have to log in every time I want to use one or another. This is not happening here. I have to log in both of them but, once I have done it, I'm able to use them both without having to log in again.

[1] https://github.com/apache/syncope/blob/1_2_X/core/src/main/resources/persistenceContext.xml#L63-L97
[2]https://cwiki.apache.org/confluence/display/SYNCOPE/Run+Syncope+in+real+environments#RunSyncopeinrealenvironments-Buildanddeploy
[3] https://github.com/apache/syncope/blob/1_2_X/core/src/main/resources/coreContext.xml#L31-L57

--
Francesco Chicchiriccò

Tirasa - Open Source Excellence
http://www.tirasa.net/

Involved at The Apache Software Foundation:
member, Syncope PMC chair, Cocoon PMC, Olingo PMC
http://people.apache.org/~ilgrosso/

Reply via email to