Jump to content
We've recently updated our Privacy Statement, available here ×

Updating a resource using REST causes 403-Forbidden


spierepf

Recommended Posts

I am trying to use Jasperservers REST API to update a report definition. However, when I do so, I get a 403 Forbidden error that looks like:

Access to the specified resource () has been forbidden.

and my jasperserver log contains a message like:

2013-06-13 12:02:30,659  INFO HibernateRepositoryServiceImpl,http-bio-8080-exec-104:1188 - Creating children folder for /public/overture-01/public/common/Reports/Accounts_Receivable_Reports/AccountsReceivableAgingReport_files/CutoffDate
2013-06-13 12:02:30,664  INFO HibernateRepositoryServiceImpl,http-bio-8080-exec-104:1188 - Creating children folder for /public/overture-01/public/common/Reports/Accounts_Receivable_Reports/AccountsReceivableAgingReport_files/market_tag
2013-06-13 12:02:30,670  INFO HibernateRepositoryServiceImpl,http-bio-8080-exec-104:1188 - Creating children folder for /public/overture-01/public/common/Reports/Accounts_Receivable_Reports/AccountsReceivableAgingReport_files/dealer_tag
2013-06-13 12:02:30,677  INFO HibernateRepositoryServiceImpl,http-bio-8080-exec-104:1188 - Creating children folder for /public/overture-01/public/common/Reports/Accounts_Receivable_Reports/AccountsReceivableAgingReport_files/branch_id
2013-06-13 12:02:30,684  INFO HibernateRepositoryServiceImpl,http-bio-8080-exec-104:1188 - Creating children folder for /public/overture-01/public/common/Reports/Accounts_Receivable_Reports/AccountsReceivableAgingReport_files/CustomerType
2013-06-13 12:02:30,690  INFO HibernateRepositoryServiceImpl,http-bio-8080-exec-104:1188 - Creating children folder for /public/overture-01/public/common/Reports/Accounts_Receivable_Reports/AccountsReceivableAgingReport_files/CustomerName
2013-06-13 12:02:30,693  INFO HibernateRepositoryServiceImpl,http-bio-8080-exec-104:1188 - Creating children folder for /public/overture-01/public/common/Reports/Accounts_Receivable_Reports/AccountsReceivableAgingReport_files/AccountType
2013-06-13 12:02:30,699  INFO HibernateRepositoryServiceImpl,http-bio-8080-exec-104:1188 - Creating children folder for /public/overture-01/public/common/Reports/Accounts_Receivable_Reports/AccountsReceivableAgingReport_files/MinBalanceAmount
2013-06-13 12:02:30,747  WARN JDBCExceptionReporter,http-bio-8080-exec-104:100 - SQL Error: 1062, SQLState: 23000
2013-06-13 12:02:30,748 ERROR JDBCExceptionReporter,http-bio-8080-exec-104:101 - Duplicate entry 'AccountType-15327' for key 'name'
2013-06-13 12:02:30,748 ERROR AbstractFlushingEventListener,http-bio-8080-exec-104:325 - Could not synchronize database state with session
org.hibernate.exception.ConstraintViolationException: could not update: [com.jaspersoft.jasperserver.api.metadata.common.service.impl.hibernate.persistent.RepoInputControl#34801]
    at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:94)
    at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
    at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2443)
    at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:2325)
    at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2625)
    at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:115)
    at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:279)
    at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:263)
    at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:168)
    at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:322)
    at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50)
    at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1028)
    at org.springframework.orm.hibernate3.HibernateTemplate$28.doInHibernate(HibernateTemplate.java:883)
    at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:406)
    at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)
    at org.springframework.orm.hibernate3.HibernateTemplate.flush(HibernateTemplate.java:881)
    at com.jaspersoft.jasperserver.api.metadata.common.service.impl.HibernateDaoImpl.executeWriteCallback(HibernateDaoImpl.java:77)
    at com.jaspersoft.jasperserver.api.metadata.common.service.impl.HibernateDaoImpl.executeWriteCallback(HibernateDaoImpl.java:66)
    at com.jaspersoft.jasperserver.api.metadata.common.service.impl.hibernate.HibernateRepositoryServiceImpl.saveResource(HibernateRepositoryServiceImpl.java:521)
    at sun.reflect.GeneratedMethodAccessor933.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:318)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
    at $Proxy15.saveResource(Unknown Source)
    at sun.reflect.GeneratedMethodAccessor931.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:318)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
    at com.jaspersoft.ji.adhoc.service.EasyXMLizer.invoke(EasyXMLizer.java:42)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    at com.jaspersoft.ji.adhoc.service.EasyXMLizer.invoke(EasyXMLizer.java:42)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    at com.jaspersoft.jasperserver.api.metadata.user.service.impl.PermissionsPrefetcher.invoke(PermissionsPrefetcher.java:78)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    at org.springframework.security.intercept.method.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:66)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    at com.jaspersoft.jasperserver.api.metadata.user.service.impl.PermissionsPrefetcher.invoke(PermissionsPrefetcher.java:78)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    at org.springframework.security.intercept.method.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:66)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
    at $Proxy19.saveResource(Unknown Source)
    at com.jaspersoft.jasperserver.multipleTenancy.PathTransformationRepositoryService.saveResource(PathTransformationRepositoryService.java:525)
    at sun.reflect.GeneratedMethodAccessor931.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:318)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
    at $Proxy19.saveResource(Unknown Source)
    at com.jaspersoft.jasperserver.remote.handlers.AbstractResourceHandler.update(AbstractResourceHandler.java:335)
    at com.jaspersoft.jasperserver.remote.services.impl.ResourcesManagementRemoteServiceImpl.updateResource(ResourcesManagementRemoteServiceImpl.java:413)
    at com.jaspersoft.jasperserver.rest.services.RESTResource.doPost(RESTResource.java:304)
    at com.jaspersoft.jasperserver.rest.RESTAbstractService.execute(RESTAbstractService.java:109)
    at com.jaspersoft.jasperserver.rest.RESTAbstractService$$FastClassByCGLIB$$c9596599.invoke(<generated>)
    at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:191)
    at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:689)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
    at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
    at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:622)
    at com.jaspersoft.jasperserver.rest.services.RESTResource$$EnhancerByCGLIB$$e60da745.execute(<generated>)
    at com.jaspersoft.jasperserver.rest.RESTServlet.service(RESTServlet.java:135)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:399)
    at org.springframework.security.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
    at org.springframework.security.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
    at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:411)
    at org.springframework.security.ui.ExceptionTranslationFilter.doFilterHttp(ExceptionTranslationFilter.java:101)
    at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
    at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:411)
    at com.jaspersoft.ji.license.JILicenseFilter.doFilter(JILicenseFilter.java:66)
    at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:411)
    at org.springframework.security.providers.anonymous.AnonymousProcessingFilter.doFilterHttp(AnonymousProcessingFilter.java:105)
    at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
    at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:411)
    at com.jaspersoft.jasperserver.api.metadata.user.service.impl.MetadataAuthenticationProcessingFilter.doFilter(MetadataAuthenticationProcessingFilter.java:139)
    at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:411)
    at com.jaspersoft.jasperserver.api.metadata.user.service.impl.PasswordExpirationProcessingFilter.doFilter(PasswordExpirationProcessingFilter.java:85)
    at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:411)
    at com.jaspersoft.jasperserver.multipleTenancy.MTBasicProcessingFilter.doFilterHttp(MTBasicProcessingFilter.java:180)
    at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
    at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:411)
    at com.jaspersoft.jasperserver.api.metadata.user.service.impl.JIPortletAuthenticationProcessingFilter.doFilter(JIPortletAuthenticationProcessingFilter.java:81)
    at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:411)
    at com.jaspersoft.jasperserver.api.logging.filter.BasicLoggingFilter.doFilter(BasicLoggingFilter.java:53)
    at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:411)
    at org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)
    at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
    at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:411)
    at com.jaspersoft.ji.license.JILicenseFilter.doFilter(JILicenseFilter.java:66)
    at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:411)
    at org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:188)
    at org.springframework.security.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:99)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at com.jaspersoft.jasperserver.war.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:67)
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at com.jaspersoft.jasperserver.war.P3PFilter.doFilter(P3PFilter.java:43)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:581)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1001)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:722)
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry 'AccountType-15327' for key 'name'
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
    at com.mysql.jdbc.Util.getInstance(Util.java:386)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1040)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4074)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4006)
    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2468)
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2629)
    at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2719)
    at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2155)
    at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2450)
    at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2371)
    at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2355)
    at org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)
    at org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)
    at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2425)
    ... 128 more
2013-06-13 12:02:30,762 ERROR RESTServlet,http-bio-8080-exec-104:187 - request params: Path: /resource/public/overture-01/public/common/Reports/Accounts_Receivable_Reports/AccountsReceivableAgingReport Requested Service: resource httpStatus: 403 error: could not update: [com.jaspersoft.jasperserver.api.metadata.common.service.impl.hibernate.persistent.RepoInputControl#34801]; SQL [update JIResource set version=?, name=?, parent_folder=?, childrenFolder=?, label=?, description=?, resourceType=?, creation_date=?, update_date=? where id=? and version=?]; constraint [null]; nested exception is org.hibernate.exception.ConstraintViolationException: could not update: [com.jaspersoft.jasperserver.api.metadata.common.service.impl.hibernate.persistent.RepoInputControl#34801]

 

The reason that I am confused is that I am attempting to perform an update (using POST instead of PUT) which means that I am expecting the resources to exist already. So why is the backend trying to create new records when it should just be overwriting the old ones?

Peter

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...