You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Christoph Emmersberger <ce...@googlemail.com> on 2013/01/30 16:35:41 UTC
Issue when linking 'karaf' command to '/usr/bin/'
Hi all,
I've been playing around with homebrew to create a formula for karaf similar to the one which is provided by tomcat. A description on how to conduct the basic steps can be found in a blog post: http://christoph-emmersberger.blogspot.de/2013/01/homebrew-formula-for-apache-karaf.html
However, when I create an additional symlink to the '/usr/bin/' directory for the 'karaf' command, I run into an issue since the command is not being executed within KARAF_HOME.
Formula:
require 'formula'
class ApacheKaraf < Formula
homepage 'http://karaf.apache.org/'
url 'http://www.eu.apache.org/dist/karaf/2.3.0/apache-karaf-2.3.0.tar.gz'
version '2.3'
sha1 'c243d39ba90543f6b0a058a183733756a797b4e5'
def install
libexec.install Dir['*']
bin.install_symlink "#{libexec}/bin/karaf" => "karaf"
end
end
Execution:
> karaf
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/karaf/main/Main
Caused by: java.lang.ClassNotFoundException: org.apache.karaf.main.Main
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Is there a convenient way to call a setenv command that redirects you to the karaf folder to get this working, maybe similar to the tomcat implementation?
Kind regards,
Christoph
Re: Issue when linking 'karaf' command to '/usr/bin/'
Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Ah,
catcha, I see your point.
Indeed, we can improve the script this way.
Regards
JB
On 01/30/2013 05:39 PM, Christoph Emmersberger wrote:
> Hi Jean-Babtiste,
>
> tanks for you're reply. Yes, I am aware of this file, I just figured that tomcat somehow can manage it to call the setenv in a dynamic way without adjusting it after the installation so that catalina symlinks work out of the box.
>
> Maybe I'll get the chance to take a look at it and propose a solution for karaf.
>
> Regards,
>
> Christoph
>
> On Jan 30, 2013, at 5:26 PM, Jean-Baptiste Onofré wrote:
>
>> Hi Christoph,
>>
>> You have bin/setenv in Karaf 2.3.x that you can use.
>>
>> It allows you to define some env variables, etc.
>>
>> Regards
>> JB
>>
>> On 01/30/2013 04:35 PM, Christoph Emmersberger wrote:
>>> Hi all,
>>>
>>> I've been playing around with homebrew to create a formula for karaf
>>> similar to the one which is provided by tomcat. A description on how to
>>> conduct the basic steps can be found in a blog post:
>>> http://christoph-emmersberger.blogspot.de/2013/01/homebrew-formula-for-apache-karaf.html
>>>
>>> However, when I create an additional symlink to the '/usr/bin/'
>>> directory for the 'karaf' command, I run into an issue since the command
>>> is not being executed within KARAF_HOME.
>>>
>>> *_Formula:_*
>>> require 'formula'
>>>
>>> class ApacheKaraf < Formula
>>> homepage 'http://karaf.apache.org/'
>>> url 'http://www.eu.apache.org/dist/karaf/2.3.0/apache-karaf-2.3.0.tar.gz'
>>> version '2.3'
>>> sha1 'c243d39ba90543f6b0a058a183733756a797b4e5'
>>>
>>> def install
>>> libexec.install Dir['*']
>>> bin.install_symlink "#{libexec}/bin/karaf" => "karaf"
>>> end
>>>
>>> end
>>>
>>> *_Execution:_*
>>>> karaf
>>> Exception in thread "main" java.lang.NoClassDefFoundError:
>>> org/apache/karaf/main/Main
>>> Caused by: java.lang.ClassNotFoundException: org.apache.karaf.main.Main
>>> at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
>>> at java.security.AccessController.doPrivileged(Native Method)
>>> at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
>>> at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
>>> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
>>> at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
>>>
>>> Is there a convenient way to call a setenv command that redirects you to
>>> the karaf folder to get this working, maybe similar to the tomcat
>>> implementation?
>>>
>>> Kind regards,
>>>
>>> Christoph
>>>
>>>
>>
>> --
>> Jean-Baptiste Onofré
>> jbonofre@apache.org
>> http://blog.nanthrax.net
>> Talend - http://www.talend.com
>
--
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com
Re: Issue when linking 'karaf' command to '/usr/bin/'
Posted by Christoph Emmersberger <ce...@googlemail.com>.
Hi Jean-Babtiste,
tanks for you're reply. Yes, I am aware of this file, I just figured that tomcat somehow can manage it to call the setenv in a dynamic way without adjusting it after the installation so that catalina symlinks work out of the box.
Maybe I'll get the chance to take a look at it and propose a solution for karaf.
Regards,
Christoph
On Jan 30, 2013, at 5:26 PM, Jean-Baptiste Onofré wrote:
> Hi Christoph,
>
> You have bin/setenv in Karaf 2.3.x that you can use.
>
> It allows you to define some env variables, etc.
>
> Regards
> JB
>
> On 01/30/2013 04:35 PM, Christoph Emmersberger wrote:
>> Hi all,
>>
>> I've been playing around with homebrew to create a formula for karaf
>> similar to the one which is provided by tomcat. A description on how to
>> conduct the basic steps can be found in a blog post:
>> http://christoph-emmersberger.blogspot.de/2013/01/homebrew-formula-for-apache-karaf.html
>>
>> However, when I create an additional symlink to the '/usr/bin/'
>> directory for the 'karaf' command, I run into an issue since the command
>> is not being executed within KARAF_HOME.
>>
>> *_Formula:_*
>> require 'formula'
>>
>> class ApacheKaraf < Formula
>> homepage 'http://karaf.apache.org/'
>> url 'http://www.eu.apache.org/dist/karaf/2.3.0/apache-karaf-2.3.0.tar.gz'
>> version '2.3'
>> sha1 'c243d39ba90543f6b0a058a183733756a797b4e5'
>>
>> def install
>> libexec.install Dir['*']
>> bin.install_symlink "#{libexec}/bin/karaf" => "karaf"
>> end
>>
>> end
>>
>> *_Execution:_*
>> > karaf
>> Exception in thread "main" java.lang.NoClassDefFoundError:
>> org/apache/karaf/main/Main
>> Caused by: java.lang.ClassNotFoundException: org.apache.karaf.main.Main
>> at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
>> at java.security.AccessController.doPrivileged(Native Method)
>> at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
>> at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
>> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
>> at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
>>
>> Is there a convenient way to call a setenv command that redirects you to
>> the karaf folder to get this working, maybe similar to the tomcat
>> implementation?
>>
>> Kind regards,
>>
>> Christoph
>>
>>
>
> --
> Jean-Baptiste Onofré
> jbonofre@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com
Re: Issue when linking 'karaf' command to '/usr/bin/'
Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Christoph,
You have bin/setenv in Karaf 2.3.x that you can use.
It allows you to define some env variables, etc.
Regards
JB
On 01/30/2013 04:35 PM, Christoph Emmersberger wrote:
> Hi all,
>
> I've been playing around with homebrew to create a formula for karaf
> similar to the one which is provided by tomcat. A description on how to
> conduct the basic steps can be found in a blog post:
> http://christoph-emmersberger.blogspot.de/2013/01/homebrew-formula-for-apache-karaf.html
>
> However, when I create an additional symlink to the '/usr/bin/'
> directory for the 'karaf' command, I run into an issue since the command
> is not being executed within KARAF_HOME.
>
> *_Formula:_*
> require 'formula'
>
> class ApacheKaraf < Formula
> homepage 'http://karaf.apache.org/'
> url 'http://www.eu.apache.org/dist/karaf/2.3.0/apache-karaf-2.3.0.tar.gz'
> version '2.3'
> sha1 'c243d39ba90543f6b0a058a183733756a797b4e5'
>
> def install
> libexec.install Dir['*']
> bin.install_symlink "#{libexec}/bin/karaf" => "karaf"
> end
>
> end
>
> *_Execution:_*
> > karaf
> Exception in thread "main" java.lang.NoClassDefFoundError:
> org/apache/karaf/main/Main
> Caused by: java.lang.ClassNotFoundException: org.apache.karaf.main.Main
> at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
>
> Is there a convenient way to call a setenv command that redirects you to
> the karaf folder to get this working, maybe similar to the tomcat
> implementation?
>
> Kind regards,
>
> Christoph
>
>
--
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com