Announcement Announcement Module
Collapse
No announcement yet.
Help with AOP + JFrame Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Help with AOP + JFrame

    Hi i create one JFrame and need to use AOP with that JFrame, but when i create my bean(JFrame) i got that error:

    Code:
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'testeFrom' defined in file [D:\Projetos\Java\Notas\fontes\Notas\build\classes\br\com\dnasolution\gui\TesteFrom.class]: Initialization of bean failed; nested exception is java.lang.IllegalAccessError: class javax.swing.$Proxy28 cannot access its superinterface javax.swing.TransferHandler$HasGetTransferHandler
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:480)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
            at java.security.AccessController.doPrivileged(Native Method)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
            at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
            at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
            at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
            at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
            at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
            at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
            at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
            at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
            at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
            at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
            at br.com.dnasolution.util.CarregaContextNotas.<init>(CarregaContextNotas.java:28)
            at br.com.dnasolution.util.CarregaContextNotas.getInstance(CarregaContextNotas.java:22)
            at notas.Main.main(Main.java:201)
    Caused by: java.lang.IllegalAccessError: class javax.swing.$Proxy28 cannot access its superinterface javax.swing.TransferHandler$HasGetTransferHandler
            at java.lang.reflect.Proxy.defineClass0(Native Method)
            at java.lang.reflect.Proxy.getProxyClass(Proxy.java:504)
            at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:581)
            at org.springframework.aop.framework.JdkDynamicAopProxy.getProxy(JdkDynamicAopProxy.java:117)
            at org.springframework.aop.framework.ProxyFactory.getProxy(ProxyFactory.java:110)
            at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.createProxy(AbstractAutoProxyCreator.java:490)
            at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.wrapIfNecessary(AbstractAutoProxyCreator.java:365)
            at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:325)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:361)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1344)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
            ... 16 more
    anyone can help me please??

  • #2
    The problem is that you use interface-based proxying (jdk proxies) and can't access javax.swing.TransferHandler.HasGetTransferHandler interface since it has package-private visibility.

    You can try cglib proxies instead.

    Comment


    • #3
      yes but what i need to change? because i only create and call my JFrame

      JFrame frame = (MyJFrame) ac.getBean("myJFrame");
      frame.setVisible(true)

      tks

      Comment


      • #4
        Did you setup AOP at your context?

        Comment


        • #5
          this?
          Code:
          	<context:annotation-config/>
              <context:component-scan base-package="br"/>
          	<aop:aspectj-autoproxy/>

          Comment


          • #6
            Use '<aop:aspectj-autoproxy proxy-target-class="true">'.

            Comment


            • #7
              it's worked, thanks, now did you know if can i use AOP into my JFrame not managed from Spring??

              tks

              Comment


              • #8
                aspectj weaving

                Comment


                • #9
                  Originally posted by denis.zhdanov View Post
                  It is difficult to solve the problem. You should search on google. Yaaaa
                  __________________
                  Organisme de credit a la consommation | Organisme maison de credit immobilier | Organisme de rachat de credit en ligne

                  Comment

                  Working...
                  X