Hi Krzysztof,

the generated Import-Packages have not changed but understandably so. The
bean configuration containing the JndiObjectFactoryBean is not managed by
the container but the spring context is loaded on startup from external
file via local applicationContext. As a result Karaf/ServiceMix is not
aware of the referenced classes in the beans. This worked already, as long
as I hadn't set the options cache=false, lookUpOnStartUp=false and
proxyInterface but due to startup order issues caused by refactoring ot the
datasource setup (switching to pax-jdbc) the datasource may have not been
initialized when the applicationContexts are created. As a result the whole
context will fail. I thought to get around this by configuring the proxy
within the JndiObjectBeanFactory. So unfortunately I do not see what other
package may be missing and the spring error message is not helpful.

If you have any other idea I would be interested.

Thanks and Regards,
Michael

2015-02-02 16:21 GMT+01:00 Krzysztof Sobkowiak <krzys.sobkow...@gmail.com>:

> Hi
>
> Could you please enable dynamic imports for your bundle, refresh it and
> check which packages have been imported?
>
> dev:dynamic-import xyz
> osgi:refresh xyz
> osgi:headers xyz
>
> where xyz is id of your bundle. Compare it with your current imports.
>
> Regards
> Krzysztof
>
>
> On 02.02.2015 14:53, Michael Täschner wrote:
> > Hi ServiceMix Users,
> >
> > I ran into the "SpringProxy is not visible from class loader" issue
> > discussed a couple years ago in a different context were I configure a
> > JndiObject to be resolved later (when the contained reference is
> resolved).
> >
> > Here the example config (excerpt):
> > <bean id="dataSource"
> > class="org.springframework.jndi.JndiObjectFactoryBean" lazy-init="true" >
> > <property name="jndiName" value="osgi:service/javax.sql.DataSource/(
> > osgi.jndi.service.name=jdbc/isbPortal)" />
> > <property name="cache" value="false"/>
> > <property name="lookupOnStartup" value="false" />
> > <property name="proxyInterface" value="javax.sql.DataSource"/>
> > </bean>
> >
> > The following imports are declared for maven-bundle-plugin (via
> referenced
> > bnd file):
> > Import-Package:  \
> > javax.sql;resolution:=optional,\
> > org.aopalliance.aop,\
> > org.springframework.aop,\
> > org.springframework.aop.framework,\
> > org.springframework.jndi,\
> > org.springframework.beans.factory.support,\
> > *
> >
> > But on Spring Context Creation the following stack is created:
> > ...
> > Caused by: java.lang.IllegalArgumentException: interface
> > org.springframework.aop.SpringProxy is not visible from class loader
> > at java.lang.reflect.Proxy$ProxyClassFactory.apply(Proxy.java:615)
> > [na:1.7.0_60]
> > at java.lang.reflect.Proxy$ProxyClassFactory.apply(Proxy.java:591)
> > [na:1.7.0_60]
> > at java.lang.reflect.WeakCache$Factory.get(WeakCache.java:244)
> [na:1.7.0_60]
> > at java.lang.reflect.WeakCache.get(WeakCache.java:141) [na:1.7.0_60]
> > at java.lang.reflect.Proxy.getProxyClass0(Proxy.java:454) [na:1.7.0_60]
> > at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:736) [na:1.7.0_60]
> > at
> >
> org.springframework.aop.framework.JdkDynamicAopProxy.getProxy(JdkDynamicAopProxy.java:119)
> > [org.apache.servicemix.bundles.spring-aop:3.2.11.RELEASE_1]
> > at
> >
> org.springframework.aop.framework.ProxyFactory.getProxy(ProxyFactory.java:109)
> > [org.apache.servicemix.bundles.spring-aop:3.2.11.RELEASE_1]
> > at
> >
> org.springframework.jndi.JndiObjectFactoryBean$JndiObjectProxyFactory.createJndiObjectProxy(JndiObjectFactoryBean.java:339)
> > [org.apache.servicemix.bundles.spring-context:3.2.11.RELEASE_1]
> > at
> >
> org.springframework.jndi.JndiObjectFactoryBean$JndiObjectProxyFactory.access$000(JndiObjectFactoryBean.java:304)
> > [org.apache.servicemix.bundles.spring-context:3.2.11.RELEASE_1]
> > at
> >
> org.springframework.jndi.JndiObjectFactoryBean.afterPropertiesSet(JndiObjectFactoryBean.java:200)
> > [org.apache.servicemix.bundles.spring-context:3.2.11.RELEASE_1]
> > at
> >
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1573)
> > [org.apache.servicemix.bundles.spring-beans:3.2.11.RELEASE_1]
> > at
> >
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1511)
> > [org.apache.servicemix.bundles.spring-beans:3.2.11.RELEASE_1]
> > ... 60 common frames omitted
> >
> > Using ServiceMix 5.3.1 with spring/3.2.11.RELEASE_1 feature installed.
> >
> > Any idea what I am missing ?
> >
> > Thanks and Regards,
> > Michael
> >
>
> --
> Krzysztof Sobkowiak
>
> JEE & OSS Architect | Senior Solution Architect @ Capgemini | Committer
> @ ASF
> Capgemini <http://www.pl.capgemini.com/> | Software Solutions Center
> <http://www.pl.capgemini-sdm.com/> | Wroclaw
> e-mail: krzys.sobkow...@gmail.com <mailto:krzys.sobkow...@gmail.com> |
> Twitter: @KSobkowiak
> Calendar: http://goo.gl/yvsebC
>

Reply via email to