mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Antonio Maria (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DIRMINA-1053) Osgi error when disposing NioSocketAccessor
Date Tue, 08 Nov 2016 10:01:10 GMT

    [ https://issues.apache.org/jira/browse/DIRMINA-1053?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15647108#comment-15647108
] 

Antonio Maria commented on DIRMINA-1053:
----------------------------------------

I was wrong in my assumptions. It's possible to export classes having inner class.
For example I tested in simple bundle activator:
{code}
SimpleBufferAllocator simple = new SimpleBufferAllocator()
simple.wrap(ByteBuffer.allocate(1))
{code}
and it's work out of the box.

The key is to instruct maven-bundle-plugin to export all packages hierarchy.

For example this could be more generic solution for mina-core/pom.xml:
{code}
<plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <inherited>true</inherited>
        <extensions>true</extensions>
        <configuration>
          <manifestLocation>META-INF</manifestLocation>
          <instructions>
            <Bundle-SymbolicName>${project.groupId}.core</Bundle-SymbolicName>
             <Export-Package>
              org.apache.mina.core*;version=${project.version};-noimport:=true,
              org.apache.mina.filter*;version=${project.version};-noimport:=true,
              org.apache.mina.handler*;version=${project.version};-noimport:=true,
              org.apache.mina.proxy*;version=${project.version};-noimport:=true,
              org.apache.mina.transport*;version=${project.version};-noimport:=true,
              org.apache.mina.util*;version=${project.version};-noimport:=true
            </Export-Package>
{code}



> Osgi error when disposing NioSocketAccessor
> -------------------------------------------
>
>                 Key: DIRMINA-1053
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-1053
>             Project: MINA
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.0.16
>            Reporter: Antonio Maria
>
> This exception is raised when disposing a NioProcessor in osgy environments.
> {code}
> 2016-11-07 08:50:21,767 | WARN  | NioSocketAcceptor-1                               
              |           org.apache.mina.core.service.SimpleIoProcessorPool | 100 - org.apache.mina.core
- 2.0.13.1 | Failed to dispose the NioProcessor IoProcessor.
> java.lang.IllegalStateException: Unknown protocol: mvn
> 	at org.apache.felix.framework.URLHandlersStreamHandlerProxy.toExternalForm(URLHandlersStreamHandlerProxy.java:482)
> 	at org.apache.felix.framework.URLHandlersStreamHandlerProxy.toExternalForm(URLHandlersStreamHandlerProxy.java:474)
> 	at java.net.URL.toExternalForm(URL.java:929)
> 	at java.net.URL.toString(URL.java:915)
> 	at java.lang.ClassLoader.defineClassSourceLocation(ClassLoader.java:678)
> 	at java.lang.ClassLoader.defineClass(ClassLoader.java:762)
> 	at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.defineClass(BundleWiringImpl.java:2370)
> 	at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.findClass(BundleWiringImpl.java:2154)
> 	at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1542)
> 	at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:79)
> 	at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:2018)
> 	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
> 	at org.apache.mina.core.polling.AbstractPollingIoProcessor.startupProcessor(AbstractPollingIoProcessor.java:438)
> 	at org.apache.mina.core.polling.AbstractPollingIoProcessor.dispose(AbstractPollingIoProcessor.java:182)
> 	at org.apache.mina.core.service.SimpleIoProcessorPool.dispose(SimpleIoProcessorPool.java:329)
> 	at org.apache.mina.core.polling.AbstractPollingIoAcceptor$Acceptor.run(AbstractPollingIoAcceptor.java:508)
> 	at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)
> 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
> 	at java.lang.Thread.run(Thread.java:745)
> {code}
> The root causes resides how the osgi manifest descriptor is created.
> In  mina-core/pom.xml Maven-bundle-plugin definition
> {code}
> <Export-Package>
>    org.apache.mina.core.polling;version=${project.version};-noimport:=true,
> </Export-Package>
> {code}
> Therefore: org.apache.mina.core.polling.AbstractPollingIoProcessor is exported, but this
class has a private internal class AbstractPollingIoProcessor.Processor that should be exported
as well. But It's kind of contraction to export a private class, so the osgi classpath mechanism
fails with IllegalState.
> One way to approach this problem is changing the pom.xml so:
> {code}
> ...
> <Private-Package>
>    org.apache.mina.core.polling
> </Private-Package>
> ...
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message