You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@syncope.apache.org by Denis Signoretto <de...@intesys.it> on 2014/06/24 15:27:39 UTC

Running Syncope Embed using a permanent h2 instance

Hi,


I've checked out Syncope 1_1_X to do some tests. I've seen that Syncope h2 db it's created within target directory.
Everytime I launch mvn -P debug, target dir it's deleted.

I'm wondering if is there a way to launch Syncope embed mode/debug profile using a permanent h2 location.
I've tried adding a customized persistence.properties file in syncope-console\src\resources specifying both absolute and relative path outside target dir
but it seems workdir it's needed.

Is there a better way to do it or get the same result ?

Best regards

Thanks,
Denis.

R: Running Syncope Embed using a permanent h2 instance

Posted by Denis Signoretto <de...@intesys.it>.
The solution I found ATM was: modifying H2StartStopListener, remove basedir param, rebuild and installed build-tools in maven local repo.

I'm wondering if there is a better way to get same result without source code modification of syncope-tools.

Thanks,
Denis.

-----Messaggio originale-----
Da: Denis Signoretto [mailto:denis.signoretto@intesys.it] 
Inviato: mercoledì 25 giugno 2014 09:55
A: dev@syncope.apache.org
Oggetto: R: Running Syncope Embed using a permanent h2 instance

Hi Francesco,

thanks for your answer. As you suggested I've changed core/src/test/resources/persistence.properties
but I still can't set H2 basedir outside workdir. In core.log I get this exception:

org.h2.jdbc.JdbcSQLException: IO Exception: <my-absolute-path> outside <standalone-install-dir>/apache-tomcat-7.0.53/work/Catalina/localhost/syncope-build-tools

After some investigation I saw that build-tools project use a second instance of H2 and in the class H2StartStopListener it sets the H2 baseDir to work dir.

I'm not an expert of H2 but it seems baseDir it's a system property that affects all instances.

What's the best way to do you suggest to set basedir for syncope db outside work ?

Thanks,
Denis.

-----Messaggio originale-----
Da: Francesco Chicchiriccò [mailto:ilgrosso@apache.org]
Inviato: martedì 24 giugno 2014 15:35
A: dev@syncope.apache.org
Oggetto: Re: Running Syncope Embed using a permanent h2 instance

On 24/06/2014 15:27, Denis Signoretto wrote:
> Hi,
> I've checked out Syncope 1_1_X to do some tests. I've seen that Syncope h2 db it's created within target directory.
> Everytime I launch mvn -P debug, target dir it's deleted.

This means you are directly running from the actual Syncope sources: I'd suggest you instead to generate your own project from SNAPSHOT archetype [1] and then run in embedded mode [2] via mvn -P embedded.

> I'm wondering if is there a way to launch Syncope embed mode/debug profile using a permanent h2 location.
> I've tried adding a customized persistence.properties file in syncope-console\src\resources specifying both absolute and relative path outside target dir but it seems workdir it's needed.
>
> Is there a better way to do it or get the same result ?

You can proceed similar to the standalone distribution [3]: only, you need to change

core/src/test/resources/persistence.properties

not

core/src/main/resources/persistence.properties

The former is used for tests and for embedded mode, the latter for production, e.g. for the WAR to be deployed into a real-world deployment.

HTH
Regards.

[1]
https://cwiki.apache.org/confluence/display/SYNCOPE/Create+a+new+Syncope+project#CreateanewSyncopeproject-Snapshot(development)releases
[2]
https://cwiki.apache.org/confluence/display/SYNCOPE/Run+Syncope+in+embedded+mode
[3]
https://cwiki.apache.org/confluence/display/SYNCOPE/Run+Syncope+standalone+distribution#RunSyncopestandalonedistribution-Internalstorage

--
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/


R: Running Syncope Embed using a permanent h2 instance

Posted by Denis Signoretto <de...@intesys.it>.
Hi Francesco,

I've just seen you have done the same modification in sources.

Thanks!
Denis.


-----Messaggio originale-----
Da: Francesco Chicchiriccò [mailto:ilgrosso@apache.org] 
Inviato: mercoledì 25 giugno 2014 11:28
A: dev@syncope.apache.org
Oggetto: Re: Running Syncope Embed using a permanent h2 instance

