Announcement Announcement Module
Collapse
No announcement yet.
org.springframework.aop.framework.Advised not visible?? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • org.springframework.aop.framework.Advised not visible??

    i only want to use Transaction in my app, and my applicationContext.xml is :

    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>
        <!-- Hibernate SessionFactory -->
        <bean id="sessionFactory" class="org.springframework.orm.hibernate.LocalSessionFactoryBean">
           <!-- <property name="dataSource"><ref local="dataSource"/></property>-->
          	<property name="configLocation">
    			<value>classpath&#58;/hibernate.cfg.xml</value>
    		</property>	
        </bean>
        
         <bean id="transfersNetDAO" class="com.jctx.trms.hibernate.DAO.TransfersNetDAOImpl">
            <property name="sessionFactory">
                <ref local="sessionFactory"/>
            </property>
        </bean>
        
        <bean id="transactionManager" class="org.springframework.orm.hibernate.HibernateTransactionManager">
            <property name="sessionFactory">
                <ref local="sessionFactory"/>
            </property>
        </bean>
        
           <bean id="txProxyTemplate" lazy-init="true"
            class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
            <property name="transactionManager">
                <ref bean="transactionManager"/>
            </property>
            <property name="transactionAttributes">
                <props>
                    <prop key="del*">PROPAGATION_REQUIRED</prop>
                    <prop key="*">PROPAGATION_REQUIRED,readOnly</prop>
                </props>
            </property>
    
        </bean>
          <bean id="transfersNetManager" parent="txProxyTemplate">
            <property name="target">
                <bean class="com.jctx.trms.hibernate.bussiness.TransfersNetManagerImpl">
                    <property name="transfersNetDAO"><ref bean="transfersNetDAO"/></property>
                </bean>
            </property>
        </bean>
        <!-- Add Managers here -->
    </beans>
    but when i use
    TransfersNetManager tx=(TransfersNetManager) ctx.getBean("transfersNetManager");
    tx.findxxx() method ;
    there are some errors ,the messages are:
    Caused by: org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'transfersNetManager' defined in class path resource [applicationContext.xml]: Initialization of bean failed; nested exception is java.lang.IllegalArgumentException: interface org.springframework.aop.framework.Advised is not visible from class loader

    Code:
    java.lang.ExceptionInInitializerError
    	at com.jctx.trms.propertyui.NetworkUI$1.widgetSelected&#40;NetworkUI.java&#58;175&#41;
    	at org.eclipse.swt.widgets.TypedListener.handleEvent&#40;TypedListener.java&#58;89&#41;
    	at org.eclipse.swt.widgets.EventTable.sendEvent&#40;EventTable.java&#58;82&#41;
    	at org.eclipse.swt.widgets.Widget.sendEvent&#40;Widget.java&#58;796&#41;
    	at org.eclipse.swt.widgets.Display.runDeferredEvents&#40;Display.java&#58;2772&#41;
    	at org.eclipse.swt.widgets.Display.readAndDispatch&#40;Display.java&#58;2431&#41;
    	at org.eclipse.ui.internal.Workbench.runEventLoop&#40;Workbench.java&#58;1377&#41;
    	at org.eclipse.ui.internal.Workbench.runUI&#40;Workbench.java&#58;1348&#41;
    	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench&#40;Workbench.java&#58;254&#41;
    	at org.eclipse.ui.PlatformUI.createAndRunWorkbench&#40;PlatformUI.java&#58;141&#41;
    	at org.eclipse.ui.internal.ide.IDEApplication.run&#40;IDEApplication.java&#58;96&#41;
    	at org.eclipse.core.internal.runtime.PlatformActivator$1.run&#40;PlatformActivator.java&#58;335&#41;
    	at org.eclipse.core.runtime.adaptor.EclipseStarter.run&#40;EclipseStarter.java&#58;273&#41;
    	at org.eclipse.core.runtime.adaptor.EclipseStarter.run&#40;EclipseStarter.java&#58;129&#41;
    	at sun.reflect.NativeMethodAccessorImpl.invoke0&#40;Native Method&#41;
    	at sun.reflect.NativeMethodAccessorImpl.invoke&#40;NativeMethodAccessorImpl.java&#58;39&#41;
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke&#40;DelegatingMethodAccessorImpl.java&#58;25&#41;
    	at java.lang.reflect.Method.invoke&#40;Method.java&#58;324&#41;
    	at org.eclipse.core.launcher.Main.basicRun&#40;Main.java&#58;185&#41;
    	at org.eclipse.core.launcher.Main.run&#40;Main.java&#58;704&#41;
    	at org.eclipse.core.launcher.Main.main&#40;Main.java&#58;688&#41;
    Caused by&#58; org.springframework.beans.factory.BeanCreationException&#58; Error creating bean with name 'transfersNetManager' defined in class path resource &#91;applicationContext.xml&#93;&#58; Initialization of bean failed; nested exception is java.lang.IllegalArgumentException&#58; interface org.springframework.aop.framework.Advised is not visible from class loader
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean&#40;AbstractAutowireCapableBeanFactory.java&#58;300&#41;
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean&#40;AbstractAutowireCapableBeanFactory.java&#58;205&#41;
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean&#40;AbstractBeanFactory.java&#58;204&#41;
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean&#40;AbstractBeanFactory.java&#58;136&#41;
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons&#40;DefaultListableBeanFactory.java&#58;230&#41;
    	at org.springframework.context.support.AbstractApplicationContext.refresh&#40;AbstractApplicationContext.java&#58;284&#41;
    	at org.springframework.context.support.AlternateClassPathXmlApplicationContext.<init>&#40;AlternateClassPathXmlApplicationContext.java&#58;66&#41;
    	at org.springframework.context.support.AlternateClassPathXmlApplicationContext.<init>&#40;AlternateClassPathXmlApplicationContext.java&#58;49&#41;
    	at com.jctx.trms.utils.GlobalApplicationContext.<clinit>&#40;GlobalApplicationContext.java&#58;14&#41;
    	... 21 more
    &#91;b&#93;Caused by&#58; java.lang.IllegalArgumentException&#58; interface org.springframework.aop.framework.Advised is not visible from class loader&#91;/b&#93;	at java.lang.reflect.Proxy.getProxyClass&#40;Proxy.java&#58;331&#41;
    	at java.lang.reflect.Proxy.newProxyInstance&#40;Proxy.java&#58;552&#41;
    	at org.springframework.aop.framework.JdkDynamicAopProxy.getProxy&#40;JdkDynamicAopProxy.java&#58;194&#41;
    	at org.springframework.aop.framework.JdkDynamicAopProxy.getProxy&#40;JdkDynamicAopProxy.java&#58;182&#41;
    	at org.springframework.aop.framework.ProxyFactory.getProxy&#40;ProxyFactory.java&#58;66&#41;
    	at org.springframework.transaction.interceptor.TransactionProxyFactoryBean.afterPropertiesSet&#40;TransactionProxyFactoryBean.java&#58;236&#41;
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods&#40;AbstractAutowireCapableBeanFactory.java&#58;1057&#41;
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean&#40;AbstractAutowireCapableBeanFactory.java&#58;287&#41;
    	... 29 more
    what's the wrong with these? :?:

  • #2
    You seem to have a class loader problem. So your XML config isn't really relevant--more how your class loading works. Is there anything unusual about your Eclipse setup?

    What is org.springframework.context.support.AlternateClass PathXmlApplicationContext?

    Comment


    • #3
      Originally posted by Rod Johnson
      You seem to have a class loader problem. So your XML config isn't really relevant--more how your class loading works. Is there anything unusual about your Eclipse setup?

      What is org.springframework.context.support.AlternateClass PathXmlApplicationContext?
      this is a class from http://folk.uio.no/olepaa/spring/, i use it to solve the classloader problem that occur in my hibernate+spring+Eclipse RCP integrated application.
      because i use spring in a eclipse rcp application ,not a webapp,so i have to
      use
      Code:
       String&#91;&#93; contextFiles = &#123; "applicationContext.xml" &#125;;
              if &#40;ctx == null&#41; &#123;
                  ctx = new AlternateClassPathXmlApplicationContext&#40;contextFiles, LogicMessages.class&#41;;
              &#125;
      to load my applicationContext.xml.

      Comment


      • #4
        I had the same problem, what i did is set the Thread context class loader to the clazz class loader from AlternateClassPathXmlApplicationContext, i modified the constructor

        Code:
        	public AlternateClassPathXmlApplicationContext&#40;String&#91;&#93; configLocations, 
        			Class clazz, boolean refresh&#41; throws BeansException &#123;
        		super&#40;configLocations, false&#41;;
        		this.clazz = clazz;
        		
        		
        //To fix problems when triying to load files using the thread class loader. 
        		Thread.currentThread&#40;&#41;.setContextClassLoader&#40;clazz.getClassLoader&#40;&#41;&#41;;
        		
        		
        		
        		if &#40;refresh&#41;&#123;
        			refresh&#40;&#41;;
        		&#125;
        	&#125;
        I haven't has any more problems so long, and i hope it doesn't break anything.

        Comment


        • #5
          I get this with Orion in a Debian Linux environment..

          When two apps are loaded up using Spring in the same instance of Orion.

          Here's where the error starts from:

          org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'UserDAO': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalArgumentException: interface org.springframework.aop.framework.Advised is not visible from class loader
          java.lang.IllegalArgumentException: interface org.springframework.aop.framework.Advised is not visible from class loader

          Anyone else having this problem? I've installed a fresh version of orion, fresh JDK, latest Spring jars etc.

          Comment


          • #6
            full stack trace:

            java.lang.IllegalArgumentException: interface org.springframework.aop.framework.Advised is not visible from class loader
            org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'UserDAO': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalArgumentException: interface org.springframework.aop.framework.Advised is not visible from class loader
            java.lang.IllegalArgumentException: interface org.springframework.aop.framework.Advised is not visible from class loader
            at java.lang.reflect.Proxy.getProxyClass(Proxy.java:3 45)
            at java.lang.reflect.Proxy.newProxyInstance(Proxy.jav a:564)
            at org.springframework.aop.framework.JdkDynamicAopPro xy.getProxy(JdkDynamicAopProxy.java:102)
            at org.springframework.aop.framework.JdkDynamicAopPro xy.getProxy(JdkDynamicAopProxy.java:92)
            at org.springframework.aop.framework.ProxyFactoryBean .newPrototypeInstance(ProxyFactoryBean.java:267)

            Comment


            • #7
              why do I need to pass class to the AlternateClassPathXmlAppl

              Hi there,
              Why do I need to pass a class to the AlternateClassPathXmlApplicationContext?
              Please help, Spring + Eclipse RCP is killing me...

              thanks
              rp

              Comment

              Working...
              X