Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » Texo ModelPackage already registered
Texo ModelPackage already registered [message #881475] Mon, 04 June 2012 12:18 Go to next message
Sebastian Steinacher is currently offline Sebastian Steinacher
Messages: 3
Registered: June 2012
Junior Member
Hello,

we are evaluating Texo for a while now and are quite confident to use it in our next project. As I now started to also use the model features, besides the generated JPA classes, a problem arose. I'm not sure, if I'm using something in the wrong way.
We deploy Texo on a Glassfish server, with the required jars in place. I my EJB I register the model package like this:

ServiceModelPackageRegistry.getInstance().register(PersistenceModelPackage.INSTANCE);


After starting Glassfish and deploying for the first time, everything works fine, but the second time I always get the following excpetion:

Caused by: java.lang.IllegalStateException: The EcoreModelPackage with NsUri ... has already been registered!


I already tried to find some hint in the Texo documentation and also watched the youtube videos. What am I missing?

Thanks!

Sebastian

P. S. I'm quite curious about the 3. tier RCP features in Texo, this is exactly what we are looking for.
Re: Texo ModelPackage already registered [message #881504 is a reply to message #881475] Mon, 04 June 2012 13:38 Go to previous messageGo to next message
Martin Taal is currently offline Martin Taal
Messages: 5329
Registered: July 2009
Senior Member
Hi Sebastian,
Hmm, what do you do the second time, restart the server?

Seems like a classloading issue, the ModelResolver has a static instance to keep track of the available ModelPackage,
when a generated ModelPackage is initialized it registers itself automatically in the ModelResolver. It seems that the
generated ModelPackage class is reloaded but not the ModelResolver class.

Yes the 3-tier is indeed interesting, the main pieces are there I only need to tie them together (the json server side
webservice with a remote EMF Resource), will be a few weeks/month from now I guess...

gr. Martin

On 06/04/2012 06:18 PM, Sebastian Steinacher wrote:
> Hello,
>
> we are evaluating Texo for a while now and are quite confident to use it in our next project. As I now started to also
> use the model features, besides the generated JPA classes, a problem arose. I'm not sure, if I'm using something in the
> wrong way. We deploy Texo on a Glassfish server, with the required jars in place. I my EJB I register the model package
> like this:
>
> ServiceModelPackageRegistry.getInstance().register(PersistenceModelPackage.INSTANCE);
>
> After starting Glassfish and deploying for the first time, everything works fine, but the second time I always get the
> following excpetion:
>
> Caused by: java.lang.IllegalStateException: The EcoreModelPackage with NsUri ... has already been registered!
>
> I already tried to find some hint in the Texo documentation and also watched the youtube videos. What am I missing?
>
> Thanks!
>
> Sebastian
>
> P. S. I'm quite curious about the 3. tier RCP features in Texo, this is exactly what we are looking for.


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
Re: Texo ModelPackage already registered [message #881700 is a reply to message #881504] Tue, 05 June 2012 01:33 Go to previous messageGo to next message
Sebastian Steinacher is currently offline Sebastian Steinacher
Messages: 3
Registered: June 2012
Junior Member
Hello Martin,

the problem only shows when I redeploy without restart of the server, after a server restart everything works fine for the first time.
I tried to check if the URI of the model is already registered before registering it, but as soon as I use one of the static methods of the model package or factory I run into the same problem.
Is the registry intended to survive a redeployment? What is the right way to use the model factory for the creation of my classes (I want to use the converter to EMF, therefore I instantiate with the factory)?

Thanks & Regards

Sebastian
Re: Texo ModelPackage already registered [message #881738 is a reply to message #881700] Tue, 05 June 2012 03:15 Go to previous messageGo to next message
Martin Taal is currently offline Martin Taal
Messages: 5329
Registered: July 2009
Senior Member
Hi Sebastian,
No the registry should not survive a redeploy. I have another user on the forum who encounters the same issue with
Teneo, it seems that not all classes are reloaded in a redeploy. I guess that it depends in which classloader a class is
loaded. Are all your Texo/EMF jars located inside the WEB-INF/lib directory?

After restarting, can you debug which classloader has loaded the ModelResolver class?

gr. Martin

On 06/05/2012 07:33 AM, Sebastian Steinacher wrote:
> Hello Martin,
>
> the problem only shows when I redeploy without restart of the server, after a server restart everything works fine for
> the first time. I tried to check if the URI of the model is already registered before registering it, but as soon as I
> use one of the static methods of the model package or factory I run into the same problem.
> Is the registry intended to survive a redeployment? What is the right way to use the model factory for the creation of
> my classes (I want to use the converter to EMF, therefore I instantiate with the factory)?
>
> Thanks & Regards
>
> Sebastian


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
Re: Texo ModelPackage already registered [message #881824 is a reply to message #881738] Tue, 05 June 2012 06:13 Go to previous message
Sebastian Steinacher is currently offline Sebastian Steinacher
Messages: 3
Registered: June 2012
Junior Member
Hello Martin,

your hint concerning the lib folders solved my problem.
We had the jars in the lib/ext folder of our glassfish domain, as we have several EARs depending on them.
Now we moved the jars to the lib folder of an EAR, which includes a Texo/JPA project, and it works as expected now.
Should have been clear to me that classes loaded from lib/ext are not re-instantiated on redeployment of an EAR.

Many thanks!

Sebastian
Previous Topic:EMFT Texo: Latest Build and Backward Compatibility
Next Topic:[Teneo] Hibernate 4.1 has Trouble with Booleans
Goto Forum:
  


Current Time: Thu Aug 28 19:23:58 EDT 2014

Powered by FUDForum. Page generated in 0.01838 seconds