插件安装后Grails Apache中断了吗?

时间:2013-03-08 11:44:10

标签: apache grails plugins spring-security tomcat7

我目前正在开发一个Grails项目,我已经安装了下面的插件:

Spring Security Core

Spring Security UI

邮件

ETC ...

解决方案工作正常,直到我决定更改“Spring Security UI”并使用另一个名为“Mandrill”的邮件插件。所以我更改了插件中的RegisterController以使用Mandrill而不是Mail,我添加到控制器的代码如下:

import org.grails.mandrill.MandrillRecipient;
import org.grails.mandrill.MandrillMessage;
import org.grails.mandrill.MandrillService;

def recpts = []

        recpts.add(new MandrillRecipient(name:command.username, email:command.email))
        def message = new MandrillMessage(
                                            text:body.toString(),
                                            subject:conf.ui.register.emailSubject,
                                            from_email:conf.ui.register.emailFrom,
                                            to:recpts)
        message.tags.add("Test")
        def ret = mandrillService.send(message)

现在,一旦我安装插件并添加此代码并运行应用程序一切正常,我没有收到任何错误,它告诉我去localhost,一旦我这样做,Apache就会崩溃,我得到以下错误:

HTTP Status 500 -

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.codehaus.groovy.grails.web.pages.exceptions.GroovyPagesException: Error applying layout : main
    java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
    java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    java.lang.Thread.run(Thread.java:679)

root cause

org.codehaus.groovy.grails.web.pages.exceptions.GroovyPagesException: Error processing GroovyPageView: Error executing tag <sec:ifAnyGranted>: null
    java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
    java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    java.lang.Thread.run(Thread.java:679)

root cause

org.codehaus.groovy.grails.web.taglib.exceptions.GrailsTagException: Error executing tag <sec:ifAnyGranted>: null
    home_workspace_sm_V3_grails_app_views_layouts_main_gsp$_run_closure2.doCall(main.gsp:85)
    home_workspace_sm_V3_grails_app_views_layouts_main_gsp.run(main.gsp:122)
    java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
    java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    java.lang.Thread.run(Thread.java:679)

root cause

java.lang.NullPointerException
    grails.plugins.springsecurity.SecurityTagLib$_closure3.doCall(SecurityTagLib.groovy:89)
    home_workspace_smV3_grails_app_views_layouts_main_gsp$_run_closure2.doCall(main.gsp:85)
    home_workspace_sm_V3_grails_app_views_layouts_main_gsp.run(main.gsp:122)
    java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
    java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    java.lang.Thread.run(Thread.java:679)

note The full stack trace of the root cause is available in the Apache Tomcat/7.0.27 logs.

有人可以帮我解决这个问题,因为即使他们不使用Mandrill,我的所有项目都不再有效:S

编辑...

下面是我的main.gsp页面,但是我没有看到这与该问题有什么关系,因为我的所有项目都没有运行,即使它们在我安装该插件之前也没有运行:S

<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport"       content="width=device-width, initial-scale=1.0">
    <meta name="description"    content="">
    <meta name="author"         content="">

    <title>SM</title>
    <link rel="shortcut icon" href="${resource(dir:'images',file:'favicon.png')}" type="image/x-icon" />

    <link rel="stylesheet" href="${resource(dir:'bootstrap/css', file:'bootstrap.css')}" />
    <link rel="stylesheet" href="${resource(dir:'bootstrap/css', file:'bootstrap-responsive.css')}" />
    <link rel="stylesheet" href="${resource(dir:'kickstart/css', file:'docs.css')}" />
    <link rel="stylesheet" href="${resource(dir:'kickstart/css', file:'kickstart.css')}" />
    <link rel="stylesheet" href="${resource(dir:'datepicker/css',file:'datepicker.css')}" />

    <link rel="apple-touch-icon" href="assets/ico/apple-touch-icon.png">
    <link rel="apple-touch-icon" sizes="72x72" href="assets/ico/apple-touch-icon-72x72.png">
    <link rel="apple-touch-icon" sizes="114x114" href="assets/ico/apple-touch-icon-114x114.png">

    <g:layoutHead />

    <!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
    <!--[if lt IE 9]>
      <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
    <script src="${resource(dir:'bootstrap/js', file:'bootstrap.js')}"></script>
    <script src="${resource(dir:'datepicker/js',file:'bootstrap-datepicker.js')}"></script>
    <script src="${resource(dir:'kickstart/js', file:'kickstart.js')}"></script>
    <script src="${resource(dir:'js',           file:'application.js')}"></script>

    <r:layoutResources />
</head>

