<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath*:conf/spring/applicationContext_core*.xml,
classpath*:conf/spring/applicationContext_dict*.xml,
classpath*:conf/spring/applicationContext_hibernate.xml,
classpath*:conf/spring/applicationContext_staff*.xml,
classpath*:conf/spring/applicationContext_security.xml
classpath*:conf/spring/applicationContext_modules*.xml
classpath*:conf/spring/applicationContext_cti*.xml
classpath*:conf/spring/applicationContext_apm*.xml
</param-value>
</context-param>
<1-- XML 文件的文件头二〉
<?xml version="l.O" encoding="工80-8859-1"?>
< 1-- web.xm1 文件的DTD 等信息一〉
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems. 工口c.//DTD Web Application 2.3//EN"
''http://java.sun.com/dtd/web-app_2_3.dtd''>
<web-app>
<!一确定多个配置文件>
<context-param>
<1-- 参数名为contextConfigLocation…〉
<param-name>contextConfigLocation</param-name>
<!一多个配置文件之间以,隔开二〉
<param-value>/WEB-工NF/daoContext.xml./WEB-INF/application
Context.xml</param-value>
</context-param>
<!-- 采用listener创建Applicat工onContext 实例-->
<listener>
<listener-class>org.spr工ngframework.web.context.ContextLoader
Listener</listener-class>
</listener>
</web-app>
<!-- XML 文件的文件头-->
<?xml version="1.0" encoding="工SO-8859-1"?>
<! -- web.xml 文件的DTD 等信息→
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems , 工口c.//DTD Web Application 2.3//EN"
''http://java.sun.com/dtd/web-app_2_3.dtd''>
<web-app>
<'一确定多个配置文件一>
<context-param>
<!-- 参数名为contextConfigLocation-->
<param-name>contextConfigLocation</param-name>
<!-- 多个配置文件之间以,隔开一〉
<param-value>/WEB-工NF/daoContext.xml, !WEB-工NF/applicationContext.
xml</param-value>
</context-param>
<!一采用load-on-startup Servlet 创建Applicat工onContext 实例一〉
<servlet>
<servlet-narne>context</servlet-narne>
<servlet-class>org.springframework.web.context.ContextLoader
Servlet</servlet-class>
<!一下面值小一点比较合适,会优先加载一〉
<load-on-startup>l</load-on-startup>
</servlet>
</web-app>
ApplicationContext act = new ClassPathXmlApplicationContext(new String[]{"bean1.xml","bean2.xml"});
BeanDefinitionRegistry reg = new DefaultListableBeanFactory();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(reg);
reader.loadBeanDefinitions(new ClassPathResource("bean1.xml"));
reader.loadBeanDefinitions(new ClassPathResource("bean2.xml"));
BeanFactory bf = (BeanFactory)reg;
===================================================================================================================
项目中碰到了tomgcat中可以启动,而部署到weblogic就无法启动的问题,报找不到applicationContext.xml 文件,报错为:
####<2013-2-27 下午03时29分04秒 CST> <Error> <HTTP> <wu-yw> <AdminServer> <[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1361950144661> <BEA-101216> <Servlet: "context" failed to preload on startup in Web application: "allmedia".
org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/applicationContext.xml]
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:180)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:148)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:126)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:142)
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:126)
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94)
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:89)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:269)
at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:134)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:246)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:184)
at org.springframework.web.context.ContextLoaderServlet.init(ContextLoaderServlet.java:83)
at javax.servlet.GenericServlet.init(GenericServlet.java:241)
at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:283)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(Unknown Source)
at weblogic.servlet.internal.StubSecurityHelper.createServlet(StubSecurityHelper.java:64)
at weblogic.servlet.internal.StubLifecycleHelper.createOneInstance(StubLifecycleHelper.java:58)
at weblogic.servlet.internal.StubLifecycleHelper.<init>(StubLifecycleHelper.java:48)
at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:521)
at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.java:1893)
at weblogic.servlet.internal.WebAppServletContext.loadServletsOnStartup(WebAppServletContext.java:1870)
at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1790)
at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:2999)
at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1371)
at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:468)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:204)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)
at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:60)
at weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:200)
at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:117)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:204)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)
at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:60)
at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:27)
at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:635)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)
at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:212)
at weblogic.application.internal.SingleModuleDeployment.activate(SingleModuleDeployment.java:16)
at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:162)
at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:79)
at weblogic.deploy.internal.targetserver.BasicDeployment.activate(BasicDeployment.java:184)
at weblogic.deploy.internal.targetserver.BasicDeployment.activateFromServerLifecycle(BasicDeployment.java:361)
at weblogic.management.deploy.internal.DeploymentAdapter$1.doActivate(DeploymentAdapter.java:51)
at weblogic.management.deploy.internal.DeploymentAdapter.activate(DeploymentAdapter.java:196)
at weblogic.management.deploy.internal.AppTransition$2.transitionApp(AppTransition.java:30)
at weblogic.management.deploy.internal.ConfiguredDeployments.transitionApps(ConfiguredDeployments.java:233)
at weblogic.management.deploy.internal.ConfiguredDeployments.activate(ConfiguredDeployments.java:169)
at weblogic.management.deploy.internal.ConfiguredDeployments.deploy(ConfiguredDeployments.java:123)
at weblogic.management.deploy.internal.DeploymentServerService.resume(DeploymentServerService.java:173)
at weblogic.management.deploy.internal.DeploymentServerService.start(DeploymentServerService.java:89)
at weblogic.t3.srvr.SubsystemRequest.run(SubsystemRequest.java:64)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/applicationContext.xml]
at org.springframework.web.context.support.ServletContextResource.getInputStream(ServletContextResource.java:99)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:167)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:148)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:126)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:142)
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:126)
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94)
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:89)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:269)
at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:134)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:246)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:184)
at org.springframework.web.context.ContextLoaderServlet.init(ContextLoaderServlet.java:83)
at javax.servlet.GenericServlet.init(GenericServlet.java:241)
at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:283)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(Unknown Source)
at weblogic.servlet.internal.StubSecurityHelper.createServlet(StubSecurityHelper.java:64)
at weblogic.servlet.internal.StubLifecycleHelper.createOneInstance(StubLifecycleHelper.java:58)
at weblogic.servlet.internal.StubLifecycleHelper.<init>(StubLifecycleHelper.java:48)
at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:521)
at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.java:1893)
at weblogic.servlet.internal.WebAppServletContext.loadServletsOnStartup(WebAppServletContext.java:1870)
at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1790)
at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:2999)
at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1371)
at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:468)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:204)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)
at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:60)
at weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:200)
at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:117)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:204)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)
at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:60)
at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:27)
at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:635)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:37)
at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:212)
at weblogic.application.internal.SingleModuleDeployment.activate(SingleModuleDeployment.java:16)
at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:162)
at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:79)
at weblogic.deploy.internal.targetserver.BasicDeployment.activate(BasicDeployment.java:184)
at weblogic.deploy.internal.targetserver.BasicDeployment.activateFromServerLifecycle(BasicDeployment.java:361)
at weblogic.management.deploy.internal.DeploymentAdapter$1.doActivate(DeploymentAdapter.java:51)
at weblogic.management.deploy.internal.DeploymentAdapter.activate(DeploymentAdapter.java:196)
at weblogic.management.deploy.internal.AppTransition$2.transitionApp(AppTransition.java:30)
at weblogic.management.deploy.internal.ConfiguredDeployments.transitionApps(ConfiguredDeployments.java:233)
at weblogic.management.deploy.internal.ConfiguredDeployments.activate(ConfiguredDeployments.java:169)
at weblogic.management.deploy.internal.ConfiguredDeployments.deploy(ConfiguredDeployments.java:123)
at weblogic.management.deploy.internal.DeploymentServerService.resume(DeploymentServerService.java:173)
at weblogic.management.deploy.internal.DeploymentServerService.start(DeploymentServerService.java:89)
at weblogic.t3.srvr.SubsystemRequest.run(SubsystemRequest.java:64)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
>
但是我的应用中并没有这个文件。
所以看了下上边的文章。
web.xml
<!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>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/e5-context.xml,
/WEB-INF/e5-controller.xml,
/WEB-INF/e5-web.xml,
/WEB-INF/e5-auth.xml,
/WEB-INF/e5-workspace.xml,
/WEB-INF/photoinfo-servlet.xml,
/WEB-INF/allmedia.xml,
/WEB-INF/allmedia-edit.xml
<!-- ,
/WEB-INF/e5-sso.xml -->
</param-value>
</context-param>
<filter>
<filter-name>SetCharacterEncoding</filter-name>
<filter-class>filters.SetCharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>SetCharacterEncoding</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!--ids config begin -->
<filter>
<filter-name>TRSIdSSSOFilter</filter-name>
<filter-class>com.trs.idm.client.filter.GeneralSSOFilter</filter-class>
</filter>
<!-- filter-mapping>
<filter-name>TRSIdSSSOFilter</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping-->
<filter-mapping>
<filter-name>TRSIdSSSOFilter</filter-name>
<url-pattern>/e5workspace/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>TRSIdSSSOFilter</filter-name>
<url-pattern>/publish/*</url-pattern>
</filter-mapping>
<!-- TRSIdS SSO Listener, use this for enable timeout-notify -->
<!-- filter>
<filter-name>FounderUUMSAuthFilter</filter-name>
<filter-class>com.founder.auth.web.AuthFilter</filter-class>
</filter-->
<!--
<filter-mapping>
<filter-name>FounderUUMSAuthFilter</filter-name>
<url-pattern>/e5workspace/auth.do</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>FounderUUMSAuthFilter</filter-name>
<url-pattern>/e5workspace/keeplive.do</url-pattern>
</filter-mapping> -->
<!-- e5sso -->
<!-- filter-mapping>
<filter-name>FounderUUMSAuthFilter</filter-name>
<url-pattern>/e5sys/sysAuth.do</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>FounderUUMSAuthFilter</filter-name>
<url-pattern>/e5permission/PermissionProxy.do</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>FounderUUMSAuthFilter</filter-name>
<url-pattern>/e5auth/AdminPermissionProxy.do</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>FounderUUMSAuthFilter</filter-name>
<url-pattern>/e5sys/AppChangeProxy.do</url-pattern>
</filter-mapping>
<listener>
<listener-class>com.founder.auth.web.LogoutSessionDestroyedListener</listener-class>
</listener-->
<!-- TRSIdS SSO Listener, use this for enable timeout-notify -->
<listener>
<listener-class>com.trs.idm.client.listener.CoSessionListener</listener-class>
</listener>
<!-- Use this for co-application's login form action. -->
<servlet>
<servlet-name>context</servlet-name>
<servlet-class>org.springframework.web.context.ContextLoaderServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>load</servlet-name>
<servlet-class>com.founder.e5.load.Load</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>e5-config.xml</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet>
<servlet-name>e5</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>3</load-on-startup>
</servlet>
<servlet>
<servlet-name>buffalo</servlet-name>
<servlet-class>net.buffalo.web.servlet.ApplicationServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>Jersey REST Service</servlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>com.sun.jersey.config.property.resourceConfigClass</param-name>
<param-value>com.sun.jersey.api.core.PackagesResourceConfig</param-value>
</init-param>
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>com.founder.api</param-value>
</init-param>
<load-on-startup>4</load-on-startup>
</servlet>
<!-- Use this for co-application's login form action. -->
<servlet>
<servlet-name>TRSIdSSSOProxyServlet</servlet-name>
<servlet-class>com.trs.idm.client.servlet.LoginProxyServlet</servlet-class>
<load-on-startup>100</load-on-startup>
</servlet>
<servlet>
<servlet-name>GetLongUrlServlet</servlet-name>
<servlet-class>com.trs.idm.client.servlet.GetLongUrlServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Jersey REST Service</servlet-name>
<url-pattern>/api/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>e5</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>buffalo</servlet-name>
<url-pattern>/buffalo/*</url-pattern>
</servlet-mapping>
<mime-mapping>
<extension>xml</extension>
<mime-type>text/xml</mime-type>
</mime-mapping>
<servlet-mapping>
<servlet-name>TRSIdSSSOProxyServlet</servlet-name>
<url-pattern>/TRSIdSSSOProxyServlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>GetLongUrlServlet</servlet-name>
<url-pattern>/idsAgents/GetLongUrlServlet</url-pattern>
</servlet-mapping>
<!-- ids config end -->
<welcome-file-list>
<welcome-file>login.jsp</welcome-file>
</welcome-file-list>
<taglib>
<taglib-uri>http://jakarta.apache.org/taglibs/i18n-1.0</taglib-uri>
<taglib-location>/WEB-INF/taglibs-i18n.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://java.sun.com/jstl/core</taglib-uri>
<taglib-location>/WEB-INF/c.tld</taglib-location>
</taglib>
<resource-ref>
<description>allmedia Datasource</description>
<res-ref-name>jdbc/E5NEW</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<!--
<resource-ref>
<description>sso Datasource</description>
<res-ref-name>jdbc/E5SSO</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>-->
</web-app>
<param-value>
/WEB-INF/e5-context.xml,
/WEB-INF/e5-controller.xml,
/WEB-INF/e5-web.xml,
/WEB-INF/e5-auth.xml,
/WEB-INF/e5-workspace.xml,
/WEB-INF/photoinfo-servlet.xml,
/WEB-INF/allmedia.xml,
/WEB-INF/allmedia-edit.xml
<!-- ,
/WEB-INF/e5-sso.xml -->
</param-value>
中注释的原因,很诡异,去掉就可以启动了。