I have a Grails 2.4.3 app that I developed using an in-memory database. I am able to create, update, and delete data with no problem. However once I switch the data source over to our Oracle database I can no longer persist to certain tables in the database. Some of the tables work, which tells me that it isn't a connection issue. Can anyone help me find the cause?
Originally a fellow programmer thought that the enums might be causing the problem. However I tried switching all the enum fields to String fields with an inList: Enum.values() constraint, and it resulted in the same error. I also tried 'version false' in the mapping, but neither that nor the default works.
Example of a domain class that persists without issue:
class UsfCustomer implements Comparable<UsfCustomer> {
/* -------------- *
* Fields *
* -------------- */
String name
String address
Location location
static constraints = {
name blank: false, unique: true
address nullable:true, blank: true
location nullable:true, blank: true
}
/* -------------- *
* Methods *
* -------------- */
int compareTo(UsfCustomer other) {
return name <=> other.name
}
}
Example of a domain class that doesn't persist:
class Invoice implements Comparable<Invoice> {
String invoiceCode
Vendor vendor
Location location
InvoiceType invoiceType // DI or CR
Date invoiceDate
Date goodsReceived
Date paperworkReceived
Date dueDate
Boolean applyDiscount
String invoiceComment
Boolean fromFile
Long batchId
Date interfaceDate
static hasMany = [invoiceAccounting : InvoiceAccounting]
static mapping = {
version false
invoiceCode comment: "Identifier for the invoice."
vendor comment: "Vendor for the invoice."
location comment: "Location for the invoice."
invoiceType comment: "The type of invoice: debit or credit"
invoiceDate comment: "Date on the invoice."
goodsReceived comment: "Date the goods were received."
paperworkReceived comment: "Date the paperwork was received."
dueDate comment: "Date the payment is due."
applyDiscount comment: "Whether or not the discount is applied."
invoiceComment comment: "Comment on the invoice."
fromFile comment: "Whether or not this invoice was created from a file."
batchId comment: "The unique identifier for the corresponding batch."
interfaceDate comment: "Date the invoice interfaced to Banner."
}
static constraints = {
invoiceCode nullable:false, maxSize:10
vendor nullable:false, blank: false
location nullable:true, blank: false // TODO - back to false
invoiceType nullable:false, blank:false
applyDiscount nullable:false
invoiceComment nullable: true, maxLength:4000
fromFile nullable: true
batchId nullable: true
interfaceDate nullable: true
}
/* -------------- *
* Methods *
* -------------- */
int compareTo(Invoice other) {
int i = vendor.compareTo(other.vendor);
if (i != 0) return i;
return invoiceCode <=> other.invoiceCode;
}
BigDecimal getOriginalAmountTotal() {
return (invoiceAccounting) ? invoiceAccounting*.originalAmount.sum() : BigDecimal.ZERO
}
BigDecimal getAdjustmentAmountTotal() {
return (invoiceAccounting) ? invoiceAccounting*.adjustmentAmount.sum() : BigDecimal.ZERO
}
}
My DataSource, if that will help:
dataSource {
pooled = true
//driverClassName = "org.h2.Driver" - this is what I used for in-memory
driverClassName = "oracle.jdbc.driver.OracleDriver"
dialect = org.hibernate.dialect.Oracle10gDialect // this is not here for in-mem
username = "username" // obviously I have a real set here
password = "password"
}
hibernate {
cache.use_second_level_cache = true
cache.use_query_cache = false
cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory'
jdbc.use_get_generated_keys = true
}
// environment specific settings
environments {
local {
dataSource {
dbCreate = "create-drop" // one of 'create', 'create-drop', 'update', 'validate', ''
url = "ourURL" // obviously a real one goes here
//url = "jdbc:h2:mem:devDb;MVCC=TRUE;LOCK_TIMEOUT=10000" - for in-mem
}
}
development {
dataSource {
dbCreate = "update" // one of 'create', 'create-drop', 'update', 'validate', ''
url = "ourUrl"
}
}
test {
dataSource {
dbCreate = "update"
url = "jdbc:h2:mem:testDb;MVCC=TRUE;LOCK_TIMEOUT=10000"
}
}
production {
dataSource {
// dbCreate = "update" NO SCHEMA CHANGES DONE THROUGH GRAILS
url = "jdbc:h2:prodDb;MVCC=TRUE;LOCK_TIMEOUT=10000"
pooled = true
properties {
maxActive = -1
minEvictableIdleTimeMillis=1800000
timeBetweenEvictionRunsMillis=1800000
numTestsPerEvictionRun=3
testOnBorrow=true
testWhileIdle=true
testOnReturn=true
validationQuery="SELECT 1"
}
}
}
}
In the controller/service when I execute the save() command on one of the problem classes then it gives me an ArrayIndexOutOfBoundsException. The stacktrace:
reached save
Saving invoice:[Invoice [invoiceCode=000, vendor=USFoods, location=Catering-Concessions Operations, invoiceType=DEBIT, invoiceDate=Mon Feb 01 00:00:00 EST 2016, goodsReceived=Mon Feb 01 00:00:00 EST 2016, paperworkReceived=Mon Feb 01 00:00:00 EST 2016, dueDate=Tue Feb 16 00:00:00 EST 2016, applyDiscount=false, invoiceComment=Testing, getOriginalAmountTotal()=0, getAdjustmentAmountTotal()=0, fromFile=false, batchId=null, interfaceDate=null]]
Error |
java.lang.ArrayIndexOutOfBoundsException: 13
Error |
at oracle.jdbc.driver.OracleSql.computeBasicInfo(OracleSql.java:950)
Error |
at oracle.jdbc.driver.OracleSql.getSqlKind(OracleSql.java:623)
Error |
at oracle.jdbc.driver.OraclePreparedStatement.<init>(OraclePreparedStatement.java:1212)
Error |
at oracle.jdbc.driver.T4CPreparedStatement.<init>(T4CPreparedStatement.java:28)
Error |
at oracle.jdbc.driver.T4CDriverExtension.allocatePreparedStatement(T4CDriverExtension.java:68)
Error |
at oracle.jdbc.driver.PhysicalConnection.prepareStatement(PhysicalConnection.java:3140)
Error |
at oracle.jdbc.driver.PhysicalConnection.prepareStatement(PhysicalConnection.java:3042)
Error |
at oracle.jdbc.driver.PhysicalConnection.prepareStatement(PhysicalConnection.java:6022)
Error |
at sun.reflect.GeneratedMethodAccessor275.invoke(Unknown Source)
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.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1276)
Error |
at org.apache.tomcat.jdbc.pool.ProxyConnection.invoke(ProxyConnection.java:126)
Error |
at org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke(JdbcInterceptor.java:109)
Error |
at org.apache.tomcat.jdbc.pool.DisposableConnectionFacade.invoke(DisposableConnectionFacade.java:80)
Error |
at com.sun.proxy.$Proxy38.prepareStatement(Unknown Source)
Error |
at sun.reflect.GeneratedMethodAccessor275.invoke(Unknown Source)
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.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1276)
Error |
at org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy$LazyConnectionInvocationHandler.invoke(LazyConnectionDataSourceProxy.java:376)
Error |
at com.sun.proxy.$Proxy39.prepareStatement(Unknown Source)
Error |
at sun.reflect.GeneratedMethodAccessor275.invoke(Unknown Source)
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.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1276)
Error |
at org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy$TransactionAwareInvocationHandler.invoke(TransactionAwareDataSourceProxy.java:240)
Error |
at com.sun.proxy.$Proxy39.prepareStatement(Unknown Source)
Error |
at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:527)
Error |
at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:131)
Error |
at org.hibernate.id.SequenceIdentityGenerator$Delegate.prepare(SequenceIdentityGenerator.java:98)
Error |
at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:53)
Error |
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2346)
Error |
at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2853)
Error |
at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:71)
Error |
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:273)
Error |
at org.codehaus.groovy.grails.orm.hibernate.support.ClosureEventTriggeringInterceptor.performSaveOrReplicate(ClosureEventTriggeringInterceptor.java:246)
Error |
at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:203)
Error |
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:129)
Error |
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:210)
Error |
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:195)
Error |
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:117)
Error |
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:93)
Error |
at org.codehaus.groovy.grails.orm.hibernate.support.ClosureEventTriggeringInterceptor.onSaveOrUpdate(ClosureEventTriggeringInterceptor.java:104)
Error |
at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:685)
Error |
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:677)
Error |
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:673)
Error |
at org.codehaus.groovy.grails.orm.hibernate.metaclass.SavePersistentMethod$1.doInHibernate(SavePersistentMethod.java:58)
Error |
at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:411)
Error |
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:341)
Error |
at org.codehaus.groovy.grails.orm.hibernate.metaclass.SavePersistentMethod.performSave(SavePersistentMethod.java:56)
Error |
at org.codehaus.groovy.grails.orm.hibernate.metaclass.AbstractSavePersistentMethod.doInvokeInternal(AbstractSavePersistentMethod.java:215)
Error |
at org.codehaus.groovy.grails.orm.hibernate.metaclass.AbstractDynamicPersistentMethod.invoke(AbstractDynamicPersistentMethod.java:63)
Error |
at org.codehaus.groovy.grails.orm.hibernate.HibernateGormInstanceApi.save(HibernateGormInstanceApi.groovy:157)
Error |
at edu.vt.es.dininginvoices.Invoice.save(Invoice.groovy)
Error |
at edu.vt.es.dininginvoices.Invoice$save$3.call(Unknown Source)
Error |
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
Error |
at edu.vt.es.dininginvoices.Invoice$save$3.call(Unknown Source)
Error |
at edu.vt.es.dininginvoices.InvoiceController$$EPdASzSY.save(InvoiceController.groovy:71)
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.simple.MemoryPageFragmentCachingFilter.doFilter(MemoryPageFragmentCachingFilter.java)
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.authentication.switchuser.SwitchUserFilter.doFilter(SwitchUserFilter.java:181)
Error |
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
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 grails.plugin.springsecurity.web.filter.GrailsRememberMeAuthenticationFilter.doFilter(GrailsRememberMeAuthenticationFilter.java)
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 grails.plugin.springsecurity.web.authentication.RequestHolderAuthenticationFilter.doFilter(RequestHolderAuthenticationFilter.java:49)
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.filter.IpAddressFilter.doFilter(IpAddressFilter.java:79)
Error |
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
Error |
at grails.plugin.springsecurity.web.authentication.logout.MutableLogoutFilter.doFilter(MutableLogoutFilter.java:82)
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 org.springframework.security.web.access.channel.ChannelProcessingFilter.doFilter(ChannelProcessingFilter.java:144)
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:170)
Error |
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
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:1040)
Error |
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
Error |
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:313)
Error |
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
Error |
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
Error |
at java.lang.Thread.run(Thread.java:745)
The method I'm calling in InvoiceController:
def save() {
print "reached save"
Invoice invoice = new Invoice()
invoice.vendor = (params.selectVendor) ? Vendor.find(params.selectVendor) : null
invoice.location = (params.selectLocation) ? Location.find(params.selectLocation) : null
invoice.invoiceCode = params.inputInvoiceCode ?: null
invoice.invoiceType = (params.selectInvoiceType) ? InvoiceType.find(params.selectInvoiceType) : null
invoice.invoiceDate = params.inputInvoiceDate ? dateFormat.parse(params.inputInvoiceDate) : null
invoice.goodsReceived = params.inputGoodsReceived ? dateFormat.parse(params.inputGoodsReceived) : null
invoice.paperworkReceived = params.inputPaperworkReceived ? dateFormat.parse(params.inputPaperworkReceived) : null
invoice.dueDate = invoice.paperworkReceived ? (invoice.paperworkReceived + 15) : null
invoice.applyDiscount = params.selectApplyDiscount ?: false
invoice.invoiceComment = params.inputComment ?: null
invoice.fromFile = false
if (invoice.validate()) {
print "Saving invoice:[${invoice}]"
log.debug("Saving invoice:[${invoice}]")
try {
invoice.save()
} catch (Exception e) {
e.printStackTrace()
}
log.info("Added invoice:[${invoice}]")
flash.message = "Invoice saved successfully."
redirect (action: "index")
} else {
render (view: "create", model: [invoice: invoice])
}
}
After going through the process of starting with a single field and adding other fields until it broke, I started to notice that it was the number of fields, not the type of fields, that caused it to break. With that in mind I searched and found this other post: Grails 2.4.2 Domain will not save more than 8 fields
The solution is to update the OJDBC driver. Previously I was using 11.1.0.7.0; now I'm using 11.2.0.2.0 and it works. If anyone can explain the specific reason why 11.1 was failing then I'll mark yours as the chosen answer.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments