grails-samples / grails-petclinic Goto Github PK
View Code? Open in Web Editor NEWThe introductory sample application for Grails
The introductory sample application for Grails
Hi,
I'm new in Grails. I first downloaded the zip and import the proyect to my local GGTS, when I ran it was ok, but when I create an owner and got this error:
Error 500: Internal Server Error
URI:/petclinic/owner/add Class:java.lang.NullPointerExceptionMessage:Cannot set property 'controllerClass' on null object
Around line 13 of grails-app\conf\org\grails\samples\ViewSourceFilters.groovy
10: }11: after = { Map model ->12: def controllerClass = grailsApplication.getArtefactByLogicalPropertyName("Controller", controllerName)13: model["controllerClass"] = controllerClass.clazz.name14: model["viewPath"] = "$controllerName:${model['viewName'] ?: actionName}"15: }16: afterView = { Exception e ->
I have installed Grails 2.1.1 and GGTS 3.1.
Then I tried using GIT and cloned it, open cmd and runing as say in readme, but got the same error. It downloaded Grails 2.1.1 previously to run.
What I'm doing bad or is because Grails version?
Thanks
Pd. Sorry for my bad english
I'm getting an exception when i click on the main page's View/edit source for this page:
java.lang.IllegalArgumentException: No module found with name [jquery-ui]
org.grails.plugin.resource.ResourceProcessor.getAllModuleNamesRequired(ResourceProcessor.groovy:1066)
org.grails.plugin.resource.ResourceTagLib$_closure6.doCall(ResourceTagLib.groovy:411)
Users_jessbowers_Downloads_grails_petclinic_master_grails_app_views_layouts_main_gsp$_run_closure1.doCall(Users_jessbowers_Downloads_grails_petclinic_master_grails_app_views_layouts_main_gsp:41)
Users_jessbowers_Downloads_grails_petclinic_master_grails_app_views_layouts_main_gsp.run(Users_jessbowers_Downloads_grails_petclinic_master_grails_app_views_layouts_main_gsp:44)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
java.lang.Thread.run(Thread.java:744)
I don't know enough about grails yet to decypher this. But when I do, I'll follow up.
Environment: Mac OSX 10.9.5
Grails: 2.4.3
JDK: 1.8.05
Stack trace:
| Running Grails application
objc[9698]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/bin/java and /Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home/jre/lib/libinstrument.dylib. One of the two will be used. Which one is undefined.
| Error 2014-10-09 16:24:46,876 [localhost-startStop-1] ERROR context.ContextLoader - Context initialization failed
Message: Error creating bean with name 'grailsApplication' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference to bean 'grailsResourceLoader' while setting bean property 'grailsResourceLoader'; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.codehaus.groovy.grails.commons.GrailsResourceLoaderFactoryBean] for bean with name 'grailsResourceLoader' defined in ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is java.lang.ClassNotFoundException: org.codehaus.groovy.grails.commons.GrailsResourceLoaderFactoryBean
Line | Method
->> 266 | run in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1142 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 617 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run in java.lang.Thread
Caused by CannotLoadBeanClassException: Cannot find class [org.codehaus.groovy.grails.commons.GrailsResourceLoaderFactoryBean] for bean with name 'grailsResourceLoader' defined in ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is java.lang.ClassNotFoundException: org.codehaus.groovy.grails.commons.GrailsResourceLoaderFactoryBean
->> 266 | run in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1142 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 617 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run in java.lang.Thread
Caused by ClassNotFoundException: org.codehaus.groovy.grails.commons.GrailsResourceLoaderFactoryBean
->> 59 | findClass in org.grails.plugins.tomcat.ParentDelegatingClassLoader
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 424 | loadClass in java.lang.ClassLoader
| 357 | loadClass in ''
| 266 | run in java.util.concurrent.FutureTask
| 1142 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 617 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run . . . in java.lang.Thread
| Error 2014-10-09 16:24:46,942 [localhost-startStop-1] ERROR context.GrailsContextLoaderListener - Error initializing the application: Error creating bean with name 'grailsApplication' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference to bean 'grailsResourceLoader' while setting bean property 'grailsResourceLoader'; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.codehaus.groovy.grails.commons.GrailsResourceLoaderFactoryBean] for bean with name 'grailsResourceLoader' defined in ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is java.lang.ClassNotFoundException: org.codehaus.groovy.grails.commons.GrailsResourceLoaderFactoryBean
Message: Error creating bean with name 'grailsApplication' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference to bean 'grailsResourceLoader' while setting bean property 'grailsResourceLoader'; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.codehaus.groovy.grails.commons.GrailsResourceLoaderFactoryBean] for bean with name 'grailsResourceLoader' defined in ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is java.lang.ClassNotFoundException: org.codehaus.groovy.grails.commons.GrailsResourceLoaderFactoryBean
Line | Method
->> 266 | run in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1142 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 617 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run in java.lang.Thread
Caused by CannotLoadBeanClassException: Cannot find class [org.codehaus.groovy.grails.commons.GrailsResourceLoaderFactoryBean] for bean with name 'grailsResourceLoader' defined in ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is java.lang.ClassNotFoundException: org.codehaus.groovy.grails.commons.GrailsResourceLoaderFactoryBean
->> 266 | run in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1142 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 617 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run in java.lang.Thread
Caused by ClassNotFoundException: org.codehaus.groovy.grails.commons.GrailsResourceLoaderFactoryBean
->> 59 | findClass in org.grails.plugins.tomcat.ParentDelegatingClassLoader
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 424 | loadClass in java.lang.ClassLoader
| 357 | loadClass in ''
| 266 | run in java.util.concurrent.FutureTask
| 1142 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 617 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run . . . in java.lang.Thread
| Error Forked Grails VM exited with error
| Server running. Browse to http://localhost:8080/petclinic
I download the application from the Sample Application link on http://grails.org/learn. I unpack the zip file and run "grailsw run-app" but I have this error :
Exception in thread "main" java.util.zip.ZipException: zip file is empty
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.(ZipFile.java:215)
at java.util.zip.ZipFile.(ZipFile.java:145)
at java.util.zip.ZipFile.(ZipFile.java:159)
at org.grails.wrapper.GrailsWrapper.extract(GrailsWrapper.java:147)
at org.grails.wrapper.GrailsWrapper.configureGrailsInstallation(GrailsWr
apper.java:138)
at org.grails.wrapper.GrailsWrapper.main(GrailsWrapper.java:58)
What can I do ?
Thanks for your help.
Im trying to create a dockerfile running this webapp as a service.
and im getting the following:
Unzipping /root/.gradle/wrapper/dists/gradle-2.3-bin/a48v6zq5mdp1uyn9rwlj56945/gradle-2.3-bin.zip to /root/.gradle/wrapper/dists/gradle-2.3-bin/a48v6zq5mdp1uyn9rwlj56945
Set executable permissions for: /root/.gradle/wrapper/dists/gradle-2.3-bin/a48v6zq5mdp1uyn9rwlj56945/gradle-2.3/bin/gradle
Native Lib Architecture: Clifferx64FAILURE: Build failed with an exception.
What went wrong:
Task 'run' not found in root project ''.Try:
Run gradlew tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --inf or --debug option to get more log output.BUILD FAILED
any ideas why?
working with groovy 2.1.6 and grails 2.2.0, I successfully upgraded the petclinic to 2.2.0 and failed with my "run-app" (see below).
Upgrade to 2.2.4 solved this issue.
GernotsiMac27:grails-petclinic gstarke$ grails run-app
| Compiling 40 source files
| Running Grails application
| Error 2013-09-14 10:32:45,801 [localhost-startStop-1] ERROR context.GrailsContextLoader - Error initializing the application: Error creating bean with name 'transactionManagerPostProcessor': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Cannot resolve reference to bean 'hibernateProperties' while setting bean property 'hibernateProperties'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateProperties': Cannot resolve reference to bean 'dialectDetector' while setting bean property 'properties' with key [hibernate.dialect]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dialectDetector': Invocation of init method failed; nested exception is org.codehaus.groovy.grails.orm.hibernate.exceptions.CouldNotDetermineHibernateDialectException: Could not determine Hibernate dialect for database name [H2]!
Message: Error creating bean with name 'transactionManagerPostProcessor': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Cannot resolve reference to bean 'hibernateProperties' while setting bean property 'hibernateProperties'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateProperties': Cannot resolve reference to bean 'dialectDetector' while setting bean property 'properties' with key [hibernate.dialect]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dialectDetector': Invocation of init method failed; nested exception is org.codehaus.groovy.grails.orm.hibernate.exceptions.CouldNotDetermineHibernateDialectException: Could not determine Hibernate dialect for database name [H2]!
Line | Method
->> 334 | innerRun in java.util.concurrent.FutureTask$Sync
| 166 | run in java.util.concurrent.FutureTask
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 724 | run . . . in java.lang.Thread
Caused by BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Cannot resolve reference to bean 'hibernateProperties' while setting bean property 'hibernateProperties'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateProperties': Cannot resolve reference to bean 'dialectDetector' while setting bean property 'properties' with key [hibernate.dialect]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dialectDetector': Invocation of init method failed; nested exception is org.codehaus.groovy.grails.orm.hibernate.exceptions.CouldNotDetermineHibernateDialectException: Could not determine Hibernate dialect for database name [H2]!
I can't run the petclinic example with Java 8 on Linux; it fails to start with the following error:
| Error Compilation error: startup failed:
/home/pepijn/Projects/Grails/grails-petclinic-master/target/work/plugins/database-migration-1.4.0/grails-app/controllers/grails/plugin/databasemigration/DbdocController.groovy: -1: Repetitive method name/signature for method 'java.lang.Object withFormat(groovy.lang.Closure)' in class 'grails.plugin.databasemigration.DbdocController'.
@ line -1, column -1.
/home/pepijn/Projects/Grails/grails-petclinic-master/target/work/plugins/database-migration-1.4.0/grails-app/controllers/grails/plugin/databasemigration/DbdocController.groovy: -1: Repetitive method name/signature for method 'java.lang.Object withFormat(groovy.lang.Closure)' in class 'grails.plugin.databasemigration.DbdocController'.
@ line -1, column -1.
2 errors
uname -a:
Linux falcon 3.13.0-27-generic #50-Ubuntu SMP Thu May 15 18:06:16 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
java -version:
java version "1.8.0_05"
Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode)
When I change JAVA_HOME to Java 7, it does work, so it must be some incompatibility with Java 8.
When trying to add or edit a pet, the following error is received even when the Name
field is populated:
Property [name] of class [org.grails.samples.petclinic.Pet] cannot be null
See the following:
It looks like this is caused by the name of the field for the pet name being pet_name
, but in the PetController
the value is being retrieved from params?.pet?.name
(which is null
).
I've cloned the repo and I get an error:
[host] ~ JAVA_HOME=/etc/alternatives/java_sdk ./grailsw run-app
| Running Grails application
| Error 2014-09-01 17:26:46,182 [localhost-startStop-1] ERROR hbm2ddl.SchemaExport - HHH000389: Unsuccessful: alter table pet drop constraint FK_98le5nat0hd479mg10eua8xn0 if exists
| Error 2014-09-01 17:26:46,184 [localhost-startStop-1] ERROR hbm2ddl.SchemaExport - Table "PET" not found; SQL statement:
alter table pet
drop constraint FK_98le5nat0hd479mg10eua8xn0 if exists [42102-176]
| Error 2014-09-01 17:26:46,185 [localhost-startStop-1] ERROR hbm2ddl.SchemaExport - HHH000389: Unsuccessful: alter table pet drop constraint FK_f265r1o5eddpmock5mflwfywl if exists
| Error 2014-09-01 17:26:46,185 [localhost-startStop-1] ERROR hbm2ddl.SchemaExport - Table "PET" not found; SQL statement:
alter table pet
drop constraint FK_f265r1o5eddpmock5mflwfywl if exists [42102-176]
| Error 2014-09-01 17:26:46,185 [localhost-startStop-1] ERROR hbm2ddl.SchemaExport - HHH000389: Unsuccessful: alter table vet_speciality drop constraint FK_obpuagylkoe92jbh89228tfam if exists
| Error 2014-09-01 17:26:46,186 [localhost-startStop-1] ERROR hbm2ddl.SchemaExport - Table "VET_SPECIALITY" not found; SQL statement:
alter table vet_speciality
drop constraint FK_obpuagylkoe92jbh89228tfam if exists [42102-176]
| Error 2014-09-01 17:26:46,186 [localhost-startStop-1] ERROR hbm2ddl.SchemaExport - HHH000389: Unsuccessful: alter table vet_speciality drop constraint FK_2y6r6dv8pf8b3fxvwek33exqy if exists
| Error 2014-09-01 17:26:46,186 [localhost-startStop-1] ERROR hbm2ddl.SchemaExport - Table "VET_SPECIALITY" not found; SQL statement:
alter table vet_speciality
drop constraint FK_2y6r6dv8pf8b3fxvwek33exqy if exists [42102-176]
| Error 2014-09-01 17:26:46,187 [localhost-startStop-1] ERROR hbm2ddl.SchemaExport - HHH000389: Unsuccessful: alter table visit drop constraint FK_ifoofk96i1wm1ck2eu2518ehq if exists
| Error 2014-09-01 17:26:46,187 [localhost-startStop-1] ERROR hbm2ddl.SchemaExport - Table "VISIT" not found; SQL statement:
alter table visit
drop constraint FK_ifoofk96i1wm1ck2eu2518ehq if exists [42102-176]
| Parent process shutdown. Exiting...
| Error Forked Grails VM exited with error
| Server running. Browse to http://localhost:8080/petclinic
[host] ~ netstat -lptun | grep 8080
[host] ~
No server running. Did I miss something from README.md? DB scripts or something?
When running ./grailsw test-app
against the latest code, one of the tests fail. Output below:
| Failure: can add a valid owner(org.grails.samples.OwnerControllerSpec)
| Condition not satisfied:
controller.response.redirectUrl =~ '/owner/show/\\d+'
| | | |
| | null java.util.regex.Matcher[pattern=/owner/show/\d+ region=0,4 lastmatch=]
| org.codehaus.groovy.grails.plugins.testing.GrailsMockHttpServletResponse@5d8f1dcf
org.grails.samples.OwnerController@4ba3895c
at org.grails.samples.OwnerControllerSpec.can add a valid owner(OwnerControllerSpec.groovy:49)
Customised message has been specified, unfortunately it doesn't work.
owner.firstName.blank=You must specify a first name
It shows error message "Property [firstName] of class [class org.grails.samples.Owner] cannot be null" instead of "You must specify a first name".
I have found the same issue in this screencast http://grails.org/screencast/22
I cloned the repo and ran grails test-app
and everything worked fine. I tried the same in a headless env. and the functional tests failed, so I guess it's the fact that the env. is headless that's the cause of the failure.
I know some people have successfully run Geb tests in a headless env. using either a headless browser (e.g. PhantomJS) or by using XVFB to emulate a display. As a point of reference, it would be really helpful if these Geb tests worked in a headless env. as it's something I've struggled with it in the past (and present).
I clicked the Sample Application download link on grails.org/learn and downloaded the grails-petclinic-master example. I unzipped to a local dir and ran "grailsw run-app". I get the following error.
C:\cygwin\home\eweibust\dev\grails-petclinic-master>grailsw run-app
Exception: java.lang.NumberFormatException thrown from the UncaughtExceptionHand
ler in thread "main"
Let me know what I can provide to help debug the issue.
Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.