所以我正在尝试创建一个grails应用程序,该应用程序挂钩到主键列为UUID的现有数据库中:
Column | Type | Modifiers
-------------------+-----------------------------+-----------
uuid | uuid | not null
Run Code Online (Sandbox Code Playgroud)
但是,当我设置我的数据源时:
class DataStore {
UUID uuid
...
static mapping = {
...
id generator: 'assigned', name: 'uuid', type: 'pg-uuid'
}
Run Code Online (Sandbox Code Playgroud)
它坚持认为uuid列是varchar(255).我不知道我需要做些什么来让它认识到uuid列是一个uuid列,并且我已经尝试在src/groovy /中放置一个UserType类,但这并没有解决任何问题.
我也试图用inet列做同样的事情,但我在这里一步一步.
这里有什么帮助?我很快就结束了.
编辑:我发现这个grails使用uuid作为id并映射到二进制列,但它只是在我尝试运行它时抛出此错误:
Caused by: 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': Invocation of init method failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsDomainException: Error …Run Code Online (Sandbox Code Playgroud) 所以我在我的本地机器上运行STS的Grails应用程序,并且我正在尝试将其部署到CentOS/Tomcat服务器VM.我认为我正确安装了Groovy和Grails,或者至少我现在可以通过将它们添加到/ etc/bashrc中的路径来从控制台运行它们.但是,当我获取我编译的.war文件,并将其放入Tomcat服务器的webapp目录并重新启动服务器时,它会抛出此错误:
Oct 17, 2011 4:33:21 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive CSTools-0.1.war
2011-10-17 16:33:29,558 [main] ERROR context.ContextLoader - Context initialization failed
org.springframework.beans.factory.access.BootstrapException: Error executing bootstraps; nested exception is org.codehaus.groovy.runtime.InvokerInvocationException: java.lang.NoClassDefFoundError: org/codehaus/groovy/runtime/BytecodeInterface8
at org.codehaus.groovy.grails.web.context.GrailsContextLoader.createWebApplicationContext(GrailsContextLoader.java:87)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4206)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4705)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:943)
at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:778)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:504)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1317)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1065)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at …Run Code Online (Sandbox Code Playgroud)