没有为类型' tile'定义结果类型。映射名称' sessionTimeout'

时间:2017-07-19 11:40:32

标签: struts2

我正在将Struts1迁移到Struts2 Web项目。 Struts2项目将使用spring,tiles2和bootstrap。现在它有以下问题。我正在使用jdk 1.7的struts2-core-2.5.1。我尝试了很多瓷砖版本2/3与其他jar版本或缺席的组合,并在谷歌搜索。最后它仍然有以下异常并运行程序。如果您需要我提供更多信息,请通知我。

 ERROR org.apache.struts2.dispatcher.Dispatcher - Dispatcher initialization failed
com.opensymphony.xwork2.config.ConfigurationException: Unable to load configuration.
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:70) ~[struts2-core-2.5.1.jar:2.5.1]
    at org.apache.struts2.dispatcher.Dispatcher.getContainer(Dispatcher.java:897) ~[struts2-core-2.5.1.jar:2.5.1]
    at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:437) ~[struts2-core-2.5.1.jar:2.5.1]
    at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:478) [struts2-core-2.5.1.jar:2.5.1]
    at org.apache.struts2.dispatcher.InitOperations.initDispatcher(InitOperations.java:75) [struts2-core-2.5.1.jar:2.5.1]
    at org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:63) [struts2-core-2.5.1.jar:2.5.1]
    at weblogic.servlet.internal.FilterManager$FilterInitAction.run(FilterManager.java:374) [weblogic.server.merged.jar:12.1.3.0.0]
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321) [weblogic.server.merged.jar:12.1.3.0.0]
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120) [com.oracle.css.weblogic.security.wls_7.1.0.0.jar:CSS 7.1 0.0]
    at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:57) [weblogic.server.merged.jar:12.1.3.0.0]
    at weblogic.servlet.internal.FilterManager.initFilter(FilterManager.java:125) [weblogic.server.merged.jar:12.1.3.0.0]
    at weblogic.servlet.internal.FilterManager.loadFilter(FilterManager.java:88) [weblogic.server.merged.jar:12.1.3.0.0]
    at weblogic.servlet.internal.FilterManager.preloadFilters(FilterManager.java:68) [weblogic.server.merged.jar:12.1.3.0.0]
    at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1844) [weblogic.server.merged.jar:12.1.3.0.0]
    at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:2876) [weblogic.server.merged.jar:12.1.3.0.0]
    at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1661) [weblogic.server.merged.jar:12.1.3.0.0]
    at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:823) [weblogic.server.merged.jar:12.1.3.0.0]
    at weblogic.application.internal.ExtensibleModuleWrapper$StartStateChange.next(ExtensibleModuleWrapper.java:360) [weblogic.server.merged.jar:12.1.3.0.0]
    at weblogic.application.internal.ExtensibleModuleWrapper$StartStateChange.next(ExtensibleModuleWrapper.java:356) [weblogic.server.merged.jar:12.1.3.0.0]
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:42) [weblogic.server.merged.jar:12.1.3.0.0]
    at weblogic.application.internal.ExtensibleModuleWrapper.start(ExtensibleModuleWrapper.java:138) [weblogic.server.merged.jar:12.1.3.0.0]
    at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:124) [weblogic.server.merged.jar:12.1.3.0.0]
    at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:216) [weblogic.server.merged.jar:12.1.3.0.0]
    at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:211) [weblogic.server.merged.jar:12.1.3.0.0]
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:42) [weblogic.server.merged.jar:12.1.3.0.0]
    at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:73) [weblogic.server.merged.jar:12.1.3.0.0]
    at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:24) [weblogic.server.merged.jar:12.1.3.0.0]
    at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:729) [weblogic.server.merged.jar:12.1.3.0.0]
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:42) [weblogic.server.merged.jar:12.1.3.0.0]
    at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:258) [weblogic.server.merged.jar:12.1.3.0.0]
    at weblogic.application.internal.SingleModuleDeployment.activate(SingleModuleDeployment.java:48) [weblogic.server.merged.jar:12.1.3.0.0]
    at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:165) [weblogic.server.merged.jar:12.1.3.0.0]
    at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:80) [weblogic.server.merged.jar:12.1.3.0.0]
    at weblogic.deploy.internal.targetserver.BasicDeployment.activate(BasicDeployment.java:226) [weblogic.server.merged.jar:12.1.3.0.0]
    at weblogic.deploy.internal.targetserver.BasicDeployment.activateFromServerLifecycle(BasicDeployment.java:418) [weblogic.server.merged.jar:12.1.3.0.0]
    at weblogic.management.deploy.internal.DeploymentAdapter$1.doActivate(DeploymentAdapter.java:51) [weblogic.server.merged.jar:12.1.3.0.0]
    at weblogic.management.deploy.internal.DeploymentAdapter.activate(DeploymentAdapter.java:200) [weblogic.server.merged.jar:12.1.3.0.0]
    at weblogic.management.deploy.internal.AppTransition$2.transitionApp(AppTransition.java:30) [weblogic.server.merged.jar:12.1.3.0.0]
    at weblogic.management.deploy.internal.ConfiguredDeployments.transitionApps(ConfiguredDeployments.java:240) [weblogic.server.merged.jar:12.1.3.0.0]
    at weblogic.management.deploy.internal.ConfiguredDeployments.activate(ConfiguredDeployments.java:169) [weblogic.server.merged.jar:12.1.3.0.0]
    at weblogic.management.deploy.internal.ConfiguredDeployments.deploy(ConfiguredDeployments.java:123) [weblogic.server.merged.jar:12.1.3.0.0]
    at weblogic.management.deploy.internal.DeploymentServerService.resume(DeploymentServerService.java:210) [weblogic.server.merged.jar:12.1.3.0.0]
    at weblogic.management.deploy.internal.DeploymentServerService.start(DeploymentServerService.java:118) [weblogic.server.merged.jar:12.1.3.0.0]
    at weblogic.server.AbstractServerService.postConstruct(AbstractServerService.java:78) [weblogic.server.merged.jar:12.1.3.0.0]
    at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source) ~[?:?]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_112]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_112]
    at org.glassfish.hk2.utilities.reflection.ReflectionHelper.invoke(ReflectionHelper.java:1017) [weblogic.server.merged.jar:12.1.3.0.0]
    at org.jvnet.hk2.internal.ClazzCreator.postConstructMe(ClazzCreator.java:388) [weblogic.server.merged.jar:12.1.3.0.0]
    at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:430) [weblogic.server.merged.jar:12.1.3.0.0]
    at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:456) [weblogic.server.merged.jar:12.1.3.0.0]
    at org.glassfish.hk2.runlevel.internal.AsyncRunLevelContext.findOrCreate(AsyncRunLevelContext.java:225) [weblogic.server.merged.jar:12.1.3.0.0]
    at org.glassfish.hk2.runlevel.RunLevelContext.findOrCreate(RunLevelContext.java:82) [weblogic.server.merged.jar:12.1.3.0.0]
    at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2488) [weblogic.server.merged.jar:12.1.3.0.0]
    at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:98) [weblogic.server.merged.jar:12.1.3.0.0]
    at org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:606) [weblogic.server.merged.jar:12.1.3.0.0]
    at org.jvnet.hk2.internal.ThreeThirtyResolver.resolve(ThreeThirtyResolver.java:77) [weblogic.server.merged.jar:12.1.3.0.0]
    at org.jvnet.hk2.internal.ClazzCreator.resolve(ClazzCreator.java:231) [weblogic.server.merged.jar:12.1.3.0.0]
    at org.jvnet.hk2.internal.ClazzCreator.resolveAllDependencies(ClazzCreator.java:254) [weblogic.server.merged.jar:12.1.3.0.0]
    at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:413) [weblogic.server.merged.jar:12.1.3.0.0]
    at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:456) [weblogic.server.merged.jar:12.1.3.0.0]
    at org.glassfish.hk2.runlevel.internal.AsyncRunLevelContext.findOrCreate(AsyncRunLevelContext.java:225) [weblogic.server.merged.jar:12.1.3.0.0]
    at org.glassfish.hk2.runlevel.RunLevelContext.findOrCreate(RunLevelContext.java:82) [weblogic.server.merged.jar:12.1.3.0.0]
    at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2488) [weblogic.server.merged.jar:12.1.3.0.0]
    at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:98) [weblogic.server.merged.jar:12.1.3.0.0]
    at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:87) [weblogic.server.merged.jar:12.1.3.0.0]
    at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.oneJob(CurrentTaskFuture.java:1162) [weblogic.server.merged.jar:12.1.3.0.0]
    at org.glassfish.hk2.runlevel.internal.CurrentTaskFuture$QueueRunner.run(CurrentTaskFuture.java:1147) [weblogic.server.merged.jar:12.1.3.0.0]
    at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:548) [weblogic.server.merged.jar:12.1.3.0.0]
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:311) [weblogic.server.merged.jar:12.1.3.0.0]
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:263) [weblogic.server.merged.jar:12.1.3.0.0]
Caused by: com.opensymphony.xwork2.config.ConfigurationException: There is no result type defined for type 'tiles' mapped with name 'sessionTimeout'.  Did you mean 'tiles'?
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.buildResults(XmlConfigurationProvider.java:730) ~[struts2-core-2.5.1.jar:2.5.1]
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadGlobalResults(XmlConfigurationProvider.java:915) ~[struts2-core-2.5.1.jar:2.5.1]
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:545) ~[struts2-core-2.5.1.jar:2.5.1]
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(XmlConfigurationProvider.java:311) ~[struts2-core-2.5.1.jar:2.5.1]
    at org.apache.struts2.config.StrutsXmlConfigurationProvider.loadPackages(StrutsXmlConfigurationProvider.java:108) ~[struts2-core-2.5.1.jar:2.5.1]
    at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:187) ~[struts2-core-2.5.1.jar:2.5.1]
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:67) ~[struts2-core-2.5.1.jar:2.5.1]
    ... 70 more

配置:

 <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd">
    <struts>
    <package name="testAwip" extends="struts-default">

        <result-types>
          <result-type name="tiles" class="org.apache.struts2.views.tiles.TilesResult"/>
        </result-types>

        <action name="logon" class="logonAction">
            <result name="sessionTimeout"  type="tiles">.logon.LogonForm</result> 

的web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" metadata-complete="true" version="2.5">

<context-param>
       <param-name>
          tilesDefinitions
       </param-name>
       <param-value>
          /WEB-INF/tiles.xml
       </param-value>
</context-param>

<listener>
    <listener-class>org.apache.struts2.tiles.StrutsTilesListener</listener-class>
</listener>


<filter>
        <filter-name>struts2</filter-name>
        <filter-class>
            org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter
          </filter-class>
          <init-param>
                <param-name>CharacterEncoding</param-name>
                <param-value>UTF-8</param-value>
            </init-param>

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


      <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath:applicationContext.xml</param-value>
    </context-param>

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

0 个答案:

没有答案