integrate grails in existing j2ee app

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

integrate grails in existing j2ee app

fachhoch
I have a j2ee app , and  very much intrested in using grails.Please tell me if  I  can  integrate grails into my exsisting j2ee app ?  is this possible ?  if not how exsisting apps   can benefit from grails ?
Reply | Threaded
Open this post in threaded view
|

RE: integrate grails in existing j2ee app

Nagelberg, Kallin
I recently converted a legacy java web-app to grails. My strategy was to create a new grails project, then migrate the old project into the new grails project. You can edit the template web.xml in a few different ways, so once I got all the old source compiling and setup the same servlet mappings it worked out great.

-Kallin Nagelberg

-----Original Message-----
From: fachhoch [mailto:[hidden email]]
Sent: Wednesday, June 09, 2010 10:24 AM
To: [hidden email]
Subject: [grails-user] integrate grails in existing j2ee app


I have a j2ee app , and  very much intrested in using grails.Please tell me
if  I  can  integrate grails into my exsisting j2ee app ?  is this possible
?  if not how exsisting apps   can benefit from grails ?

--
View this message in context: http://grails.1312388.n4.nabble.com/integrate-grails-in-existing-j2ee-app-tp2248932p2248932.html
Sent from the Grails - user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

RE: integrate grails in existing j2ee app

fachhoch
are there any tutorials on doing this ?  I am a total new bee   with grails
Reply | Threaded
Open this post in threaded view
|

RE: integrate grails in existing j2ee app

