- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试从服务类中保存表单详细信息。我正在用 remoteForm 尝试这个,但我无法从我的 Controller 转到服务。当我这样做时,会发生以下错误。
.....Error
|
java.lang.NullPointerException
Error |
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130)
Error |
at org.codehaus.groovy.grails.orm.support.GrailsTransactionTemplate.execute(GrailsTransactionTemplate.groovy:85)
Error |
at com.standout.utilityapplication.DataEntrySevice$$EPutsrXF.saveDataentryDetails(DataEntrySevice.groovy)
Error |
at com.standout.utilityapplication.DataEntrySevice$$DPutsrXF.__execute(Unknown Source)
Error |
at com.standout.utilityapplication.DataEntrySevice.__execute(DataEntrySevice.groovy)
Error |
at com.standout.utilityapplication.DataEntrySevice$saveDataentryDetails.call(Unknown Source)
Error |
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
Error |
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
Error |
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
Error |
at com.standout.utilityapplication.DataEntryController$$EPutsrXF.saveAjax(DataEntryController.groovy:21)
Error |
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Error |
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
Error |
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
Error |
at java.lang.reflect.Method.invoke(Method.java:606)
Error |
at org.springsource.loaded.ri.ReloadedTypeInvoker$2.invoke(ReloadedTypeInvoker.java:122)
Error |
at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1299)
Error |
at org.codehaus.groovy.grails.web.servlet.mvc.MixedGrailsControllerHelper.invoke(MixedGrailsControllerHelper.java:154)
Error |
at org.codehaus.groovy.grails.web.servlet.mvc.AbstractGrailsControllerHelper.handleAction(AbstractGrailsControllerHelper.java:375)
Error |
at org.codehaus.groovy.grails.web.servlet.mvc.AbstractGrailsControllerHelper.executeAction(AbstractGrailsControllerHelper.java:252)
Error |
at org.codehaus.groovy.grails.web.servlet.mvc.AbstractGrailsControllerHelper.handleURI(AbstractGrailsControllerHelper.java:205)
Error |
at org.codehaus.groovy.grails.web.servlet.mvc.AbstractGrailsControllerHelper.handleURI(AbstractGrailsControllerHelper.java:126)
Error |
at org.codehaus.groovy.grails.web.servlet.mvc.SimpleGrailsController.handleRequest(SimpleGrailsController.java:72)
Error |
at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:50)
Error |
at org.codehaus.groovy.grails.web.servlet.GrailsDispatcherServlet.doDispatch(GrailsDispatcherServlet.java:347)
Error |
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:870)
Error |
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)
Error |
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:863)
Error |
at javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
Error |
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)
Error |
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
Error |
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
Error |
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
Error |
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
Error |
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
Error |
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
Error |
at grails.plugin.cache.web.filter.PageFragmentCachingFilter.doFilter(PageFragmentCachingFilter.java:198)
Error |
at grails.plugin.cache.web.filter.AbstractFilter.doFilter(AbstractFilter.java:63)
Error |
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)
Error |
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)
Error |
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
Error |
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
Error |
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:101)
Error |
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
Error |
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
Error |
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:101)
Error |
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
Error |
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
Error |
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:101)
Error |
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
Error |
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
Error |
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:748)
Error |
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:486)
Error |
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:411)
Error |
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:338)
Error |
at org.codehaus.groovy.grails.web.mapping.UrlMappingUtils.forwardRequestForUrlMappingInfo(UrlMappingUtils.java:178)
Error |
at org.codehaus.groovy.grails.web.mapping.UrlMappingUtils.forwardRequestForUrlMappingInfo(UrlMappingUtils.java:144)
Error |
at org.codehaus.groovy.grails.web.mapping.UrlMappingUtils.forwardRequestForUrlMappingInfo(UrlMappingUtils.java:135)
Error |
at org.codehaus.groovy.grails.web.mapping.filter.UrlMappingsFilter.doFilterInternal(UrlMappingsFilter.java:216)
Error |
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
Error |
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
Error |
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
Error |
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
Error |
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)
Error |
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)
Error |
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
Error |
at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
Error |
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
Error |
at grails.plugin.springsecurity.web.filter.GrailsAnonymousAuthenticationFilter.doFilter(GrailsAnonymousAuthenticationFilter.java:53)
Error |
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
Error |
at org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:146)
Error |
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
Error |
at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:154)
Error |
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
Error |
at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:199)
Error |
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
Error |
at grails.plugin.springsecurity.web.authentication.logout.MutableLogoutFilter.doFilter(MutableLogoutFilter.java:62)
Error |
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
Error |
at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
Error |
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
Error |
at grails.plugin.springsecurity.web.SecurityRequestHolderFilter.doFilter(SecurityRequestHolderFilter.java:59)
Error |
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
Error |
at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)
Error |
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
Error |
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)
Error |
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)
Error |
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
Error |
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
Error |
at org.codehaus.groovy.grails.web.servlet.mvc.GrailsWebRequestFilter.doFilterInternal(GrailsWebRequestFilter.java:69)
Error |
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
Error |
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
Error |
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
Error |
at org.codehaus.groovy.grails.web.filters.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:67)
Error |
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
Error |
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
Error |
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
Error |
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
Error |
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
Error |
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)
Error |
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)
Error |
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
Error |
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
Error |
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
Error |
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
Error |
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
Error |
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
Error |
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
Error |
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
Error |
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
Error |
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
Error |
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314)
Error |
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
Error |
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
Error |
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
Error |
at java.lang.Thread.run(Thread.java:745)
2016-08-25 19:56:55,051 [http-bio-8080-exec-6] INFO org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/utilityapplication] - GroovyPagesServlet: "/WEB-INF/grails-app/views/dataEntry/saveAjax.gsp" not found
<%@ page contentType="text/html;charset=UTF-8" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<meta name="layout" content="main"/>
<title>Data Entry</title>
</head>
<body>
<div id="saveMsgDiv"></div>
<g:formRemote name="dataEntryForm" update="saveMsgDiv" url="[controller: 'DataEntry', action:'saveAjax']">
<table align="center">
<tr>
<td>
<label for='employeeId'>EmployeeID:</label>
</td>
<td>
<g:textField name='employee_id' required id='employee_id'/>
</td>
</tr>
<tr>
<td>
<label for='team'>Team:</label>
</td>
<td>
<g:select name='team' required id='team' from="${['Java', 'QA', 'Database']}"
noSelection="['':'---select---']"/>
</td>
</tr>
<tr>
<td>
<label for='receiptDate'>Receipt Date:</label>
</td>
<td>
<g:textField name='receipt_dt' required id='receipt_dt'/>
</td>
</tr>
<tr>
<td>
<label for='restaurantName'>Restaurant Name:</label>
</td>
<td>
<g:textField name='restaurant_name' required id='restaurant_name'/>
</td>
</tr>
<tr>
<td>
<label for='numberOfPersons'>Number of Persons:</label>
</td>
<td>
<g:textField name='number_of_persons' required id='number_of_persons' maxlength="3"/>
</td>
</tr>
<tr>
<td>
<label for='amount'>Amount:</label>
</td>
<td>
<g:textField name='amount' required id='amount'/>
</td>
</tr>
<tr>
<td>
<label for='billSubmittedDate'>Bill Submitted Date:</label>
</td>
<td>
<g:textField name='bill_submitted_dt' required id='bill_submitted_dt'/>
</td>
</tr>
<tr>
<td>
<label for='reImbursed'>Reimbursed:</label>
</td>
<td>
<g:textField name='reimbursed' required id='reimbursed'/>
</td>
</tr>
<tr>
<td>
<label for='submitBank'>Submitted to Bank:</label>
</td>
<td>
<g:textField name='presented_bank_fl' required id='presented_bank_fl'/>
</td>
</tr>
<tr>
<td>
<label for='dateOfSubmission'>Date of Bank Submission:</label>
</td>
<td>
<g:textField name='presented_bank_dt' required id='presented_bank_dt'/>
</td>
</tr>
<tr>
<td colspan="2" style="text-align:center;">
<g:submitButton name="Submit" style="cursor:pointer"/>
</td>
</tr>
</table>
</g:formRemote>
</body>
</html>
package com.standout.utilityapplication
import grails.plugin.springsecurity.annotation.Secured
import groovy.sql.Sql
@Secured(['ROLE_DATAENTRY'])
class DataEntryController {
def dataSource
def index() { }
def dataentry(){
println("Inside DataEntryController")
}
def saveAjax(){
def result
try{
DataEntrySevice service = new DataEntrySevice()
service.saveDataentryDetails(params)
}
catch(Exception e){
e.printStackTrace();
}
}
}
package com.standout.utilityapplication
import grails.transaction.Transactional
import groovy.sql.Sql
@Transactional
class DataEntrySevice {
def dataSource
def int saveDataentryDetails(Map params) {
def result
try{
Dataentry d = new Dataentry();
d.amount = params.amount
d.bill_submitted_dt = params.bill_submitted_dt
d.employee_id = params.employee_id
d.number_of_persons = params.number_of_persons
d.presented_bank_dt = params.presented_bank_dt
d.presented_bank_fl = params.presented_bank_fl
d.receipt_dt = params.receipt_dt
d.reimbursed = params.reimbursed
d.restaurant_name = params.restaurant_name
d.team = params.team
d.save();
}
catch(Exception e){
e.printStackTrace();
}
catch(Exception e){
println(e)
}
return result
}
}
最佳答案
您没有正确注入(inject)服务。你必须以这种方式注入(inject)它
@Secured(['ROLE_DATAENTRY'])
class DataEntryController {
def dataSource
DataEntrySevice service
def index() { }
def dataentry(){
println("Inside DataEntryController")
}
def saveAjax(){
def result
try{
service.saveDataentryDetails(params)
}
catch(Exception e){
e.printStackTrace();
}
}
}
关于grails - 无法从 Grails 中的服务执行保存操作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39148386/
Closed. This question does not meet Stack Overflow guidelines。它当前不接受答案。 想改善这个问题吗?更新问题,以便将其作为on-topic
我们正在尝试使用 https://grails.org/plugin/jms用于 jms 集成。但我们无法解决它。 环顾四周,我能够验证它是否存在于这个 repo 中: http://repo.gra
我有许多集成测试在grails 3中失败(而在grails 2中通过),因为它无法解析导入: grails.test.MockUtils grails.test.Grails模拟 我找不到有关应如何迁
有没有办法在 Grails 站点上发生 Grails 错误时向自己发送详细信息? 设置它的最佳方法是什么?在一个地方? (试图保持干燥) 我想包括产生错误的 URL。 最佳答案 . 如果您打算捕获项目
我有一个 grails 应用程序,其中包含一些被序列化为 JSON 的域对象。在另一个 java/groovy 项目中,我想使用这些域对象。如果我发布一个插件,看起来只有其他 grails 应用程序可
我正在尝试为 Grails 编写一个插件,该插件将根据我们在遗留数据库中设计的特殊 View 自动生成我的域类。我基本上只是想节省一些时间手动编写使域类工作所需的所有映射内容。 我是否可以从自定义 A
我正在尝试编写一个可以在多个 Grails 应用程序中重用的插件。该插件基本上应该是 spring security core 的包装器和 ldap 插件。 这意味着它应该包含: 用户/角色的域类 S
我有一个应用程序,我在其中使用 Spring Security 和 grails 旋律。我计划在生产环境中运行 grails melody,但不希望访问者访问它。我应该如何做到这一点?我尝试在 gra
我只是继承了一个现有的应用程序,而我注意到的第一件事是我必须在每个“grails run-app”之前进行“grails clean”操作,否则会出错。创建该项目的人说,他们还有其他几个具有类似设置的
我有一个自定义 toString我的枚举中的方法: enum TaxRate implements Serializable { RATE23(23.0), ... priva
我正在创建一个 Grails 插件作为复杂产品的包装器。该产品对其他产品(如 hibernate)有很多依赖性。问题是,grails 有一些相同的依赖项,但版本不同。 例如。 Grails -> 休眠
当我掉进 grails 服务的兔子洞时,我目前正在将业务逻辑从 Controller 方法转移到服务。我的服务中有以下方法: Job closeJobOpportunity(Job op, Emplo
我只收到默认验证器消息。我究竟做错了什么? class Questao { static hasMany = [alternativas:Alternativa] static constraints
Closed. This question needs to be more focused 。它目前不接受答案。 想改善这个问题吗?更新问题,使其仅通过 editing this post 关注一个
特定版本的 Grails 支持多长时间?一般的 VMWare 支持策略似乎是支持当前版本和一个版本。我无法找到任何关于支持多长时间版本的 Grails 特定信息,通用 VMWare 策略是否适用? 最
我有一个通过 grails 交互模式运行的 grails 应用程序。此应用程序包含服务、tagLibs、gsps 等,但最重要的是它包含 src/groovy 文件夹中的 groovy 文件。 这些
LinkedIn 的人们一直在以一种有趣的方式使用 Play 来处理需要由许多不同组件组成的页面:http://engineering.linkedin.com/play/composable-and
我在 Grails 应用程序中使用 Servlet 3.0 异步渲染。我收到以下错误。 | Error 2014-04-29 11:10:24,125 [Actor Thread 28] ERROR
我看了Controller.groovy源代码,看起来 CRUD 操作不是事务性的(至少是明确的)。 如果我是对的,这是否意味着不应该在生产中按原样使用动态脚手架?有没有办法使它具有事务性(即我可以修
我如何基本上对字符串数据类型字段执行唯一约束。 class User{ String username String Email static hasMany = [roles:Roles
我是一名优秀的程序员,十分优秀!