应用使用了数据生成器扩展: Data Generator,打包成uberJar运行报错
task buildUberJar(type: CubaUberJarBuilding) {
singleJar = true
appProperties = ['cuba.automaticDatabaseUpdate': true]
coreJettyEnvPath = 'modules/core/web/META-INF/jetty-env.xml'
logbackConfigurationFile = 'etc/uber-jar-logback.xml'
}
CUBA版本为:7.1.4
错误如下:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'datagen_FakerService' defined in URL [jar:file:/Users/linfeng/code/cuba/cuba-study/build/distributions/uberJar/app.jar!/LIB-INF/app-core/WEB-INF/classes/com/haulmont/addon/datagen/service/FakerServiceBean.class]: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.haulmont.addon.datagen.service.FakerServiceBean]: Constructor threw exception; nested exception is java.net.MalformedURLException: no !/ in spec
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:304) ~[shared/:na]
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:171) ~[shared/:na]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1340) ~[shared/:na]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1186) ~[shared/:na]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) ~[shared/:na]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515) ~[shared/:na]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[shared/:na]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[shared/:na]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[shared/:na]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[shared/:na]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:847) ~[shared/:na]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:877) ~[shared/:na]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549) ~[shared/:na]
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:144) ~[shared/:na]
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:95) ~[shared/:na]
at com.haulmont.cuba.core.sys.CubaClassPathXmlApplicationContext.<init>(CubaClassPathXmlApplicationContext.java:27) ~[classes/:na]
at com.haulmont.cuba.core.sys.CubaCoreApplicationContext.<init>(CubaCoreApplicationContext.java:26) ~[classes/:na]
at com.haulmont.cuba.core.sys.AppContextLoader.createApplicationContext(AppContextLoader.java:94) ~[classes/:na]
at com.haulmont.cuba.core.sys.AppContextLoader.createApplicationContext(AppContextLoader.java:39) ~[classes/:na]
at com.haulmont.cuba.core.sys.AbstractAppContextLoader.initAppContext(AbstractAppContextLoader.java:62) ~[classes/:na]
at com.haulmont.cuba.core.sys.AbstractWebAppContextLoader.contextInitialized(AbstractWebAppContextLoader.java:78) ~[classes/:na]
at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:959) [app.jar:na]
at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:553) [app.jar:na]
at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:924) [app.jar:na]
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:365) [app.jar:na]
at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1497) [app.jar:na]
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1459) [app.jar:na]
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:854) [app.jar:na]
at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:278) [app.jar:na]
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:545) [app.jar:na]
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68) [app.jar:na]
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:167) [app.jar:na]
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:119) [app.jar:na]
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113) [app.jar:na]
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68) [app.jar:na]
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:167) [app.jar:na]
at org.eclipse.jetty.server.Server.start(Server.java:418) [app.jar:na]
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:110) [app.jar:na]
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113) [app.jar:na]
at org.eclipse.jetty.server.Server.doStart(Server.java:382) [app.jar:na]
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68) [app.jar:na]
at com.haulmont.uberjar.CubaJettyServer.start(CubaJettyServer.java:127) [app.jar:na]
at com.haulmont.uberjar.ServerRunner.execute(ServerRunner.java:249) [app.jar:na]
at com.haulmont.uberjar.ServerRunner.main(ServerRunner.java:39) [app.jar:na]
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.haulmont.addon.datagen.service.FakerServiceBean]: Constructor threw exception; nested exception is java.net.MalformedURLException: no !/ in spec
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:184) ~[shared/:na]
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:117) ~[shared/:na]
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:300) ~[shared/:na]
... 43 common frames omitted
Caused by: java.net.MalformedURLException: no !/ in spec
at java.net.URL.<init>(URL.java:627) ~[na:1.8.0_192]
at java.net.URL.<init>(URL.java:490) ~[na:1.8.0_192]
at java.net.URL.<init>(URL.java:439) ~[na:1.8.0_192]
at java.net.JarURLConnection.parseSpecs(JarURLConnection.java:175) ~[na:1.8.0_192]
at java.net.JarURLConnection.<init>(JarURLConnection.java:158) ~[na:1.8.0_192]
at sun.net.www.protocol.jar.JarURLConnection.<init>(JarURLConnection.java:81) ~[na:1.8.0_192]
at sun.net.www.protocol.jar.Handler.openConnection(Handler.java:41) ~[na:1.8.0_192]
at java.net.URL.openConnection(URL.java:979) ~[na:1.8.0_192]
at java.net.URL.openStream(URL.java:1045) ~[na:1.8.0_192]
at io.github.serpro69.kfaker.FakerService.load(FakerService.kt:65) ~[shared/:na]
at io.github.serpro69.kfaker.FakerService.<init>(FakerService.kt:30) ~[shared/:na]
at io.github.serpro69.kfaker.Faker.<init>(Faker.kt:13) ~[shared/:na]
at io.github.serpro69.kfaker.Faker.<init>(Faker.kt:12) ~[shared/:na]
at com.haulmont.addon.datagen.service.FakerServiceBean.<init>(FakerServiceBean.kt:16) ~[classes/:na]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_192]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_192]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_192]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_192]
at kotlin.reflect.jvm.internal.calls.CallerImpl$Constructor.call(CallerImpl.kt:41) ~[shared/:na]
at kotlin.reflect.jvm.internal.KCallableImpl.call(KCallableImpl.kt:106) ~[shared/:na]
at kotlin.reflect.jvm.internal.KCallableImpl.callDefaultMethod$kotlin_reflection(KCallableImpl.kt:152) ~[shared/:na]
at kotlin.reflect.jvm.internal.KCallableImpl.callBy(KCallableImpl.kt:110) ~[shared/:na]
at org.springframework.beans.BeanUtils$KotlinDelegate.instantiateClass(BeanUtils.java:758) ~[shared/:na]
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:172) ~[shared/:na]
... 45 common frames omitted
Caused by: java.lang.NullPointerException: no !/ in spec
at sun.net.www.protocol.jar.Handler.parseAbsoluteSpec(Handler.java:171) ~[na:1.8.0_192]
at sun.net.www.protocol.jar.Handler.parseURL(Handler.java:151) ~[na:1.8.0_192]
at java.net.URL.<init>(URL.java:622) ~[na:1.8.0_192]
... 68 common frames omitted
18:06:02.808 WARN o.eclipse.jetty.webapp.WebAppContext - Failed startup of context o.e.j.w.WebAppContext@6dbb137d{/app-core,jar:file:/Users/linfeng/code/cuba/cuba-study/build/distributions/uberJar/app.jar!/LIB-INF/app-core,UNAVAILABLE}