Note that there are some explanatory texts on larger screens.

plurals
  1. POjava.lang.IllegalArgumentException: error at ::0 can't find referenced pointcut
    primarykey
    data
    text
    <p>I'm really very new to Spring AOP. In my application, I had configured <a href="http://static.springsource.org/spring/docs/3.1.x/javadoc-api/org/springframework/web/filter/HiddenHttpMethodFilter.html" rel="nofollow"><code>HiddenHttpMethodFilter</code></a> that converts method parameters into HTTP methods and enables Spring to handle other HTTP methods like <code>DELETE</code>, <code>PUT</code> etc including <code>GET</code> and <code>POST</code>.</p> <p>It is some times necessary to disable this functionality especially when handling multipart requests. In order to disable it at a specific request (regarding mulripart), I was using the following code.</p> <pre><code>package resolver; import javax.servlet.http.HttpServletRequest; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Pointcut; import org.springframework.util.Assert; import org.springframework.web.multipart.MultipartResolver; /** * Disables the spring multipart resolver for specific client requests and * therefore keeps the request intact so that controllers can process it in * whatever way they wish. This behaviour is triggered by a particular GET * parameter in the client request so it is configurable. * @see MultipartResolver */ @Aspect public final class MultipartResolverDisablingAspect { /** * GET parameter which, if present in request, enables advice. */ private static final String DISABLING_HTTP_REQUEST_PARAMETER_KEY = "_multipartResolverDisable"; private static boolean disablingParameterExists(final HttpServletRequest request) { Assert.notNull(request); return request.getParameter(DISABLING_HTTP_REQUEST_PARAMETER_KEY) != null; } /** * If above GET parameter exists in request then prompt the spring multipart * resolver to always tell spring that request is not of type multipart. * Spring then does not process the request any further. * @param pjp * @param request * @return * @throws Throwable */ @Around("isMultipartOperation() &amp;&amp; args(request)") public Object disableIsMultipartOperation(final ProceedingJoinPoint pjp, final HttpServletRequest request) throws Throwable { Assert.notNull(pjp); Assert.notNull(request); if (disablingParameterExists(request)) { return Boolean.FALSE; } return pjp.proceed(); } /** * Applies to any implementation of {@linkplain MultipartResolver} */ @SuppressWarnings("unused") @Pointcut("execution(public boolean " + "org.springframework.web.multipart.MultipartResolver." + "isMultipart(javax.servlet.http.HttpServletRequest))") private void isMultipartOperation() {} } </code></pre> <p>and in the <code>application-context.xml</code> file, the following xml is required.</p> <pre><code>&lt;aop:aspectj-autoproxy proxy-target-class="false" /&gt; &lt;bean class="resolver.MultipartResolverDisablingAspect" /&gt; &lt;!--Registers the above bean (class)--&gt; </code></pre> <p>This code was taken from <a href="http://dhruba.name/2008/12/27/implementing-single-and-multiple-file-multipart-uploads-using-spring-25/" rel="nofollow">this</a> article under the section - MULTIPART RESOLVER DISABLING ASPECT.</p> <p>It is meant to disable multipart processing by <a href="http://static.springsource.org/spring/docs/3.1.x/javadoc-api/org/springframework/web/filter/HiddenHttpMethodFilter.html" rel="nofollow"><code>HiddenHttpMethodFilter</code></a> when a <code>GET</code> parameter <code>multipartResolverDisable=1</code> is used as a query string <strong>as specified by the code above</strong> so that one can use <a href="http://commons.apache.org/fileupload/" rel="nofollow">commons fileupload</a> as usual (when <code>multipartResolverDisable=1</code> is supplied as a query string)</p> <hr> <p>The actual question is still not in the picture. This approach was earlier working correctly in the following environment (with NetBeans 6.9.1).</p> <ul> <li>Spring 3.2.0</li> <li>Apache Tomcat 6.0.26.6 with the Servlet API 2.5.</li> </ul> <p>Recently I have upgraded NetBeans 7.2.1 with Apache Tomcat 7.0.35 which has the Servlet API 3.0. <strong>The Spring version is the same as it was before</strong> - Spring 3.2.0.</p> <p>With this updates, the approach as described above caused the following exception.</p> <pre><code>Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.transaction.config.internalTransactionAdvisor': Cannot resolve reference to bean 'org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0' while setting bean property 'transactionAttributeSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0': Initialization of bean failed; nested exception is **java.lang.IllegalArgumentException: error at ::0 can't find referenced pointcut isMultipartOperation** </code></pre> <p>Where the <code>isMultipartOperation()</code> is the last method in the above class. </p> <p>There might be a small change to the code but I know a very little about AOP and cannot figure out the cause of this exception in this nice-looking code. </p> <p>What is the cause of this exception? Dose it have to do something with the Servlet API?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload