Announcement Announcement Module
Collapse
No announcement yet.
IllegalAccessException AopUtils Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • IllegalAccessException AopUtils

    java.lang.IllegalAccessException: Class org.springframework.aop.support.AopUtils can not access a member of class spring.Facade with modifiers "public abstract"
    at sun.reflect.Reflection.ensureMemberAccess(Reflecti on.java:65

    Can anybody give me a hint why this is not working?

    If i simply leave out all the AOP related stuff I get correctly wired up Objects. But once I try AOP I get this exception.... ?

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans
    		  PUBLIC "-//SPRING//DTD BEAN//EN"
    		  "http&#58;//www.springframework.org/dtd/spring-beans.dtd">
    		  
    <beans default-autowire="byName">
    	
    	<bean id="autoProxyCreator"
    		class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator" />
    	
    	<bean id="advisor"
    		class="org.springframework.aop.support.NameMatchMethodPointcutAdvisor" autowire="constructor">
    		<property name="advice"><ref local="perfMon" /></property>
    		<property name="mappedName"><value>*</value></property>
    	</bean>
    	
    	<bean id="perfMon"
    	  class="org.springframework.aop.interceptor.PerformanceMonitorInterceptor" />
    	
    	<bean id="applicationFacade" class="spring.FacadeImpl"/>
    	
    	<bean id="authenticationService" class="spring.AuthenticationService">
    		<constructor-arg><value>south</value></constructor-arg>
    	</bean>
    	
    	<bean id="weatherService" class="dynproxy.WeatherService" />
    	
    </beans>

  • #2
    I think it has something to do with the 'abstract' modifier.

    Comment


    • #3
      Hi there,

      I have an interface [spring.Facade] which is obviously public abstract - but I provide an implementation which is not - so I don't get it ... As I said, when I just use plain IoC - everything works fine, but add AOP and I get this exception. I've tried other approaches than the AutoProxyFactories - always with the same result..

      Regards,
      Nils

      Comment


      • #4
        Why not remove the 'abstract' from the interface - you cannot put the implemementation in the interface anyways?
        I may be chasing butterflies here but give it try.

        Comment


        • #5
          Hi costin,

          thank you for your reply.

          Why not remove the 'abstract' from the interface
          There is no way to do that - an interface and its methods are by definition always public abstract.

          Regards,
          Nils

          Comment


          • #6
            Maybe I misunderstood but I thought you defined something like:

            Code:
            interface A
            &#123;
                public abstract someMethod&#40;&#41;;
            &#125;
            you can just as well define:

            Code:
            interface A
            &#123;
                someMethod&#40;&#41;;
            &#125;
            As someMethod it's defined in an interface it will always be public and abstract no matter if you specify abstract or public or not.
            My advice was to use second definition.

            Comment


            • #7
              Got it!

              Let's assume my interface looks like this
              Code:
              interface Facade &#123;
                  void doSomething&#40;&#41;;
              &#125;
              Which leads to the described problems, but guess what happens when I modify it, so it looks like this:

              Code:
              public interface Facade &#123;
                  void doSomething&#40;&#41;;
              &#125;
              Once I add the public modifier it works!

              At first I thought this is a bug. But my thinking had a bug :-) I assumed that top-level interfaces are always public - which is not true. [Even the error message sends you off in that direction!]

              A top-level interface cannot be protected or private HOWEVER leaving out the access modifier applies default visibilty just like for a regular class.

              http://java.sun.com/docs/books/jls/s...doc.html#26783

              OK, that solves it.
              Thanks
              Nils

              Comment

              Working...
              X