Adding domain class causes deploy to fail

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Adding domain class causes deploy to fail

jbarrionuevo
Hi everyone,

I'm working with a Grails 2.0.4 legacy application. Adding a new (empty) domain class to the project causes Tomcat to fail to deploy the WAR.

Scenario
-The domain class is created with grails create-domain-class com.company.group..ClassName
-The class needs to be mapped in a MySQL table, as the rest of the domain classes.
-Tried both creating the MySQL table manually and not creating it at all. 
-ORM is Hibernate 2.0.4 
-Tomcat log catalina.out doesn't show any error, despite failure to deploy the war.
-Deleting the new domain class will cause the WAR to be deployed properly.

Help will be appreciated. Thanks!

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/1d2cf67f-5716-402b-b576-f595227731e2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Adding domain class causes deploy to fail

Daniel Leahy
Hi Jorge,


Grails 2.0.4, wow that's going back a while.

Could be a lot of different things

What is your dbCreate flag set for production?

For production, it should be set to none, but you could set it to update

Does the DB user in the datasource config your using have permission to create new tables?

I use flyway for Db migrations, liquibase is also an alternative, or manually doing it.

If you have a local instance of the DB, you can install the war in a local instance of tomcat with the dbCreate flag set  to create-drop and see does it create the new domain/schema for you in the DB.

Docker is an excellent way to recreate the infrastructure you need to run the app locally.

If it does you can then get your DB tool, MySQL workbench or pgadmin3 or whatever tool to create the creation script for the new table which you can then run against the production DB to update it.

You can also turn on SQL logging in your data source config to see what SQL is being attempted.

Regards, 
                Daniel Leahy.













On Mon, May 27, 2019 at 8:41 PM Jorge Barrionuevo <[hidden email]> wrote:
Hi everyone,

I'm working with a Grails 2.0.4 legacy application. Adding a new (empty) domain class to the project causes Tomcat to fail to deploy the WAR.

Scenario
-The domain class is created with grails create-domain-class com.company.group..ClassName
-The class needs to be mapped in a MySQL table, as the rest of the domain classes.
-Tried both creating the MySQL table manually and not creating it at all. 
-ORM is Hibernate 2.0.4 
-Tomcat log catalina.out doesn't show any error, despite failure to deploy the war.
-Deleting the new domain class will cause the WAR to be deployed properly.

Help will be appreciated. Thanks!

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/1d2cf67f-5716-402b-b576-f595227731e2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/CAPuiA6%2BZuLx5uzs3giKrxwq_B_LwTzY%3DfyqgFPr_3Nr8yJJeZA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Adding domain class causes deploy to fail

jbarrionuevo
Hi Daniel,

Found the dbCreate flag is in a file located in the server, that overrides the Grails environment configuration. It was set as "validate". As you suggested, changed the value to "Update" and it started pulling the data from the MySQL table.

Thanks! I really appreciate your help.


On Mon, May 27, 2019 at 4:57 PM Daniel Leahy <[hidden email]> wrote:
Hi Jorge,


Grails 2.0.4, wow that's going back a while.

Could be a lot of different things

What is your dbCreate flag set for production?

For production, it should be set to none, but you could set it to update

Does the DB user in the datasource config your using have permission to create new tables?

I use flyway for Db migrations, liquibase is also an alternative, or manually doing it.

If you have a local instance of the DB, you can install the war in a local instance of tomcat with the dbCreate flag set  to create-drop and see does it create the new domain/schema for you in the DB.

Docker is an excellent way to recreate the infrastructure you need to run the app locally.

If it does you can then get your DB tool, MySQL workbench or pgadmin3 or whatever tool to create the creation script for the new table which you can then run against the production DB to update it.

You can also turn on SQL logging in your data source config to see what SQL is being attempted.

Regards, 
                Daniel Leahy.













On Mon, May 27, 2019 at 8:41 PM Jorge Barrionuevo <[hidden email]> wrote:
Hi everyone,

I'm working with a Grails 2.0.4 legacy application. Adding a new (empty) domain class to the project causes Tomcat to fail to deploy the WAR.

