Announcement Announcement Module
Collapse
No announcement yet.
IllegalArgumentException: error wildcard type pattern not allowed, must use type name Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • IllegalArgumentException: error wildcard type pattern not allowed, must use type name

    Please review the following code:

    Code:
    package com.simple.aspect.system;
    @Aspect
    public class SystemArchitectureAspect
    {
    	@Pointcut("witin(com.simple.web..*)")
    	public void inWebLayer() {}
    
    	@Pointcut("within(com.simple.aspect..*)")
    	public void inAspectLayer() {}
    
    	@Pointcut("execution(* com.simple..*.*(..)) && !inAspectLayer()")
    	public void allOperations() {}
    }
    Code:
    package com.simple.aspect.log;
    @Aspect
    public class LogManagerAspect
    {
            private Log log = LogFactory.getLog(getClass());
    
            @Before("com.simple.aspect.system.SystemArchitectureAspect.allOperations()")
            public void beforeTraced(JoinPoint pjp)
            {
                    Signature sig = pjp.getSignature();
    
                    if (sig != null)
                            log.info("Entering [" + sig.toShortString() + "]");
            }
    
            @After("com.simple.aspect.system.SystemArchitectureAspect.allOperations()")
            public void afterTraced(JoinPoint pjp)
            {
                    Signature sig = pjp.getSignature();
    
                    if (sig != null)
                            log.info("Leaving [" + sig.toShortString() + "]");
            }
    }
    Last edited by zollen; Jan 24th, 2010, 10:10 PM.

  • #2
    I got the following Exception

    Code:
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'simpleConfig': Initialization of bean failed; nested exception is java.lang.IllegalArgumentException: error wildcard type pattern not allowed, must use type name
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
    	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)
    	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:189)
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:557)
    	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:842)
    	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:416)
    	at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:261)
    	at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:192)
    	at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
    	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3934)
    	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4429)
    	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
    	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
    	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:526)
    	at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:987)
    	at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:909)
    Last edited by zollen; Jan 24th, 2010, 07:50 PM.

    Comment


    • #3
      org.springframework.context-3.0.0.RELEASE.jar (spring latest stable release)
      org.springframework.orm-3.0.0.RELEASE.jar
      org.springframework.core-3.0.0.RELEASE.jar
      org.springframework.context.support-3.0.0.RELEASE.jar
      org.springframework.beans-3.0.0.RELEASE.jar
      cglib-2.2.jar
      org.springframework.web.servlet-3.0.0.RELEASE.jar
      org.springframework.oxm-3.0.0.RELEASE.jar
      org.springframework.jdbc-3.0.0.RELEASE.jar
      org.springframework.expression-3.0.0.RELEASE.jar
      org.springframework.aspects-3.0.0.RELEASE.jar
      asm-3.2.jar
      org.springframework.web-3.0.0.RELEASE.jar
      org.springframework.asm-3.0.0.RELEASE.jar
      org.springframework.aop-3.0.0.RELEASE.jar
      log4j-1.2.15.jar
      commons-dbcp-1.2.2.jar
      commons-pool-1.5.4.jar
      commons-logging-1.1.1.jar
      org.springframework.transaction-3.0.0.RELEASE.jar
      jstl.jar
      standard.jar
      com.springsource.org.aopalliance-1.0.0.jar
      aspectjrt.jar (version: 1.5.4-1)
      aspectjweaver.jar (veresion: 1.5.4-1)

      Comment


      • #4
        Further investigation

        In LogManagerAspect, if I replace the two pointcuts

        Code:
        @Before("com.fundserv.simple.aspect.system.SystemArchitectureAspect.allOperations()")
        @After("com.fundserv.simple.aspect.system.SystemArchitectureAspect.allOperations()")
        with

        Code:
        @Before("execution(* com.fundserv.simple..*.*(..))")
        @After("execution(* com.fundserv.simple..*.*(..))")
        Then everything works without any problem.
        It seems my current environment does not allow referencing any pointcut expression by name, (i.e. allOperations()..etc)
        Last edited by zollen; Jan 23rd, 2010, 11:47 PM.

        Comment


        • #5
          Further investigation2

          I made some small changes to test the problem. I consolidated the SystemArchitectAspect and LogManagerAspect into one single Aspect as follow; To my surprise it works without any problem.

          Code:
          package com.simple.aspect.log;
          @Aspect
          public class LogManagerAspect
          {
                  private Log log = LogFactory.getLog(getClass());
          
                  @Pointcut("within(com.simple.aspect..*)")
                  public void inAspectLayer() {}
          
                  @Pointcut("execution(* com.simple..*.*(..)) && !inAspectLayer()")
                  public void allOperations() {}
          
          
                  @Before("allOperations()")
                  public void beforeTraced(JoinPoint pjp)
                  {
                          Signature sig = pjp.getSignature();
          
                          if (sig != null)
                                  log.info("Entering [" + sig.toShortString() + "]");
                  }
          
                  @After("allOperations()")
                  public void afterTraced(JoinPoint pjp)
                  {
                          Signature sig = pjp.getSignature();
          
                          if (sig != null)
                                  log.info("Leaving [" + sig.toShortString() + "]");
                  }
          }
          Code:
          @Before("com.simple.aspect.system.SystemArchitectureAspect.allOperations()")
          @After("com.simple.aspect.system.SystemArchitectureAspect.allOperations()")
          My investigation so far leads me to believe that this type of cross-package pointcut name referencing is either not supported, or the above referencing syntax is not quite correct.
          Last edited by zollen; Jan 24th, 2010, 04:48 PM.

          Comment


          • #6
            Further investigation3

            http://static.springsource.org/sprin...#aop-ataspectj

            According to section 7.2.3.3 and 7.2.4, it is considered a good practice to consolidate all basic pointcuts into a shared aspect (i.e. SystemArchitecture..etc). The cross-package pointcut name referencing is clearly supported. Further more in section 7.2.4, the sample advices have the exact same pointcut name referencing syntax as my code. My early conclusions were wrong. More investigation is under way.

            Comment


            • #7
              I finally got it!! There was a pointcut expression error in one of the unused pointcut in SystemArchitectureAspect.

              Code:
              package com.simple.aspect.system;
              @Aspect
              public class SystemArchitectureAspect
              {
              	@Pointcut("witin(com.simple.web..*)")
              	public void inWebLayer() {}
              
              	@Pointcut("within(com.simple.aspect..*)")
              	public void inAspectLayer() {}
              
              	@Pointcut("execution(* com.simple..*.*(..)) && !inAspectLayer()")
              	public void allOperations() {}
              }

              Comment

              Working...
              X