gpt4 book ai didi

hibernate - 无法初始化上下文,因为已经存在根应用程序上下文

转载 作者:行者123 更新时间:2023-12-03 08:08:05 25 4
gpt4 key购买 nike

我的项目使用Tapestry 5.3.0,Spring 3.0.6.RELEASE,Hibernate 3.6.8.FINAL和Maven.When
我指示码头用mvn jetty:run开始项目,我得到以下信息:

2011-12-13 16:15:42.947:WARN::failed app: java.lang.RuntimeException: Exception     constructing service 'ApplicationContext': Cannot initialize context because there is  already a root application context present - check whether you have multiple ContextLoader*  definitions in your web.xml!
2011-12-13 16:15:42.948:WARN::Failed startup of context org.mortbay.jetty.plugin.Jetty6PluginWebAppContext@98062f{/projektni,/home/borislav/eclipse_ workspace/web_apps/projektni/src/main/webapp}
java.lang.RuntimeException: Exception constructing service 'ApplicationContext': Cannot initialize context because there is already a root application context present - check whether you have multiple ContextLoader* definitions in your web.xml!
at org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.obtainObjectFromCreator(J ustInTimeObjectCreator.java:78)
at org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.createObject(JustInTimeOb jectCreator.java:56)
at $ConfigurableWebApplicationContext_10f23e440970.delegate(Unknown Source)
at $ConfigurableWebApplicationContext_10f23e440970.getBeanDefinitionCount(Unknown Source)
at org.apache.tapestry5.spring.SpringModule$1.initializeApplication(SpringModule.java:58)
at $ApplicationInitializer_10f23e440987.initializeApplication(Unknown Source)
at org.apache.tapestry5.services.TapestryModule$39.initializeApplication(TapestryModule.java:25 55)
at $ApplicationInitializer_10f23e440987.initializeApplication(Unknown Source)
at $ApplicationInitializer_10f23e440983.initializeApplication(Unknown Source)
at org.apache.tapestry5.services.TapestryModule$ServletApplicationInitializerTerminator.initial izeApplication(TapestryModule.java:411)
at $ServletApplicationInitializer_10f23e440969.initializeApplication(Unknown Source)
at org.apache.tapestry5.TapestryFilter.init(TapestryFilter.java:102)
at org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:97)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:713)
at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1282)
at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:518)
at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:499)
at org.mortbay.jetty.plugin.Jetty6PluginWebAppContext.doStart(Jetty6PluginWebAppContext.java:11 5)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)
at org.mortbay.jetty.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:156 )
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at org.mortbay.jetty.handler.HandlerCollection.doStart(HandlerCollection.java:152)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
at org.mortbay.jetty.Server.doStart(Server.java:224)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at org.mortbay.jetty.plugin.Jetty6PluginServer.start(Jetty6PluginServer.java:132)
at org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:454)
at org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:396)
at org.mortbay.jetty.plugin.AbstractJettyRunMojo.execute(AbstractJettyRunMojo.java:210)
at org.mortbay.jetty.plugin.Jetty6RunMojo.execute(Jetty6RunMojo.java:184)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java :107)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuild er.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuild er.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.ja va:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:534)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
2011-12-13 16:15:43.009:INFO::Started SelectChannelConnector@0.0.0.0:8080[INFO]
Started Jetty Server


Web.xml看起来像这样:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>projektni Tapestry 5 Application</display-name>

<context-param>
<!-- The only significant configuration for Tapestry 5, this informs Tapestry
of where to look for pages, components and mixins. -->
<param-name>tapestry.app-package</param-name>
<param-value>org.prikic.projektni</param-value>
</context-param>
<!-- Specify some additional Modules for two different execution modes:
development and qa. Remember that the default execution mode is production -->
<context-param>
<param-name>tapestry.development-modules</param-name>
<param-value>
org.prikic.projektni.services.DevelopmentModule
</param-value>
</context-param>
<context-param>
<param-name>tapestry.qa-modules</param-name>
<param-value>
org.prikic.projektni.services.QaModule
</param-value>
</context-param>


<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>

<!-- /WEB-INF/application_context_dao.xml -->
<!-- /WEB-INF/application_context*.xml -->
classpath:application_context*.xml

</param-value>
</context-param>

<filter>
<filter-name>app</filter-name>
<!-- Special filter that adds in a T5 IoC module derived from the Spring
WebApplicationContext. -->
<filter-class>org.apache.tapestry5.spring.TapestrySpringFilter</filter-class>
</filter>

<filter-mapping>
<filter-name>app</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>


<listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

<!-- <servlet>
<servlet-name>context</servlet-name>
<servlet-class>org.springframework.web.context.ContextLoaderServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet> -->

<welcome-file-list>
<welcome-file>Index</welcome-file>
</welcome-file-list>




如果您需要其他任何源代码文件,请告诉我,我将其发布

有想法吗?

最佳答案

您应该从web.xml中删除ContextLoaderListener。以下是Tapestry Spring integration页的内容。

请省略有关创建ContextLoaderListener的部分:Tapestry现在自动完成此操作。

关于hibernate - 无法初始化上下文,因为已经存在根应用程序上下文,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8492173/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com