Scenario
-The domain class is created with grails create-domain-class com.company.group..ClassName
-The class needs to be mapped in a MySQL table, as the rest of the domain classes.
-Tried both creating the MySQL table manually and not creating it at all. 
-ORM is Hibernate 2.0.4 
-Tomcat log catalina.out doesn't show any error, despite failure to deploy the war.
-Deleting the new domain class will cause the WAR to be deployed properly.

Help will be appreciated. Thanks!

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/1d2cf67f-5716-402b-b576-f595227731e2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/CAPuiA6%2BZuLx5uzs3giKrxwq_B_LwTzY%3DfyqgFPr_3Nr8yJJeZA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/CADgXZYOCegnukniszs4OdmtdQs-W07Y7gQe86CsE289ivBWdcA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Adding domain class causes deploy to fail

Daniel Leahy
Hi Jorge, 
               now that you got your app working again on production I would highly recommend you set the dbCreate flag back to validate or none for production

It is just best practice not to have the grails-app change your DB schema in production.

best practice would be to use flyway or liquibase to handle your Db migrations so you can see the delta changes over time and have the possibility of rolling back automatically if a change didn't work.

Best of luck,
                   Daniel Leahy.










On Tuesday, 28 May 2019 13:40:18 UTC+1, Jorge Barrionuevo wrote:
Hi Daniel,

Found the dbCreate flag is in a file located in the server, that overrides the Grails environment configuration. It was set as "validate". As you suggested, changed the value to "Update" and it started pulling the data from the MySQL table.

Thanks! I really appreciate your help.


On Mon, May 27, 2019 at 4:57 PM Daniel Leahy <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="egtdvhorCAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">danl...@...> wrote:
Hi Jorge,


Grails 2.0.4, wow that's going back a while.

Could be a lot of different things

What is your dbCreate flag set for production?

For production, it should be set to none, but you could set it to update

Does the DB user in the datasource config your using have permission to create new tables?

I use flyway for Db migrations, liquibase is also an alternative, or manually doing it.

If you have a local instance of the DB, you can install the war in a local instance of tomcat with the dbCreate flag set  to create-drop and see does it create the new domain/schema for you in the DB.

Docker is an excellent way to recreate the infrastructure you need to run the app locally.

If it does you can then get your DB tool, MySQL workbench or pgadmin3 or whatever tool to create the creation script for the new table which you can then run against the production DB to update it.

You can also turn on SQL logging in your data source config to see what SQL is being attempted.

Regards, 
                Daniel Leahy.













On Mon, May 27, 2019 at 8:41 PM Jorge Barrionuevo <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="egtdvhorCAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">jbarri...@...> wrote:
Hi everyone,

I'm working with a Grails 2.0.4 legacy application. Adding a new (empty) domain class to the project causes Tomcat to fail to deploy the WAR.

Scenario
-The domain class is created with grails create-domain-class com.company.group..ClassName
-The class needs to be mapped in a MySQL table, as the rest of the domain classes.
-Tried both creating the MySQL table manually and not creating it at all. 
-ORM is Hibernate 2.0.4 
-Tomcat log catalina.out doesn't show any error, despite failure to deploy the war.
-Deleting the new domain class will cause the WAR to be deployed properly.

Help will be appreciated. Thanks!

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="egtdvhorCAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">grails-dev-discuss+unsubscribe@....
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="egtdvhorCAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">grails-de...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/grails-dev-discuss/1d2cf67f-5716-402b-b576-f595227731e2%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/grails-dev-discuss/1d2cf67f-5716-402b-b576-f595227731e2%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/grails-dev-discuss/1d2cf67f-5716-402b-b576-f595227731e2%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/grails-dev-discuss/1d2cf67f-5716-402b-b576-f595227731e2%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="egtdvhorCAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">grails-dev-discuss+unsubscribe@....
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="egtdvhorCAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">grails-de...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/grails-dev-discuss/CAPuiA6%2BZuLx5uzs3giKrxwq_B_LwTzY%3DfyqgFPr_3Nr8yJJeZA%40mail.gmail.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/grails-dev-discuss/CAPuiA6%2BZuLx5uzs3giKrxwq_B_LwTzY%3DfyqgFPr_3Nr8yJJeZA%40mail.gmail.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/grails-dev-discuss/CAPuiA6%2BZuLx5uzs3giKrxwq_B_LwTzY%3DfyqgFPr_3Nr8yJJeZA%40mail.gmail.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/grails-dev-discuss/CAPuiA6%2BZuLx5uzs3giKrxwq_B_LwTzY%3DfyqgFPr_3Nr8yJJeZA%40mail.gmail.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/dd746000-cf0e-436f-881c-d9ae61d50bbe%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Adding domain class causes deploy to fail