Hi Denis,
this problem is fixed now in the branch 1_1_X; you will need either to build 1.1.8-SNAPSHOT locally or to wait for Jenkins to publish these artifacts (job #181)

https://builds.apache.org/view/S-Z/view/Syncope/job/Syncope-1_1_X/

Regards.

On 25/06/2014 09:54, Denis Signoretto wrote:
> Hi Francesco,
>
> thanks for your answer. As you suggested I've changed 
> core/src/test/resources/persistence.properties
> but I still can't set H2 basedir outside workdir. In core.log I get this exception:
>
> org.h2.jdbc.JdbcSQLException: IO Exception: <my-absolute-path> outside 
> <standalone-install-dir>/apache-tomcat-7.0.53/work/Catalina/localhost/
> syncope-build-tools
>
> After some investigation I saw that build-tools project use a second 
> instance of H2 and in the class H2StartStopListener it sets the H2 baseDir to work dir.
>
> I'm not an expert of H2 but it seems baseDir it's a system property that affects all instances.
>
> What's the best way to do you suggest to set basedir for syncope db outside work ?
>
> Thanks,
> Denis.
>
> -----Messaggio originale-----
> Da: Francesco Chicchiriccò [mailto:ilgrosso@apache.org]
> Inviato: martedì 24 giugno 2014 15:35
> A: dev@syncope.apache.org
> Oggetto: Re: Running Syncope Embed using a permanent h2 instance
>
> On 24/06/2014 15:27, Denis Signoretto wrote:
>> Hi,
>> I've checked out Syncope 1_1_X to do some tests. I've seen that Syncope h2 db it's created within target directory.
>> Everytime I launch mvn -P debug, target dir it's deleted.
> This means you are directly running from the actual Syncope sources: I'd suggest you instead to generate your own project from SNAPSHOT archetype [1] and then run in embedded mode [2] via mvn -P embedded.
>
>> I'm wondering if is there a way to launch Syncope embed mode/debug profile using a permanent h2 location.
>> I've tried adding a customized persistence.properties file in syncope-console\src\resources specifying both absolute and relative path outside target dir but it seems workdir it's needed.
>>
>> Is there a better way to do it or get the same result ?
> You can proceed similar to the standalone distribution [3]: only, you 
> need to change
>
> core/src/test/resources/persistence.properties
>
> not
>
> core/src/main/resources/persistence.properties
>
> The former is used for tests and for embedded mode, the latter for production, e.g. for the WAR to be deployed into a real-world deployment.
>
> HTH
> Regards.
>
> [1]
> https://cwiki.apache.org/confluence/display/SYNCOPE/Create+a+new+Synco
> pe+project#CreateanewSyncopeproject-Snapshot(development)releases
> [2]
> https://cwiki.apache.org/confluence/display/SYNCOPE/Run+Syncope+in+emb
> edded+mode
> [3]
> https://cwiki.apache.org/confluence/display/SYNCOPE/Run+Syncope+standa
> lone+distribution#RunSyncopestandalonedistribution-Internalstorage

--
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/


Re: Running Syncope Embed using a permanent h2 instance

Posted by Francesco Chicchiriccò <il...@apache.org>.
Hi Denis,
this problem is fixed now in the branch 1_1_X; you will need either to 
build 1.1.8-SNAPSHOT locally or to wait for Jenkins to publish these 
artifacts (job #181)

https://builds.apache.org/view/S-Z/view/Syncope/job/Syncope-1_1_X/

Regards.

On 25/06/2014 09:54, Denis Signoretto wrote:
> Hi Francesco,
>
> thanks for your answer. As you suggested I've changed core/src/test/resources/persistence.properties
> but I still can't set H2 basedir outside workdir. In core.log I get this exception:
>
> org.h2.jdbc.JdbcSQLException: IO Exception: <my-absolute-path> outside <standalone-install-dir>/apache-tomcat-7.0.53/work/Catalina/localhost/syncope-build-tools
>
> After some investigation I saw that build-tools project use a second instance of H2 and in the class H2StartStopListener
> it sets the H2 baseDir to work dir.
>
> I'm not an expert of H2 but it seems baseDir it's a system property that affects all instances.
>
> What's the best way to do you suggest to set basedir for syncope db outside work ?
>
> Thanks,
> Denis.
>
> -----Messaggio originale-----
> Da: Francesco Chicchiriccò [mailto:ilgrosso@apache.org]
> Inviato: martedì 24 giugno 2014 15:35
> A: dev@syncope.apache.org
> Oggetto: Re: Running Syncope Embed using a permanent h2 instance
>
> On 24/06/2014 15:27, Denis Signoretto wrote:
>> Hi,
>> I've checked out Syncope 1_1_X to do some tests. I've seen that Syncope h2 db it's created within target directory.
>> Everytime I launch mvn -P debug, target dir it's deleted.
> This means you are directly running from the actual Syncope sources: I'd suggest you instead to generate your own project from SNAPSHOT archetype [1] and then run in embedded mode [2] via mvn -P embedded.
>
>> I'm wondering if is there a way to launch Syncope embed mode/debug profile using a permanent h2 location.
>> I've tried adding a customized persistence.properties file in syncope-console\src\resources specifying both absolute and relative path outside target dir but it seems workdir it's needed.
>>
>> Is there a better way to do it or get the same result ?
> You can proceed similar to the standalone distribution [3]: only, you need to change
>
> core/src/test/resources/persistence.properties
>
> not
>
> core/src/main/resources/persistence.properties
>
> The former is used for tests and for embedded mode, the latter for production, e.g. for the WAR to be deployed into a real-world deployment.
>
> HTH
> Regards.
>
> [1]
> https://cwiki.apache.org/confluence/display/SYNCOPE/Create+a+new+Syncope+project#CreateanewSyncopeproject-Snapshot(development)releases
> [2]
> https://cwiki.apache.org/confluence/display/SYNCOPE/Run+Syncope+in+embedded+mode
> [3]
> https://cwiki.apache.org/confluence/display/SYNCOPE/Run+Syncope+standalone+distribution#RunSyncopestandalonedistribution-Internalstorage

-- 
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/


R: Running Syncope Embed using a permanent h2 instance

Posted by Denis Signoretto <de...@intesys.it>.
Hi Francesco,

thanks for your answer. As you suggested I've changed core/src/test/resources/persistence.properties
but I still can't set H2 basedir outside workdir. In core.log I get this exception:

org.h2.jdbc.JdbcSQLException: IO Exception: <my-absolute-path> outside <standalone-install-dir>/apache-tomcat-7.0.53/work/Catalina/localhost/syncope-build-tools

After some investigation I saw that build-tools project use a second instance of H2 and in the class H2StartStopListener
it sets the H2 baseDir to work dir.

I'm not an expert of H2 but it seems baseDir it's a system property that affects all instances.

What's the best way to do you suggest to set basedir for syncope db outside work ?

Thanks,
Denis.

-----Messaggio originale-----
Da: Francesco Chicchiriccò [mailto:ilgrosso@apache.org] 
Inviato: martedì 24 giugno 2014 15:35
A: dev@syncope.apache.org
Oggetto: Re: Running Syncope Embed using a permanent h2 instance

On 24/06/2014 15:27, Denis Signoretto wrote:
> Hi,
> I've checked out Syncope 1_1_X to do some tests. I've seen that Syncope h2 db it's created within target directory.
> Everytime I launch mvn -P debug, target dir it's deleted.

This means you are directly running from the actual Syncope sources: I'd suggest you instead to generate your own project from SNAPSHOT archetype [1] and then run in embedded mode [2] via mvn -P embedded.

> I'm wondering if is there a way to launch Syncope embed mode/debug profile using a permanent h2 location.
> I've tried adding a customized persistence.properties file in syncope-console\src\resources specifying both absolute and relative path outside target dir but it seems workdir it's needed.
>
> Is there a better way to do it or get the same result ?

You can proceed similar to the standalone distribution [3]: only, you need to change

core/src/test/resources/persistence.properties

not

core/src/main/resources/persistence.properties

The former is used for tests and for embedded mode, the latter for production, e.g. for the WAR to be deployed into a real-world deployment.

HTH
Regards.

[1]
https://cwiki.apache.org/confluence/display/SYNCOPE/Create+a+new+Syncope+project#CreateanewSyncopeproject-Snapshot(development)releases
[2]
https://cwiki.apache.org/confluence/display/SYNCOPE/Run+Syncope+in+embedded+mode
[3]
https://cwiki.apache.org/confluence/display/SYNCOPE/Run+Syncope+standalone+distribution#RunSyncopestandalonedistribution-Internalstorage

--
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/


Re: Running Syncope Embed using a permanent h2 instance

Posted by Francesco Chicchiriccò <il...@apache.org>.
On 24/06/2014 15:27, Denis Signoretto wrote:
> Hi,
> I've checked out Syncope 1_1_X to do some tests. I've seen that Syncope h2 db it's created within target directory.
> Everytime I launch mvn -P debug, target dir it's deleted.

This means you are directly running from the actual Syncope sources: I'd 
suggest you instead to generate your own project from SNAPSHOT archetype 
[1] and then run in embedded mode [2] via mvn -P embedded.

> I'm wondering if is there a way to launch Syncope embed mode/debug profile using a permanent h2 location.
> I've tried adding a customized persistence.properties file in syncope-console\src\resources specifying both absolute and relative path outside target dir but it seems workdir it's needed.
>
> Is there a better way to do it or get the same result ?

You can proceed similar to the standalone distribution [3]: only, you 
need to change

core/src/test/resources/persistence.properties

not

core/src/main/resources/persistence.properties

The former is used for tests and for embedded mode, the latter for 
production, e.g. for the WAR to be deployed into a real-world deployment.

HTH
Regards.

[1] 
https://cwiki.apache.org/confluence/display/SYNCOPE/Create+a+new+Syncope+project#CreateanewSyncopeproject-Snapshot(development)releases
[2] 
https://cwiki.apache.org/confluence/display/SYNCOPE/Run+Syncope+in+embedded+mode
[3] 
https://cwiki.apache.org/confluence/display/SYNCOPE/Run+Syncope+standalone+distribution#RunSyncopestandalonedistribution-Internalstorage

-- 
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/