You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Jean-Baptiste Onofré <jb...@nanthrax.net> on 2018/07/25 19:15:26 UTC

Re: ***UNCHECKED*** Re: java.lang.NoClassDefFoundError: org/apache/karaf/specs/locator/OsgiLocator when running as Service on RedHat 7.5

Hi Oleg,

that's part of the fix but I also aligned the wrapper conf with the one
used in  bin/karaf.

Regarding Karaf 4.2.1, it's planned for the end of this week/beginning
of next week.

Regards
JB

On 25/07/2018 19:05, Oleg Cohen wrote:
> Hi JB,
> 
> Thank you! For now I actually went into etc/karaf-wrapper.conf and added
> this one
> 
> wrapper.java.classpath.3=%KARAF_BASE%/lib/endorsed/*.jar
> 
> It works good now.
> 
> BTW, when is the 4.2.1 release scheduled for?
> 
> Best,
> Oleg
> 
>> On Jul 25, 2018, at 10:52 AM, jb@nanthrax.net <ma...@nanthrax.net>
>> wrote:
>>
>> Hi Oleg,
>>
>> I fixed on a local branch. Any system using wrapper is impacted (it
>> doesn't matter if it's Linux or Windows).
>>
>> I will create the PR tonight and it will be fixed on master soon.
>>
>> Regards
>> JB
>>
>> On Wednesday, July 25, 2018 12:40 CEST, Oleg Cohen
>> <oleg.cohen@assurebridge.com <ma...@assurebridge.com>> wrote:
>>  
>>>  
>> Same with me on Linux. Only happens with the service wrapper. Is there
>> a quick fix I can apply aside from copying the jar? I guess I need to
>> add endorsed libs somehow. JB mentioned it is fixed already. Main branch? 
>>  
>> Thank you,
>> Oleg
>>
>> On Jul 24, 2018, at 3:39 PM, Leschke, Scott <SLeschke@medline.com
>> <ma...@medline.com>> wrote:
>>  
>>> Hi Oleg,
>>>
>>>  
>>>
>>> I’m the person who originally reported the issue that JB is referring
>>> to.  In my case on Windows, Karaf appears to work fine as well but
>>> there is that error in the log that only occurs when you start Karaf
>>> using the service wrapper.
>>>
>>>  
>>>
>>> Regards,
>>> Scott
>>>
>>>  
>>>
>>> *From:* Oleg Cohen [mailto:oleg.cohen@assurebridge.com]
>>> *Sent:* Tuesday, July 24, 2018 2:01 PM
>>> *To:* user@karaf.apache.org <ma...@karaf.apache.org>
>>> *Subject:* Re: java.lang.NoClassDefFoundError:
>>> org/apache/karaf/specs/locator/OsgiLocator when running as Service on
>>> RedHat 7.5
>>>
>>>  
>>>
>>> Hi JB,
>>>
>>>  
>>>
>>> I am using the wrapper. bin/karaf works fine.
>>>
>>>  
>>>
>>> Thank you!
>>> Oleg
>>>
>>>  
>>> On Jul 24, 2018, at 2:58 PM, Jean-Baptiste Onofré <jb@nanthrax.net
>>> <ma...@nanthrax.net>> wrote:
>>>
>>>  
>>>
>>> Maybe it's related to:
>>>
>>> https://issues.apache.org/jira/browse/KARAF-5840 (I already have a fix
>>> on a local branch)
>>>
>>> The problem only occurs when using the wrapper.
>>>
>>> @Oleg/Miroslav: do you use wrapper to start Karaf instead of bin/karaf ?
>>>
>>> Regards
>>> JB
>>>
>>> On 24/07/2018 20:54, Francois Papon wrote:
>>>  
>>> Hi,
>>>
>>> It's weird because I downloaded the binary and after extract it, I can
>>> see the org.apache.karaf.specs.locator-4.2.0.jar in the lib/endorsed
>>> directory.
>>>
>>> regards,
>>>
>>> François Papon
>>> fpapon@apache.org <ma...@apache.org>
>>>
>>> Le 24/07/2018 à 22:31, Oleg Cohen a écrit :
>>>  
>>> Hi Miroslav,
>>>
>>> I think I found the issue. You are right a JAR is missing.
>>>
>>> I built org.apache.karaf.specs.locator-4.2.0.jar and added it to the
>>> boot/lib folder and the exception is now gone.
>>>
>>> Thank you!
>>> Oleg
>>>
>>>
>>>  
>>> On Jul 24, 2018, at 11:45 AM, Miroslav Beranič
>>> <miroslav.beranic@mibesis.si
>>> <ma...@mibesis.si> <ma...@mibesis.si>>
>>> wrote:
>>>
>>> Hi Oleg,
>>>
>>> I've just downloaded package from:
>>>
>>> http://karaf.apache.org/download.html
>>> Binary Distribution : tar.gz [PGP] [SHA512]
>>>
>>> I've downloaded to /opt/ folder and unpacked the package.
>>>
>>> I am using RHEL 7.5, Oracle Java 8 ( 1.8.0.172 )
>>>
>>> Next I've started Karf with:
>>>
>>> [root@framework apache-karaf-4.2.0]# ls -al
>>> total 424
>>> drwxr-xr-x. 9 root root    156 jul 24 17:35 .
>>> drwxr-xr-x. 4 root root    110 jul 24 17:35 ..
>>> drwxr-xr-x. 3 root root    282 apr  5 06:29 bin
>>> drwxr-xr-x. 3 root root     17 apr  5 06:29 data
>>> drwxr-xr-x. 9 root root    123 apr  5 06:29 demos
>>> drwxr-xr-x. 2 root root     20 apr  5 06:29 deploy
>>> drwxr-xr-x. 3 root root   4096 apr  5 06:29 etc
>>> drwxr-xr-x. 5 root root     59 apr  5 06:29 lib
>>> -rw-r--r--. 1 root root  27754 apr  5 06:29 LICENSE
>>> -rw-r--r--. 1 root root   1829 apr  5 06:29 NOTICE
>>> -rw-r--r--. 1 root root   4025 apr  5 06:29 README
>>> -rw-r--r--. 1 root root 390829 apr  5 06:29 RELEASE-NOTES
>>> drwxr-xr-x. 3 root root     31 apr  5 06:29 system
>>> [root@framework apache-karaf-4.2.0]# JAVA_HOME=/opt/jdk ./bin/karaf debug
>>> Listening for transport dt_socket at address: 5005
>>>         __ __                  ____      
>>>        / //_/____ __________ _/ __/      
>>>       / ,<  / __ `/ ___/ __ `/ /_        
>>>      / /| |/ /_/ / /  / /_/ / __/        
>>>     /_/ |_|\__,_/_/   \__,_/_/         
>>>
>>>   Apache Karaf (4.2.0)
>>>
>>> Hit '<tab>' for a list of available commands
>>> and '[cmd] --help' for help on a specific command.
>>> Hit '<ctrl-d>' or type 'system:shutdown' or 'logout' to shutdown Karaf.
>>>
>>> karaf@root()> feature:install
>>> service-wrapper                                                                                                                                                                     
>>>  
>>> karaf@root()> wrapper:install
>>> Creating file: /opt/apache-karaf-4.2.0/bin/karaf-wrapper
>>> Creating file: /opt/apache-karaf-4.2.0/bin/karaf-service
>>> Creating file: /opt/apache-karaf-4.2.0/bin/karaf.service
>>> Creating file: /opt/apache-karaf-4.2.0/etc/karaf-wrapper.conf
>>> Creating missing directory: /opt/apache-karaf-4.2.0/lib/wrapper
>>> Creating file: /opt/apache-karaf-4.2.0/lib/wrapper/libwrapper.so
>>> Creating file: /opt/apache-karaf-4.2.0/lib/wrapper/karaf-wrapper.jar
>>> Creating file: /opt/apache-karaf-4.2.0/lib/wrapper/karaf-wrapper-main.jar
>>>
>>> Setup complete.  You may wish to tweak the JVM properties in the
>>> wrapper configuration file:
>>>     /opt/apache-karaf-4.2.0/etc/karaf-wrapper.conf
>>> before installing and starting the service.
>>>
>>>
>>> RedHat/Fedora/CentOS Linux system detected (SystemV):
>>>   To install the service:
>>>     $ ln -s /opt/apache-karaf-4.2.0/bin/karaf-service /etc/init.d/
>>>     $ chkconfig karaf-service --add
>>>
>>>   To start the service when the machine is rebooted:
>>>     $ chkconfig karaf-service on
>>>
>>>   To disable starting the service when the machine is rebooted:
>>>     $ chkconfig karaf-service off
>>>
>>>   To start the service:
>>>     $ service karaf-service start
>>>
>>>   To stop the service:
>>>     $ service karaf-service stop
>>>
>>>   To uninstall the service :
>>>     $ chkconfig karaf-service --del
>>>     $ rm /etc/init.d/karaf-service
>>>
>>> For systemd compliant Linux:
>>>   To install the service (and enable at system boot):
>>>    $ systemctl enable /opt/apache-karaf-4.2.0/bin/karaf.service
>>>
>>>   To start the service:
>>>    $ systemctl start karaf
>>>
>>>   To stop the service:
>>>    $ systemctl stop karaf
>>>
>>>   To check the current service status:
>>>    $ systemctl status karaf
>>>
>>>   To see service activity journal:
>>>    $ journalctl -u karaf
>>>
>>>   To uninstall the service (and disable at system boot):
>>>    $ systemctl disable karaf
>>> karaf@root()>                                                                                                                                                                                                     
>>>  
>>> karaf@root()>                                                                                                                                                                                                     
>>>  
>>>
>>> I've exited Karaf shell here ( with Ctrl + D )
>>>
>>>
>>> [root@framework apache-karaf-4.2.0]# ^C
>>> [root@framework apache-karaf-4.2.0]# ln -s
>>> /opt/apache-karaf-4.2.0/bin/karaf-service /etc/init.d/
>>> [root@framework apache-karaf-4.2.0]# chkconfig karaf-service --add
>>> [root@framework apache-karaf-4.2.0]# chkconfig karaf-service on
>>> [root@framework apache-karaf-4.2.0]# service karaf-service start
>>> Starting karaf...
>>> [root@framework apache-karaf-4.2.0]# reboot
>>>
>>> Now you can go back to terminal or connect over ssh --- I use SSH :
>>>
>>> so now I ssh to Karaf with:
>>>
>>> # ssh -p 8101 karaf@framework
>>> The authenticity of host '[localhost]:8101 ([::1]:8101)' can't be
>>> established.
>>> RSA key fingerprint is SHA256:g
>>> RSA key fingerprint is MD5:fc:b5:ed:9
>>> Are you sure you want to continue connecting (yes/no)? yes
>>> Warning: Permanently added '[localhost]:8101' (RSA) to the list of
>>> known hosts.
>>> Password authentication
>>> Password:
>>>         __ __                  ____     
>>>        / //_/____ __________ _/ __/     
>>>       / ,<  / __ `/ ___/ __ `/ /_       
>>>      / /| |/ /_/ / /  / /_/ / __/       
>>>     /_/ |_|\__,_/_/   \__,_/_/        
>>>
>>>   Apache Karaf (4.2.0)
>>>
>>> Hit '<tab>' for a list of available commands
>>> and '[cmd] --help' for help on a specific command.
>>> Hit 'system:shutdown' to shutdown Karaf.
>>> Hit '<ctrl-d>' or type 'logout' to disconnect shell from current session.
>>>
>>> karaf@root()> log:tail
>>> 17:39:21.456 INFO [activator-1-thread-2] Registering commands for
>>> bundle org.apache.karaf.log.core/4.2.0
>>>
>>>
>>>
>>> I hope this is of any help.
>>>
>>> Kind Regards,
>>> Miroslav
>>>
>>>
>>>
>>> 2018-07-24 17:34 GMT+02:00 Oleg Cohen <oleg.cohen@assurebridge.com
>>> <ma...@assurebridge.com>
>>> <ma...@assurebridge.com>>:
>>>
>>>    Hi Miroslav,
>>>
>>>    Java is version 1.8
>>>
>>>    ava version "1.8.0_172"
>>>    Java(TM) SE Runtime Environment (build 1.8.0_172-b11)
>>>    Java HotSpot(TM) 64-Bit Server VM (build 25.172-b11, mixed mode)
>>>
>>>    Thank you!
>>>    Oleg
>>>
>>>
>>>  
>>>    On Jul 24, 2018, at 11:30 AM, Miroslav Beranič
>>>    <miroslav.beranic@mibesis.si <ma...@mibesis.si>
>>>    <ma...@mibesis.si>> wrote:
>>>
>>>    Hi Oleg,
>>>
>>>    one more question - what version of Java do you use?
>>>
>>>    Kind Regards,
>>>    Miroslav
>>>
>>>
>>>    2018-07-24 17:28 GMT+02:00 Miroslav Beranič
>>>    <miroslav.beranic@mibesis.si
>>> <ma...@mibesis.si> <ma...@mibesis.si>>:
>>>
>>>        Hi Oleg,
>>>
>>>        well, I've never installed from here ( I did not even looked
>>>        before).
>>>        Will try it for my self also. In Git repository I used 4.1.x
>>>        and 4.2.x.
>>>
>>>        I guess 4.1.x is more "stable" for production. I've just
>>>        started using 4.2. I was on 4.0.9 till previous week. I am
>>>        doing upgrade across nodes.
>>>
>>>
>>>        Kind Regards,
>>>        Miroslav
>>>
>>>
>>>        2018-07-24 17:21 GMT+02:00 Oleg Cohen
>>>        <oleg.cohen@assurebridge.com <ma...@assurebridge.com>
>>>        <ma...@assurebridge.com>>:
>>>
>>>            Hi Miroslav,
>>>
>>>            I got apache-karaf-4.2.0.tar.gz binary distribution from
>>>            here http://karaf.apache.org/download.html
>>>            <http://karaf.apache.org/download.html>
>>>
>>>            I can definitely try building from Git. Let me try …
>>>
>>>            Thank you!
>>>            Oleg
>>>
>>>  
>>>            On Jul 24, 2018, at 11:17 AM, Miroslav Beranič
>>>            <miroslav.beranic@mibesis.si
>>> <ma...@mibesis.si>
>>>            <ma...@mibesis.si>> wrote:
>>>
>>>            Hi Oleg,
>>>
>>>            where from did you deployed Karaf? You build it from
>>>            the source or some pre-compiled package/distribution?
>>>
>>>            In general this is saying you are missing JAR ( but I
>>>            guess you know already this ).
>>>
>>>            ( I've deployed multiple times - in past week - Karaf
>>>            on RHEL 7.5 and I had no such problem - but I was
>>>            building from the GitHub git repository )
>>>
>>>            Kind Regards,
>>>            Miroslav
>>>
>>>
>>>            2018-07-24 17:11 GMT+02:00 Oleg Cohen
>>>            <oleg.cohen@assurebridge.com
>>> <ma...@assurebridge.com>
>>>            <ma...@assurebridge.com>>:
>>>
>>>                Greetings,
>>>
>>>                I have deployed Karaf v4.2.0 into a Linux RH 7.5
>>>                server.
>>>
>>>                When I run Karaf as a service I get the following
>>>                error in the log multiple times:
>>>
>>>
>>>                2018-07-24T11:07:12,176 | ERROR |
>>>                features-3-thread-1 | Felix                        
>>>                   |  -  -  | Bundle org.apache.felix.framework [0]
>>>                EventDispatcher: Error during dispatch.
>>>                (*java.lang.NoClassDefFoundError:
>>>                org/apache/karaf/specs/locator/OsgiLocator*)
>>>                java.lang.NoClassDefFoundError:
>>>                org/apache/karaf/specs/locator/OsgiLocator
>>>                at
>>>                org.apache.karaf.specs.activator.Activator.register(Activator.java:124)
>>>                ~[?:?]
>>>                at
>>>                org.apache.karaf.specs.activator.Activator.bundleChanged(Activator.java:96)
>>>                ~[?:?]
>>>                at
>>>                org.apache.felix.framework.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:915)
>>>                ~[?:?]
>>>                at
>>>                org.apache.felix.framework.EventDispatcher.fireEventImmediately(EventDispatcher.java:834)
>>>                ~[?:?]
>>>                at
>>>                org.apache.felix.framework.EventDispatcher.fireBundleEvent(EventDispatcher.java:516)
>>>                ~[?:?]
>>>                at
>>>                org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4579)
>>>                ~[?:?]
>>>                at
>>>                org.apache.felix.framework.StatefulResolver.fireResolvedEvents(StatefulResolver.java:1289)
>>>                ~[?:?]
>>>                at
>>>                org.apache.felix.framework.StatefulResolver.resolve(StatefulResolver.java:512)
>>>                ~[?:?]
>>>                at
>>>                org.apache.felix.framework.Felix.resolveBundles(Felix.java:4108)
>>>                ~[?:?]
>>>                at
>>>                org.apache.felix.framework.FrameworkWiringImpl.resolveBundles(FrameworkWiringImpl.java:133)
>>>                ~[?:?]
>>>                at
>>>                org.apache.karaf.features.internal.service.BundleInstallSupportImpl.resolveBundles(BundleInstallSupportImpl.java:240)
>>>                ~[?:?]
>>>                at
>>>                org.apache.karaf.features.internal.service.FeaturesServiceImpl.resolveBundles(FeaturesServiceImpl.java:1131)
>>>                ~[?:?]
>>>                at
>>>                org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:982)
>>>                ~[?:?]
>>>                at
>>>                org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1025)
>>>                ~[?:?]
>>>                at
>>>                org.apache.karaf.features.internal.service.FeaturesServiceImpl.lambda$doProvisionInThread$13(FeaturesServiceImpl.java:964)
>>>                ~[?:?]
>>>                at
>>>                java.util.concurrent.FutureTask.run(FutureTask.java:266)
>>>                [?:?]
>>>                at
>>>                java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
>>>                [?:?]
>>>                at
>>>                java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
>>>                [?:?]
>>>                at java.lang.Thread.run(Thread.java:748) [?:?]
>>>
>>>                I would appreciate help with fixing this problem of
>>>                finding a workaround!
>>>
>>>                Best,
>>>                Oleg
>>>
>>>
>>>
>>>
>>>            -- 
>>>            Miroslav Beranič
>>>            MIBESIS
>>>            +386(0)40/814-843
>>>            miroslav.beranic@mibesis.si
>>> <ma...@mibesis.si>
>>>            <ma...@mibesis.si>
>>>            http://www.mibesis.si
>>> <http://www.mibesis.si/> <http://www.mibesis.si/>
>>>
>>>
>>>
>>>
>>>        -- 
>>>        Miroslav Beranič
>>>        MIBESIS
>>>        +386(0)40/814-843
>>>        miroslav.beranic@mibesis.si
>>> <ma...@mibesis.si> <ma...@mibesis.si>
>>>        http://www.mibesis.si
>>> <http://www.mibesis.si/> <http://www.mibesis.si/>
>>>
>>>
>>>
>>>
>>>    -- 
>>>    Miroslav Beranič
>>>    MIBESIS
>>>    +386(0)40/814-843
>>>    miroslav.beranic@mibesis.si
>>> <ma...@mibesis.si> <ma...@mibesis.si>
>>>    http://www.mibesis.si
>>> <http://www.mibesis.si/> <http://www.mibesis.si/>
>>>
>>>
>>>
>>>
>>> -- 
>>> Miroslav Beranič
>>> MIBESIS
>>> +386(0)40/814-843
>>> miroslav.beranic@mibesis.si
>>> <ma...@mibesis.si> <ma...@mibesis.si>
>>> http://www.mibesis.si <http://www.mibesis.si/> <http://www.mibesis.si/>
> 

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com