On Tue, Jun 21, 2011 at 12:06 PM, Isuru Suriarachchi <[email protected]> wrote:
> I think when the framework tries to start the bundle for the first time,
> some exception may have occurred. In that case, it will try a second time as
> well. Catch a Throwable in your activator's start method and print the stack
> trace to find out what goes wrong in the first time.


+1

> Thanks,
> ~Isuru
>
> On Tue, Jun 21, 2011 at 11:48 AM, Amila Jayasekara <[email protected]> wrote:
>>
>> Hi All,
>>
>> I am in the process of doing some changes to apacheds component. While
>> doing those changes i came across following issue.
>>
>> I am having a bundle activator
>> (org.wso2.carbon.ldap.server.DirectoryActivator) in my component and
>> due to some reason the bundle activator is getting called twice. By
>> further investigating i found out that OSGI framework is creating 2
>> "BundleActivator" objects (See "Object id" message in output in [1])
>> and then calling Activator's "start" method separately. I purposefully
>> add code to print calling stack [1].
>>
>> Has anyone encountered this issue before ? (OR is this an expected
>> behaviour ?)
>> Any idea, how i can resolve this issue ?
>>
>> Thanks
>> AmilaJ
>>
>> [1]
>>
>> [2011-06-21 11:35:19,337]  INFO
>> {org.wso2.carbon.core.internal.CarbonCoreActivator} -  User
>>  : amila, en-US, Asia/Colombo
>> [2011-06-21 11:35:19,493]  INFO
>> {org.wso2.carbon.ldap.server.configuration.LDAPConfigurationBuilder} -
>>  KDC server is disabled.
>> Object id - org.wso2.carbon.ldap.server.DirectoryActivator@5d1d20d3
>> java.lang.Exception: Stack trace
>>        at java.lang.Thread.dumpStack(Thread.java:1206)
>>        at
>> org.wso2.carbon.ldap.server.DirectoryActivator.startLdapServer(DirectoryActivator.java:208)
>>        at
>> org.wso2.carbon.ldap.server.DirectoryActivator.start(DirectoryActivator.java:83)
>>        at
>> org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:782)
>>        at java.security.AccessController.doPrivileged(Native Method)
>>        at
>> org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:773)
>>        at
>> org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:754)
>>        at
>> org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:352)
>>        at
>> org.eclipse.osgi.framework.internal.core.AbstractBundle.resume(AbstractBundle.java:370)
>>        at
>> org.eclipse.osgi.framework.internal.core.Framework.resumeBundle(Framework.java:1068)
>>        at
>> org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:557)
>>        at
>> org.eclipse.osgi.framework.internal.core.StartLevelManager.incFWSL(StartLevelManager.java:464)
>>        at
>> org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:248)
>>        at
>> org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:445)
>>        at
>> org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:220)
>>        at
>> org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:330)
>> [2011-06-21 11:35:19,603]  INFO
>> {org.wso2.carbon.ldap.server.DirectoryActivator} -  Initializing
>> Directory Server with working directory
>>
>> /home/amila/development/wso2/carbon/trunk/core/distribution/target/wso2carbon-core-3.2.0-SNAPSHOT/repository/data/org.wso2.carbon.directory
>> and port 10389
>> [2011-06-21 11:35:22,737]  INFO
>> {org.wso2.carbon.ldap.server.configuration.LDAPConfigurationBuilder} -
>>  KDC server is disabled.
>> Object id - org.wso2.carbon.ldap.server.DirectoryActivator@4283df14
>> java.lang.Exception: Stack trace
>>        at java.lang.Thread.dumpStack(Thread.java:1206)
>>        at
>> org.wso2.carbon.ldap.server.DirectoryActivator.startLdapServer(DirectoryActivator.java:208)
>>        at
>> org.wso2.carbon.ldap.server.DirectoryActivator.start(DirectoryActivator.java:83)
>>        at
>> org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:782)
>>        at java.security.AccessController.doPrivileged(Native Method)
>>        at
>> org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:773)
>>        at
>> org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:754)
>>        at
>> org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:352)
>>        at
>> org.eclipse.osgi.framework.internal.core.AbstractBundle.resume(AbstractBundle.java:370)
>>        at
>> org.eclipse.osgi.framework.internal.core.Framework.resumeBundle(Framework.java:1068)
>>        at
>> org.eclipse.osgi.framework.internal.core.StartLevelManager.setBundleSL(StartLevelManager.java:691)
>>        at
>> org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:442)
>>        at
>> org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:220)
>>        at
>> org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:330)
>> [2011-06-21 11:35:22,738]  INFO
>> {org.wso2.carbon.ldap.server.DirectoryActivator} -  Initializing
>> Directory Server with working directory
>>
>> /home/amila/development/wso2/carbon/trunk/core/distribution/target/wso2carbon-core-3.2.0-SNAPSHOT/repository/data/org.wso2.carbon.directory
>> and port 10389
>> [2011-06-21 11:35:22,744] ERROR
>> {org.apache.directory.server.ldap.LdapServer} -  ERR_171 Failed to
>> bind an LDAP service (10,389) to the service registry.
>> java.net.BindException: Address already in use
>>        at sun.nio.ch.Net.bind(Native Method)
>>        ....
>>        ....
>> _______________________________________________
>> Carbon-dev mailing list
>> [email protected]
>> http://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev
>
>
>
> --
> Isuru Suriarachchi
> Technical Lead & Product Manager, WSO2 Application Server
> WSO2 Inc. http://wso2.com
> email : [email protected]
> blog : http://isurues.wordpress.com/
>
> lean . enterprise . middleware
>
>
> _______________________________________________
> Carbon-dev mailing list
> [email protected]
> http://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev
>
>



-- 
Pradeep Fernando
Software Engineer
WSO2 Inc; http://wso2.com/

blog: http://pradeepfernando.blogspot.com/
m: +94776603662
_______________________________________________
Carbon-dev mailing list
[email protected]
http://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev

Reply via email to