我有一个grails应用程序,如果我通过
启动它,它运行正常grails run-app
在早期阶段,我已经将该应用程序部署到节点上的tomcat实例,并且没有遇到任何问题。然而,昨天我开始准备生产一切,并设置一个流浪盒来部署整个堆栈。突然发生了一件非常奇怪的事情:
我有一个方法
def checkEmail(String email)
在我的RegisterController中,它调用静态方法
static String normalize(final String email) throws InvalidEmailAddressException
在一个groovy类中,它位于项目中相应包中的'/ src / groovy'下。
每当调用控制器中的checkEmail方法时,我都会看到以下异常:
2014-04-07 20:19:20,588 [http-bio-8080-exec-6] ERROR errors.GrailsExceptionResolver - IllegalAccessError occurred when processing request: [GET] /register/checkEmail
tried to access class com.getgrape.core.exception.InvalidEmailAddressException from class com.getgrape.authority.RegisterController. Stacktrace follows:
org.codehaus.groovy.grails.web.servlet.mvc.exceptions.ControllerExecutionException: Executing action [checkEmail] of controller [com.getgrape.authority.RegisterController] caused exception: Runtime error executing action
at grails.plugin.springsecurity.web.filter.GrailsAnonymousAuthenticationFilter.doFilter(GrailsAnonymousAuthenticationFilter.java:53)
at grails.plugin.springsecurity.web.authentication.RequestHolderAuthenticationFilter.doFilter(RequestHolderAuthenticationFilter.java:49)
at grails.plugin.springsecurity.web.authentication.logout.MutableLogoutFilter.doFilter(MutableLogoutFilter.java:82)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: org.codehaus.groovy.grails.web.servlet.mvc.exceptions.ControllerExecutionException: Runtime error executing action
... 6 more
Caused by: java.lang.reflect.InvocationTargetException
... 6 more
Caused by: java.lang.IllegalAccessError: tried to access class com.getgrape.core.exception.InvalidEmailAddressException from class com.getgrape.authority.RegisterController
at com.getgrape.authority.RegisterController.checkEmail(RegisterController.groovy:128)
... 6 more
InvalidEmailAddressException如下所示,并放在项目中相应包中的'/ src / java'下:
package com.getgrape.core.exception;
class InvalidEmailAddressException extends Exception {
private static final long serialVersionUID = 1L;
InvalidEmailAddressException() {
super();
}
InvalidEmailAddressException(String message) {
super(message);
}
}
我基本上不知道发生了什么。
有没有人知道可能会发生什么?
java version is: oracle jdk 1.7.0_51
grails: 2.3.7
running on ubuntu 12.04
战争是通过“战争战争”建立起来的,在战争开始之前,我一直在运行“grails clean-all”。
答案 0 :(得分:7)
如果没有public
修饰符,则该方法仅适用于包的类。见http://docs.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html。这适用于非公开的异常类。如果您想要全局访问,构造函数和方法也应该是公共的。