Nagelberg, Kallin
Not that I'm aware of.
Start off by moving all your legacy source into the src/java folder, and your libs into the lib folder (or use buildconfig if you're comfortable with dependency management). If you can get all that compiling you're off to a good start.

-Kal

-----Original Message-----
From: fachhoch [mailto:[hidden email]]
Sent: Wednesday, June 09, 2010 10:29 AM
To: [hidden email]
Subject: [grails-user] RE: integrate grails in existing j2ee app


are there any tutorials on doing this ?  I am a total new bee   with grails

--
View this message in context: http://grails.1312388.n4.nabble.com/integrate-grails-in-existing-j2ee-app-tp2248932p2248940.html
Sent from the Grails - user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

RE: integrate grails in existing j2ee app

fachhoch
Mine is maven 2 app using wicket , spring , hibernate  and some servlets  , please tell  me  steps for  making  it a grails  project.

My need is more like create some pages using grails  i want to use grails becasue of dynamic loading .
I want the behavior of changing my application at runtime without restarting   server.
Reply | Threaded
Open this post in threaded view
|

RE: integrate grails in existing j2ee app

Nagelberg, Kallin
Grails integrates tightly with spring and hibernate. There is now a dependency management feature that could help with Maven component, though you're going to have to restructure your project a little to fit with grails conventions (no src/main/resources for example). I haven't worked with wicket but I imagine that's just setting up the appropriate servlet mappings. I converted a Jersey project with no problems.

That being said, I don't think you're going to find step by step instructions here on the migration. You need to understand Grails first, and you definitely need to understand all the intricacies of your old build process. Once you have those you should be able to figure out how to map pieces of your old project into a Grails project. If you don't have the time/resources maybe you should hire an experienced Grails developer to assist! :P

-Kallin Nagelberg



-----Original Message-----
From: fachhoch [mailto:[hidden email]]
Sent: Wednesday, June 09, 2010 10:43 AM
To: [hidden email]
Subject: [grails-user] RE: integrate grails in existing j2ee app


Mine is maven 2 app using wicket , spring , hibernate  and some servlets  ,
please tell  me  steps for  making  it a grails  project.

My need is more like create some pages using grails  i want to use grails
becasue of dynamic loading .
I want the behavior of changing my application at runtime without restarting  
server.
--
View this message in context: http://grails.1312388.n4.nabble.com/integrate-grails-in-existing-j2ee-app-tp2248932p2248962.html
Sent from the Grails - user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

RE: integrate grails in existing j2ee app

rlovtangen
In reply to this post by fachhoch
If your maven project is a multi module project (which is often the case), your first step could be to just exchange your war module with Grails. Your other jars could be used as is. To link them in you could either throw them in the lib folder, use grails' dependency management, or use grails with maven.
Note that the maven support, although improving, is still a little rough. Especially the documentation.


To have Grails pick up your existing spring config you probably have to do some minor changes to contextConfigLocation in src/templates/war/web.xml. Here's mine:

    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath*:/applicationContext.xml,/WEB-INF/applicationContext.xml</param-value>
    </context-param>

Note: src/templates/war/web.xm is not there by default, you have to do a "grails install-templates" first.

You will have your existing spring beans available in Grails as well, and your hibernate mapping should work just fine.
Then later, if you want to, you can move more of your backend code to Grails.

Ronny


On Jun 9, 2010, at 4:43 PM, fachhoch wrote:

>
> Mine is maven 2 app using wicket , spring , hibernate  and some servlets  ,
> please tell  me  steps for  making  it a grails  project.
>
> My need is more like create some pages using grails  i want to use grails
> becasue of dynamic loading .
> I want the behavior of changing my application at runtime without restarting  
> server.
> --
> View this message in context: http://grails.1312388.n4.nabble.com/integrate-grails-in-existing-j2ee-app-tp2248932p2248962.html
> Sent from the Grails - user mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

RE: integrate grails in existing j2ee app

tomas lin
That should work in theory and I really really wish it worked like
that out of the box, but in practice it is much more complicated.

You need to first migrate all your code to use the same Spring /
Hibernate versions that are used by grails. This is not trivial since
the Spring framework basically spits in the face of backwards
compatibility. Then there are subtle differences in hibernate
versions. So basically, to use grails, you go through this gigantic
upgrade process in your core app to make it compatible with the latest
and greatest jars.

You also need to carefully manage all your imported dependencies from
Maven so that you exclude all the jars. You can find the dependency
list at

http://github.com/grails/grails-core/blob/master/dependencies.txt

The grails dependency-report and xml dependencies file that get
generated in .ivy is helpful here.

I would actually recommend using conf/spring/resources.groovy vs. the
web.xml file. My experience is that modifying web.xml leads to misery
and sorrow down the line since this file can change radically across
grails versions.


On Thu, Jun 10, 2010 at 9:06 AM, Ronny Løvtangen <[hidden email]> wrote:

> If your maven project is a multi module project (which is often the case), your first step could be to just exchange your war module with Grails. Your other jars could be used as is. To link them in you could either throw them in the lib folder, use grails' dependency management, or use grails with maven.
> Note that the maven support, although improving, is still a little rough. Especially the documentation.
>
>
> To have Grails pick up your existing spring config you probably have to do some minor changes to contextConfigLocation in src/templates/war/web.xml. Here's mine:
>
>    <context-param>
>        <param-name>contextConfigLocation</param-name>
>        <param-value>classpath*:/applicationContext.xml,/WEB-INF/applicationContext.xml</param-value>
>    </context-param>
>
> Note: src/templates/war/web.xm is not there by default, you have to do a "grails install-templates" first.
>
> You will have your existing spring beans available in Grails as well, and your hibernate mapping should work just fine.
> Then later, if you want to, you can move more of your backend code to Grails.
>
> Ronny
>
>
> On Jun 9, 2010, at 4:43 PM, fachhoch wrote:
>
>>
>> Mine is maven 2 app using wicket , spring , hibernate  and some servlets  ,
>> please tell  me  steps for  making  it a grails  project.
>>
>> My need is more like create some pages using grails  i want to use grails
>> becasue of dynamic loading .
>> I want the behavior of changing my application at runtime without restarting
>> server.
>> --
>> View this message in context: http://grails.1312388.n4.nabble.com/integrate-grails-in-existing-j2ee-app-tp2248932p2248962.html
>> Sent from the Grails - user mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>    http://xircles.codehaus.org/manage_email
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

RE: integrate grails in existing j2ee app

rlovtangen
It worked in practice for me.
I was using spring 3.0.2 and hibernate 3.3.2.GA.

What is painful though, is that maven and grails both try to do dependency management, so you have to be careful that you don't end up with different versions of the same dependency. E.g. I found two different versions of javassist in the final war's lib folder.

Thanks for the tip about resources.groovy. How do you configure that to pick up your spring config files from your included jars?

Ronny

On Jun 10, 2010, at 10:41 AM, Tomas Lin wrote:

> That should work in theory and I really really wish it worked like
> that out of the box, but in practice it is much more complicated.
>
> You need to first migrate all your code to use the same Spring /
> Hibernate versions that are used by grails. This is not trivial since
> the Spring framework basically spits in the face of backwards
> compatibility. Then there are subtle differences in hibernate
> versions. So basically, to use grails, you go through this gigantic
> upgrade process in your core app to make it compatible with the latest
> and greatest jars.
>
> You also need to carefully manage all your imported dependencies from
> Maven so that you exclude all the jars. You can find the dependency
> list at
>
> http://github.com/grails/grails-core/blob/master/dependencies.txt
>
> The grails dependency-report and xml dependencies file that get
> generated in .ivy is helpful here.
>
> I would actually recommend using conf/spring/resources.groovy vs. the
> web.xml file. My experience is that modifying web.xml leads to misery
> and sorrow down the line since this file can change radically across
> grails versions.
>
>
> On Thu, Jun 10, 2010 at 9:06 AM, Ronny Løvtangen <[hidden email]> wrote:
>> If your maven project is a multi module project (which is often the case), your first step could be to just exchange your war module with Grails. Your other jars could be used as is. To link them in you could either throw them in the lib folder, use grails' dependency management, or use grails with maven.
>> Note that the maven support, although improving, is still a little rough. Especially the documentation.
>>
>>
>> To have Grails pick up your existing spring config you probably have to do some minor changes to contextConfigLocation in src/templates/war/web.xml. Here's mine:
>>
>>    <context-param>
>>        <param-name>contextConfigLocation</param-name>
>>        <param-value>classpath*:/applicationContext.xml,/WEB-INF/applicationContext.xml</param-value>
>>    </context-param>
>>
>> Note: src/templates/war/web.xm is not there by default, you have to do a "grails install-templates" first.
>>
>> You will have your existing spring beans available in Grails as well, and your hibernate mapping should work just fine.
>> Then later, if you want to, you can move more of your backend code to Grails.
>>
>> Ronny
>>
>>
>> On Jun 9, 2010, at 4:43 PM, fachhoch wrote:
>>
>>>
>>> Mine is maven 2 app using wicket , spring , hibernate  and some servlets  ,
>>> please tell  me  steps for  making  it a grails  project.
>>>
>>> My need is more like create some pages using grails  i want to use grails
>>> becasue of dynamic loading .
>>> I want the behavior of changing my application at runtime without restarting
>>> server.
>>> --
>>> View this message in context: http://grails.1312388.n4.nabble.com/integrate-grails-in-existing-j2ee-app-tp2248932p2248962.html
>>> Sent from the Grails - user mailing list archive at Nabble.com.
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe from this list, please visit:
>>>
>>>    http://xircles.codehaus.org/manage_email
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>    http://xircles.codehaus.org/manage_email
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

RE: integrate grails in existing j2ee app

tomas lin
Right, but most legacy spring apps would not be on 3.0. The app I had
to integrate was on 2.5 and took about a week to work out all the
kinks.

On Thu, Jun 10, 2010 at 10:13 AM, Ronny Løvtangen <[hidden email]> wrote:

> It worked in practice for me.
> I was using spring 3.0.2 and hibernate 3.3.2.GA.
>
> What is painful though, is that maven and grails both try to do dependency management, so you have to be careful that you don't end up with different versions of the same dependency. E.g. I found two different versions of javassist in the final war's lib folder.
>
> Thanks for the tip about resources.groovy. How do you configure that to pick up your spring config files from your included jars?
>
> Ronny
>
> On Jun 10, 2010, at 10:41 AM, Tomas Lin wrote:
>
>> That should work in theory and I really really wish it worked like
>> that out of the box, but in practice it is much more complicated.
>>
>> You need to first migrate all your code to use the same Spring /
>> Hibernate versions that are used by grails. This is not trivial since
>> the Spring framework basically spits in the face of backwards
>> compatibility. Then there are subtle differences in hibernate
>> versions. So basically, to use grails, you go through this gigantic
>> upgrade process in your core app to make it compatible with the latest
>> and greatest jars.
>>
>> You also need to carefully manage all your imported dependencies from
>> Maven so that you exclude all the jars. You can find the dependency
>> list at
>>
>> http://github.com/grails/grails-core/blob/master/dependencies.txt
>>
>> The grails dependency-report and xml dependencies file that get
>> generated in .ivy is helpful here.
>>
>> I would actually recommend using conf/spring/resources.groovy vs. the
>> web.xml file. My experience is that modifying web.xml leads to misery
>> and sorrow down the line since this file can change radically across
>> grails versions.
>>
>>
>> On Thu, Jun 10, 2010 at 9:06 AM, Ronny Løvtangen <[hidden email]> wrote:
>>> If your maven project is a multi module project (which is often the case), your first step could be to just exchange your war module with Grails. Your other jars could be used as is. To link them in you could either throw them in the lib folder, use grails' dependency management, or use grails with maven.
>>> Note that the maven support, although improving, is still a little rough. Especially the documentation.
>>>
>>>
>>> To have Grails pick up your existing spring config you probably have to do some minor changes to contextConfigLocation in src/templates/war/web.xml. Here's mine:
>>>
>>>    <context-param>
>>>        <param-name>contextConfigLocation</param-name>
>>>        <param-value>classpath*:/applicationContext.xml,/WEB-INF/applicationContext.xml</param-value>
>>>    </context-param>
>>>
>>> Note: src/templates/war/web.xm is not there by default, you have to do a "grails install-templates" first.
>>>
>>> You will have your existing spring beans available in Grails as well, and your hibernate mapping should work just fine.
>>> Then later, if you want to, you can move more of your backend code to Grails.
>>>
>>> Ronny
>>>
>>>
>>> On Jun 9, 2010, at 4:43 PM, fachhoch wrote:
>>>
>>>>
>>>> Mine is maven 2 app using wicket , spring , hibernate  and some servlets  ,
>>>> please tell  me  steps for  making  it a grails  project.
>>>>
>>>> My need is more like create some pages using grails  i want to use grails
>>>> becasue of dynamic loading .
>>>> I want the behavior of changing my application at runtime without restarting
>>>> server.
>>>> --
>>>> View this message in context: http://grails.1312388.n4.nabble.com/integrate-grails-in-existing-j2ee-app-tp2248932p2248962.html
>>>> Sent from the Grails - user mailing list archive at Nabble.com.
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe from this list, please visit:
>>>>
>>>>    http://xircles.codehaus.org/manage_email
>>>>
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe from this list, please visit:
>>>
>>>    http://xircles.codehaus.org/manage_email
>>>
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>    http://xircles.codehaus.org/manage_email
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

RE: integrate grails in existing j2ee app

rlovtangen
Upgrading spring to 3.0 is most of the time a drop-in replacement, and you probably want to upgrade even if you're not moving to Grails.
But there could of course be some issues.


On Jun 10, 2010, at 12:14 PM, Tomas Lin wrote:

> Right, but most legacy spring apps would not be on 3.0. The app I had
> to integrate was on 2.5 and took about a week to work out all the
> kinks.
>
> On Thu, Jun 10, 2010 at 10:13 AM, Ronny Løvtangen <[hidden email]> wrote:
>> It worked in practice for me.
>> I was using spring 3.0.2 and hibernate 3.3.2.GA.
>>
>> What is painful though, is that maven and grails both try to do dependency management, so you have to be careful that you don't end up with different versions of the same dependency. E.g. I found two different versions of javassist in the final war's lib folder.
>>
>> Thanks for the tip about resources.groovy. How do you configure that to pick up your spring config files from your included jars?
>>
>> Ronny
>>
>> On Jun 10, 2010, at 10:41 AM, Tomas Lin wrote:
>>
>>> That should work in theory and I really really wish it worked like
>>> that out of the box, but in practice it is much more complicated.
>>>
>>> You need to first migrate all your code to use the same Spring /
>>> Hibernate versions that are used by grails. This is not trivial since
>>> the Spring framework basically spits in the face of backwards
>>> compatibility. Then there are subtle differences in hibernate
>>> versions. So basically, to use grails, you go through this gigantic
>>> upgrade process in your core app to make it compatible with the latest
>>> and greatest jars.
>>>
>>> You also need to carefully manage all your imported dependencies from
>>> Maven so that you exclude all the jars. You can find the dependency
>>> list at
>>>
>>> http://github.com/grails/grails-core/blob/master/dependencies.txt
>>>
>>> The grails dependency-report and xml dependencies file that get
>>> generated in .ivy is helpful here.
>>>
>>> I would actually recommend using conf/spring/resources.groovy vs. the
>>> web.xml file. My experience is that modifying web.xml leads to misery
>>> and sorrow down the line since this file can change radically across
>>> grails versions.
>>>
>>>
>>> On Thu, Jun 10, 2010 at 9:06 AM, Ronny Løvtangen <[hidden email]> wrote:
>>>> If your maven project is a multi module project (which is often the case), your first step could be to just exchange your war module with Grails. Your other jars could be used as is. To link them in you could either throw them in the lib folder, use grails' dependency management, or use grails with maven.
>>>> Note that the maven support, although improving, is still a little rough. Especially the documentation.
>>>>
>>>>
>>>> To have Grails pick up your existing spring config you probably have to do some minor changes to contextConfigLocation in src/templates/war/web.xml. Here's mine:
>>>>
>>>>    <context-param>
>>>>        <param-name>contextConfigLocation</param-name>
>>>>        <param-value>classpath*:/applicationContext.xml,/WEB-INF/applicationContext.xml</param-value>
>>>>    </context-param>
>>>>
>>>> Note: src/templates/war/web.xm is not there by default, you have to do a "grails install-templates" first.
>>>>
>>>> You will have your existing spring beans available in Grails as well, and your hibernate mapping should work just fine.
>>>> Then later, if you want to, you can move more of your backend code to Grails.
>>>>
>>>> Ronny
>>>>
>>>>
>>>> On Jun 9, 2010, at 4:43 PM, fachhoch wrote:
>>>>
>>>>>
>>>>> Mine is maven 2 app using wicket , spring , hibernate  and some servlets  ,
>>>>> please tell  me  steps for  making  it a grails  project.
>>>>>
>>>>> My need is more like create some pages using grails  i want to use grails
>>>>> becasue of dynamic loading .
>>>>> I want the behavior of changing my application at runtime without restarting
>>>>> server.
>>>>> --
>>>>> View this message in context: http://grails.1312388.n4.nabble.com/integrate-grails-in-existing-j2ee-app-tp2248932p2248962.html
>>>>> Sent from the Grails - user mailing list archive at Nabble.com.
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe from this list, please visit:
>>>>>
>>>>>    http://xircles.codehaus.org/manage_email
>>>>>
>>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe from this list, please visit:
>>>>
>>>>    http://xircles.codehaus.org/manage_email
>>>>
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe from this list, please visit:
>>>
>>>    http://xircles.codehaus.org/manage_email
>>>
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>    http://xircles.codehaus.org/manage_email
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email