Grails - Websphere - 没有名为“springSecurityFilterChain'被定义为

时间:2014-11-18 18:57:10

标签: grails spring-security

我的Grails应用程序已启动并在我的localhost中运行。但是,当我尝试在Websphere上部署它时,我收到以下错误。

错误消息:javax.servlet.ServletException:Filter [springSecurityFilterChain]:无法初始化 错误代码:500 目标Servlet:com.ibm.ws.webcontainer.extension.DefaultExtensionProcessor 错误堆栈: org.springframework.beans.factory.NoSuchBeanDefinitionException:没有定义名为'springSecurityFilterChain'的bean      at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:570)      在org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1114)      在org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:279)      在org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:198)      在org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1121)      在org.springframework.web.filter.DelegatingFilterProxy.initDelegate(DelegatingFilterProxy.java:323)      在org.springframework.web.filter.DelegatingFilterProxy.initFilterBean(DelegatingFilterProxy.java:235)      在org.springframework.web.filter.GenericFilterBean.init(GenericFilterBean.java:194)      在com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.init(FilterInstanceWrapper.java:145)      在com.ibm.ws.webcontainer.filter.WebAppFilterManager._loadFilter(WebAppFilterManager.java:600)      在com.ibm.ws.webcontainer.filter.WebAppFilterManager.loadFilter(WebAppFilterManager.java:507)      在com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterInstanceWrapper(WebAppFilterManager.java:312)      在com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterChain(WebAppFilterManager.java:385)      在com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:924)      在com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1064)      在com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3763)      在com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:304)      在com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:976)      在com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1662)      在com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:200)      在com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:453)      在com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:515)      在com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:306)      在com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:277)      at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)      在com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)      在com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:175)      在com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)      at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)      在com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)      在com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)      在com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)      在com.ibm.io.async.ResultHandler $ 2.run(ResultHandler.java:905)      在com.ibm.ws.util.ThreadPool $ Worker.run(ThreadPool.java:1700)

这是我的Web.xml,

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

<display-name>/@grails.project.key@</display-name>

<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>

<context-param>
    <param-name>webAppRootKey</param-name>
    <param-value>@grails.project.key@</param-value>
</context-param>

<filter>
    <filter-name>sitemesh</filter-name>
    <filter-class>org.codehaus.groovy.grails.web.sitemesh.GrailsPageFilter</filter-class>
</filter>

<filter>
    <filter-name>charEncodingFilter</filter-name>
    <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
    <init-param>
        <param-name>targetBeanName</param-name>
        <param-value>characterEncodingFilter</param-value>
    </init-param>
    <init-param>
        <param-name>targetFilterLifecycle</param-name>
        <param-value>true</param-value>
    </init-param>
</filter>

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

<filter-mapping>
    <filter-name>sitemesh</filter-name>
    <url-pattern>/*</url-pattern>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>ERROR</dispatcher>

</filter-mapping>

<listener>
    <listener-class>org.codehaus.groovy.grails.web.context.GrailsContextLoaderListener</listener-class>
</listener>

<!-- Grails dispatcher servlet -->
<servlet>
    <servlet-name>grails</servlet-name>
    <servlet-class>org.codehaus.groovy.grails.web.servlet.GrailsDispatcherServlet</servlet-class>
    <init-param>
        <param-name>dispatchOptionsRequest</param-name>
        <param-value>true</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
    <async-supported>true</async-supported>
</servlet>

<!-- The Groovy Server Pages servlet -->
<servlet>
    <servlet-name>gsp</servlet-name>
    <servlet-class>org.codehaus.groovy.grails.web.pages.GroovyPagesServlet</servlet-class>
</servlet>

<servlet-mapping>
    <servlet-name>gsp</servlet-name>
    <url-pattern>*.gsp</url-pattern>
</servlet-mapping>

<session-config>
    <!-- 30 minutes -->
    <session-timeout>30</session-timeout>
</session-config>

<welcome-file-list>
    <!--
    The order of the welcome pages is important.  JBoss deployment will
    break if index.gsp is first in the list.
    -->
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>index.gsp</welcome-file>
</welcome-file-list>

我曾尝试查看之前发布的各种解决方案,但我无法完成这项工作。另外,我不确定Grails项目结构中其他.xml文件的位置。

1 个答案:

答案 0 :(得分:0)

你在Grails应用程序中找不到很多xml文件,几乎只是web.xml(这在Grails 3中已经消失,因为servlet 3.0允许你以编程方式完成所有工作),web-app/WEB-INF/applicationContext.xmlweb-app/WEB-INF/sitemesh.xml。安装的插件也有plugin.xml个文件。大多数都配置了代码。

您不会说自己是否正在使用spring-security-core plugin或自行连接,但它看起来并不像您正在做任何一个。如果你使用的是插件,它会将自己添加到web.xml中,如果你自己做的话,你就可以了。这不受在WebSphere或适当服务器中运行的影响,因为在构建war文件时会生成web.xml,因此虽然WebSphere可能会引入更多的怪异,但这次并不是坏人。 / p>

尝试在重建和重新部署之前运行grails cleangrails compile

它是否可能是您的构建过程?你刚刚与grails war建立战争吗?