jbarrionuevo
I'm working in a development environment. Will definitely consider a DB versioning system. Thanks.

There is something you mentioned that is interesting. As I am working with this legacy mid sized monolithic web application (all layers deployed as a single WAR) and the development and test process involve several steps to get a version to the DEV environment (compile, build, move to the cloud, un-deploy and deploy), I was thinking on the best approach to make a repeatable local environment to reduce these lengthy cycles. An option would be to have a Docker container (with a Tomcat) where we could modify, compile, build and Deploy the Grails app. Then a second container for the DB (or a local instance). Not sure if that would be a good approach.

Thanks again!     

Best regards,

On Tue, May 28, 2019 at 9:56 AM Daniel Leahy <[hidden email]> wrote:
Hi Jorge, 
               now that you got your app working again on production I would highly recommend you set the dbCreate flag back to validate or none for production

It is just best practice not to have the grails-app change your DB schema in production.

best practice would be to use flyway or liquibase to handle your Db migrations so you can see the delta changes over time and have the possibility of rolling back automatically if a change didn't work.

Best of luck,
                   Daniel Leahy.










On Tuesday, 28 May 2019 13:40:18 UTC+1, Jorge Barrionuevo wrote:
Hi Daniel,

Found the dbCreate flag is in a file located in the server, that overrides the Grails environment configuration. It was set as "validate". As you suggested, changed the value to "Update" and it started pulling the data from the MySQL table.

Thanks! I really appreciate your help.


On Mon, May 27, 2019 at 4:57 PM Daniel Leahy <[hidden email]> wrote:
Hi Jorge,


Grails 2.0.4, wow that's going back a while.

Could be a lot of different things

What is your dbCreate flag set for production?

For production, it should be set to none, but you could set it to update

Does the DB user in the datasource config your using have permission to create new tables?

I use flyway for Db migrations, liquibase is also an alternative, or manually doing it.

If you have a local instance of the DB, you can install the war in a local instance of tomcat with the dbCreate flag set  to create-drop and see does it create the new domain/schema for you in the DB.

Docker is an excellent way to recreate the infrastructure you need to run the app locally.

If it does you can then get your DB tool, MySQL workbench or pgadmin3 or whatever tool to create the creation script for the new table which you can then run against the production DB to update it.

You can also turn on SQL logging in your data source config to see what SQL is being attempted.

Regards, 
                Daniel Leahy.













On Mon, May 27, 2019 at 8:41 PM Jorge Barrionuevo <[hidden email]> wrote:
Hi everyone,

I'm working with a Grails 2.0.4 legacy application. Adding a new (empty) domain class to the project causes Tomcat to fail to deploy the WAR.

Scenario
-The domain class is created with grails create-domain-class com.company.group..ClassName
-The class needs to be mapped in a MySQL table, as the rest of the domain classes.
-Tried both creating the MySQL table manually and not creating it at all. 
-ORM is Hibernate 2.0.4 
-Tomcat log catalina.out doesn't show any error, despite failure to deploy the war.
-Deleting the new domain class will cause the WAR to be deployed properly.

Help will be appreciated. Thanks!

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/1d2cf67f-5716-402b-b576-f595227731e2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/CAPuiA6%2BZuLx5uzs3giKrxwq_B_LwTzY%3DfyqgFPr_3Nr8yJJeZA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/dd746000-cf0e-436f-881c-d9ae61d50bbe%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/CADgXZYO%3DWPivELBFRhsYo6Qbor2BzcXssmJq66PKWc_m8B4o%2BA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.