将旧的2.2.2应用程序迁移到3.1.2,我能否知道为什么这个应用程序因bootstrap.groovy而崩溃 任何帮助将不胜感激,谢谢
使用:grails 3.1.2,mysql workbench 6
这是导致整个应用程序停止运行的Bootstrap.groovy
import grailsapp.Location;
import grailsapp.State;
import grailsapp.User;
import grailsapp.Type;
class BootStrap {
def init = { servletContext ->
new State(state: "Issuable", updates: [:]).save(failOnError:true)
new State(state: "Holding", updates: [:]).save(failOnError:true)
new State(state: "In for repair", updates: [:]).save(failOnError:true)
new Location(location: "L163", specific: "Rack 3A", updates: [:]).save(failOnError:true)
new Location(location: "L163", specific: "Rack 3B", updates: [:]).save(failOnError:true)
new Location(location: "L163", specific: "Rack 3C", updates: [:]).save(failOnError:true)
new User(username:"blah", password: User.hashPassword("password"), firstName:"blah", lastName:"blah", isAdmin:true, updates:[:]).save(failOnError:true)
new Type(type:"Dell E6500").save(failOnError:true)
new Type(type:"Dell E6510").save(failOnError:true)
new Type(type:"Dell E6520").save(failOnError:true)
}
def destroy = {
}
}
这些是它导致的错误
ERROR org.springframework.boot.SpringApplication - Application startup failed
grails.validation.ValidationException: Validation Error(s) occurred during save():
- Field error in object 'grailsapp.State' on field 'updates': rejected value [{}]; codes [grailsapp.State.updates.typeMi
smatch.error,grailsapp.State.updates.typeMismatch,state.updates.typeMismatch.error,state.updates.typeMismatch,typeMismat
ch.grailsapp.State.updates,typeMismatch.updates,typeMismatch.java.util.Set,typeMismatch]; arguments [updates]; default m
essage [Could not find matching constructor for: java.util.Set()]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_65]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_65]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8
.0_65]
at java.lang.reflect.Constructor.newInstance(Constructor.java:422) ~[na:1.8.0_65]
at org.springsource.loaded.ri.ReflectiveInterceptor.jlrConstructorNewInstance(ReflectiveInterceptor.java:1075) ~
[springloaded-1.2.5.RELEASE.jar:1.2.5.RELEASE]
at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:83) ~[groovy-2.4.6.jar:2.4.6]
at org.codehaus.groovy.reflection.CachedConstructor.doConstructorInvoke(CachedConstructor.java:77) ~[groovy-2.4.
6.jar:2.4.6]
at groovy.lang.MetaClassImpl.invokeConstructor(MetaClassImpl.java:1714) ~[groovy-2.4.6.jar:2.4.6]
at groovy.lang.MetaClassImpl.invokeConstructor(MetaClassImpl.java:1531) ~[groovy-2.4.6.jar:2.4.6]
at org.codehaus.groovy.runtime.InvokerHelper.invokeConstructorOf(InvokerHelper.java:954) ~[groovy-2.4.6.jar:2.4.
6]
at org.codehaus.groovy.runtime.DefaultGroovyMethods.newInstance(DefaultGroovyMethods.java:15640) ~[groovy-2.4.6.
jar:2.4.6]
at org.grails.orm.hibernate.AbstractHibernateGormInstanceApi.save(AbstractHibernateGormInstanceApi.groovy:131) ~
[grails-datastore-gorm-hibernate-core-5.0.2.RELEASE.jar:na]
at org.grails.datastore.gorm.GormEntity$Trait$Helper.save(GormEntity.groovy:140) ~[grails-datastore-gorm-5.0.2.R
ELEASE.jar:na]
at org.grails.datastore.gorm.GormEntity$Trait$Helper$save.call(Unknown Source) ~[na:na]
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48) [groovy-2.4.6.jar:2.4.6
]
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113) [groovy-2.4.6.jar:2.4.6
]
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:133) [groovy-2.4.6.jar:2.4.6
]
at grailsapp.State.save(State.groovy) ~[main/:na]
at grailsapp.State.save(State.groovy) ~[main/:na]
at org.grails.datastore.gorm.GormEntity$save.call(Unknown Source) ~[na:na]
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48) [groovy-2.4.6.jar:2.4.6
]
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113) [groovy-2.4.6.jar:2.4.6
]
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125) [groovy-2.4.6.jar:2.4.6
]
at BootStrap$_closure1.doCall(BootStrap.groovy:10) ~[main/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_65]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_65]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_65]
at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_65]
at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1426) ~[springloa
ded-1.2.5.RELEASE.jar:1.2.5.RELEASE]
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93) ~[groovy-2.4.6.jar:2.4.6]
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325) ~[groovy-2.4.6.jar:2.4.6]
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294) ~[groovy-2.4.6
.jar:2.4.6]
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1021) ~[groovy-2.4.6.jar:2.4.6]
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1086) ~[groovy-2.4.6.jar:2.4.6]
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1021) ~[groovy-2.4.6.jar:2.4.6]
at groovy.lang.Closure.call(Closure.java:426) ~[groovy-2.4.6.jar:2.4.6]
at groovy.lang.Closure.call(Closure.java:420) ~[groovy-2.4.6.jar:2.4.6]
at grails.util.Environment.evaluateEnvironmentSpecificBlock(Environment.java:437) ~[grails-bootstrap-3.1.2.jar:3
.1.2]
at grails.util.Environment.executeForEnvironment(Environment.java:430) ~[grails-bootstrap-3.1.2.jar:3.1.2]
at grails.util.Environment.executeForCurrentEnvironment(Environment.java:406) ~[grails-bootstrap-3.1.2.jar:3.1.2
]
at org.grails.web.servlet.boostrap.DefaultGrailsBootstrapClass.callInit(DefaultGrailsBootstrapClass.java:62) ~[g
rails-web-3.1.2.jar:3.1.2]
at org.grails.web.servlet.context.GrailsConfigUtils.executeGrailsBootstraps(GrailsConfigUtils.java:65) ~[grails-
web-3.1.2.jar:3.1.2]
at org.grails.plugins.web.servlet.context.BootStrapClassRunner.onStartup(BootStrapClassRunner.groovy:53) ~[grail
s-plugin-controllers-3.1.2.jar:3.1.2]
at grails.boot.config.GrailsApplicationPostProcessor.onApplicationEvent(GrailsApplicationPostProcessor.groovy:24
0) ~[grails-core-3.1.2.jar:3.1.2]
at grails.boot.config.GrailsApplicationPostProcessor.onApplicationEvent(GrailsApplicationPostProcessor.groovy) ~
[grails-core-3.1.2.jar:3.1.2]
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMult
icaster.java:163) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMult
icaster.java:136) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:3
81) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:3
35) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:
855) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationC
ontext.java:140) ~[spring-boot-1.3.2.RELEASE.jar:1.3.2.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541) ~
[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext
.java:118) ~[spring-boot-1.3.2.RELEASE.jar:1.3.2.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:766) ~[spring-boot-1.3.2.RELEASE.ja
r:1.3.2.RELEASE]
at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:361) ~[spring-boot-
1.3.2.RELEASE.jar:1.3.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) ~[spring-boot-1.3.2.RELEASE.jar:1.
3.2.RELEASE]
at grails.boot.GrailsApp.run(GrailsApp.groovy:55) [grails-core-3.1.2.jar:3.1.2]
at grails.boot.GrailsApp.run(GrailsApp.groovy:365) [grails-core-3.1.2.jar:3.1.2]
at grails.boot.GrailsApp.run(GrailsApp.groovy:354) [grails-core-3.1.2.jar:3.1.2]
at grails.boot.GrailsApp$run.call(Unknown Source) [grails-core-3.1.2.jar:3.1.2]
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48) [groovy-2.4.6.jar:2.4.6
]
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113) [groovy-2.4.6.jar:2.4.6
]
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:133) [groovy-2.4.6.jar:2.4.6
]
at grailsapp.Application.main(Application.groovy:8) [main/:na]
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':bootRun'.
> Process 'command 'C:\Program Files\Java\jdk1.8.0_65\bin\java.exe'' finished with non-zero exit value 1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
| Error Failed to start server (Use --stacktrace to see the full trace)
state.groovy
package grailsapp
class State {
String state
static hasMany = [updates: Update]
static constraints = {
state blank:false
}
String toString() {
state
}
static ArrayList<State> getStates() {
State.findAllByStateNotEqual("Issued")
}
}
答案 0 :(得分:1)
dim outputArray
dim inputText
dim message
Dim strText
Dim MyArray
conversion = "Conversion Status:"
Set objShell = WScript.CreateObject("WScript.Shell")
Set objExecObject = ObjShell.Exec("PowerShell.exe manage-bde"" -status C:")
Do While Not objExecObject.StdOut.AtEndOfStream
strText = objExecObject.StdOut.ReadLine()
inputText = strText
outputArray = split(inputText,"Conversion Status:")
for each i in outputArray
output = i
next
position = InStr(1, strText,conversion, 1)
msgbox position
Loop
上的updates
字段似乎是State
,但您正在使用Set
对其进行初始化。尝试:
Map
答案 1 :(得分:1)
看到你的州级后,我检查了'updates'字段是一个hasMany关系。它说关系是从0到很多对象。我的意思是,没有必要指定更新,所以如果你编写你的州级没有更新,它必须是有效的:
new State(state: "Issuable")
new State(state: "Holding")
new State(state: "In for repair")
现在你的问题是,如果你尝试:
new State(state: "Issuable", updates: [:]).save(failOnError:true) or
new State(state: "Issuable", updates: []).save(failOnError:true)
您将收到错误,因为更新不是地图或列表。它必须是“更新”类的对象。