users@glassfish.java.net

Re: spring component-scan problem in packed osgi WAB

From: Sahoo <sanjeeb.sahoo_at_oracle.com>
Date: Thu, 09 Feb 2012 09:18:58 +0530

Hi,

I thought you solved your problem as you mentioned in [1]. Or, are you
now facing the next problem?

When you deploy using "asadmin deploy --type osgi ...," GlassFish does
explode the bundle in file system before installing it OSGi runtime, but
that would not result in OSGi runtime to return you file: URLs when you
look for resources from OSGi bundle. You could verify it yourself by
connecting using osgi shell and seeing the bundle location. You would
find it using reference: protocol So, that's what is happening here as
well. I am afraid Spring has to be more intelligent in handling URL
resources. e.g., we have enhanced eclipselink to be able to discover
entities even if returned URLs are not file: or jarfile: based.

[1] http://forums.java.net/node/883164

On Wednesday 08 February 2012 10:06 PM, forums_at_java.net wrote:
> Update: I tried to deploy an open war as bundle (using "asadmin deploy
> --type OSGI" command), and received the same exception:
>
>
>
> 2012-02-08 18:30:23,194 [pool-28-thread-1]
> (PathMatchingResourcePatternResolver.java:532) WARN - Cannot search for
> matching files underneath URL [bundle://275.0:2/examples/services/]
> because
> it does not correspond to a directory in the file system
> java.io.FileNotFoundException: URL [bundle://275.0:2/examples/services/]
> cannot be resolved to absolute file path because it does not reside in
> the
> file system: bundle://275.0:2/examples/services/ at
> org.springframework.util.ResourceUtils.getFile(ResourceUtils.java:204) at
> org.springframework.core.io.AbstractFileResolvingResource.getFile(AbstractFileResolvingResource.java:52)
>
> at
> org.springframework.core.io.UrlResource.getFile(UrlResource.java:168) at
> org.springframework.core.io.support.PathMatchingResourcePatternResolver.doFindPathMatchingFileResources(PathMatchingResourcePatternResolver.java:528)
>
> ... 2012-02-08 18:30:23,194 [pool-28-thread-1]
> (PathMatchingResourcePatternResolver.java:353) DEBUG - Resolved location
> pattern [classpath*:examples/services/**/*.class] to resources [] My
> spring
> applicationContext.xml looks like this: <?xml version="1.0"
> encoding="UTF-8"?> <beans
> xmlns="http://www.springframework.org/schema/beans"
> xmlns:tx="http://www.springframework.org/schema/tx"
> xmlns:context="http://www.springframework.org/schema/context"
> xmlns:task="http://www.springframework.org/schema/task"
> xsi:schemaLocation="
> http://www.springframework.org/schema/context
> http://www.springframework.org/schema/context/spring-context-3.0.xsd
> http://www.springframework.org/schema/tx
> http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
> http://www.springframework.org/schema/task
> http://www.springframework.org/schema/task/spring-task-3.0.xsd">
> <context:annotation-config/> <tx:annotation-driven />
> <context:component-scan
> base-package="examples.services" /> </beans> Is there a way to make
> "component-scan" work in osgi bundle? thank you
>
>
>
> --
>
> [Message sent by forum member 'okna2000']
>
> View Post: http://forums.java.net/node/883365
>
>