<body>
    <div id="Navbar" class="navbar navbar-fixed-top">
        <div class="navbar-inner">
            <div class="container">
                <!-- .btn-navbar is used as the toggle for collapsed navbar content -->
                <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </a>

                <a class="brand" href="${createLink(uri: '/')}">
                    <img class="logo" src="${resource(dir:'images',file:'sm_logo.png')}" alt="${meta(name:'app.name')}" height="25" border="0" />
                    SM
                    <%-- <small> v${meta(name:'app.version')}</small> --%>
                </a>

                <div class="nav-collapse">
                    <ul class="nav">
                        <li class="dropdown">
                            <a class="dropdown-toggle" data-toggle="dropdown" href="#">Menu <b class="caret"></b></a>
                            <ul class="dropdown-menu">
                                <li><a class="home" href="${createLink(uri: '/')}"><g:message code="default.home.label"/></a></li>
                                <sec:ifNotLoggedIn>
                                <li><g:link class="login" controller="Login" action="auth"><g:message code="Login" args="[entityName]" /></g:link></li>
                                <li><a href="${createLink(uri: '/register/index')}"><g:message code="Register"/></a></li>
                                </sec:ifNotLoggedIn>
                                <sec:ifLoggedIn>
                                    <li><g:link class="logout" controller="Logout" action="index"><g:message code="Logout" args="[entityName]" /></g:link></li>
                                    <li><g:link class="create" controller="Sm" action="create"><g:message code="Create" args="[entityName]" /></g:link></li>
                                    <sec:ifAnyGranted roles="ROLE_ADMIN,ROLE_SUPER_ADMIN">
                                        <li><g:link class="list" controller="Sm" action="list"><g:message code="SM Log" args="[entityName]" /></g:link></li>
                                    </sec:ifAnyGranted>
                                </sec:ifLoggedIn>
                            </ul>
                        </li>
                    </ul>

                    <sec:ifAnyGranted roles="ROLE_ADMIN,ROLE_SUPER_ADMIN">
                    <ul class="nav">
                        <li class="dropdown">
                            <a class="dropdown-toggle" data-toggle="dropdown" href="#">Admin Menu <b class="caret"></b></a>
                            <ul class="dropdown-menu">
                                <sec:ifAnyGranted roles="ROLE_SUPER_ADMIN">
                                <li><a class="config" href="${createLink(uri: '/configProperty')}"><g:message code="Config"/></a></li>
                                </sec:ifAnyGranted>
                                <li><a class="config" href="${createLink(uri: '/User')}"><g:message code="Admin"/></a></li>
                            </ul>
                        </li>
                    </ul>
                    </sec:ifAnyGranted>

                    <div class="pull-right">
                        <!--<g:render template="/menu/language"/> -->                                                                                                           
                    </div>

                </div>

            </div>
        </div>
    </div>

    <g:if test="${ pageProperty(name:'page.header') }">
        <g:pageProperty name="page.header" />
    </g:if>
    <g:else>
        <header id="Header" class="jumbotron masthead">
            <div class="inner">
                <div class="container">
                    <h1 class="title"><g:layoutTitle default="${meta(name:'app.name')}" /></h1>
                </div>
            </div>
        </header>
    </g:else>

    <div id="Content" class="container">
        <%-- Only show the "Pills" navigation menu if a controller exists (but not for home) 
        <g:if test="${  params.controller != null
                    &&  params.controller != ''
                    &&  params.controller != 'home'
        }">
            <ul id="Menu" class="nav nav-pills">
                <g:set var="entityName" value="${message(code: params.controller+'.label', default: params.controller.substring(0,1).toUpperCase() + params.controller.substring(1).toLowerCase())}" />
                <%-- Set which "pill" of the menu is active
                <li class="${ params.action == "list" ? 'active' : '' }">
                    <g:link action="list"><g:message code="default.list.label" args="[entityName]"/></g:link>
                </li>
                <li class="${ params.action == "create" ? 'active' : '' }">
                    <g:link action="create"><g:message code="default.new.label"  args="[entityName]"/></g:link>
                </li>
            </ul>
        </g:if> --%>

        <g:if test="${flash.message}">
            <div class="alert alert-info"><g:message code="${flash.message}" args="${flash.args}"
           default="${flash.default}"/></div>
        </g:if>

        <g:layoutBody />
        <g:pageProperty name="page.body" />
    </div>

    <g:if test="${ pageProperty(name:'page.footer') }">
        <g:pageProperty name="page.footer" />
    </g:if>
    <g:else>
        <footer id="Footer">
        </footer>
    </g:else>

    <r:layoutResources />
</body>

</html>

1 个答案:

答案 0 :(得分:1)

我刚刚遇到了同样的问题 - 几乎相同的堆栈跟踪。无论是grails还是grails都没有编译--refresh-dependencies也可以。

经过几个小时的努力,我终于采取了删除.grails缓存文件夹的步骤。在重新启动时,我执行了刷新依赖项&amp;干净。

这似乎已经成功了。