You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Cobarzan Laura <cl...@yahoo.com> on 2009/11/19 14:33:17 UTC

Integrate log4j

Hello,

I have a simple Hello World project that uses the log4j library. What is strange is that the log4j bundle is installed and started without any problems, but it through errors saying that it cannot find the needed class (from log4j) library.
Did anyone faced already this problem?

WARNING: Failed to start Bundle[symbolic-name = 'com.javaworld.sample.HelloWorld', location = 'file:/D:/Siemens_Projects_Work/CSF_FFG/Eclipse_forFelixWrk/DA-Luncher/bundles/application-bundles/hello-world.jar']
org.dynamicjava.osgi.da_launcher.internal.exceptions.BundleInstallationException: Failed to start Bundle[symbolic-name = 'com.javaworld.sample.HelloWorld', location = 'file:/D:/Siemens_Projects_Work/CSF_FFG/Eclipse_forFelixWrk/DA-Luncher/bundles/application-bundles/hello-world.jar']: Activator start error in bundle com.javaworld.sample.HelloWorld [7].
    at org.dynamicjava.osgi.da_launcher.internal.bundle.group.DefaultBundleGroup.startBundle(DefaultBundleGroup.java:184)
    at org.dynamicjava.osgi.da_launcher.internal.bundle.group.DefaultBundleGroup.startGroupBundles(DefaultBundleGroup.java:67)
    at org.dynamicjava.osgi.da_launcher.internal.bundle.BundleGroupBasedBundleManager.activateBundleGroups(BundleGroupBasedBundleManager.java:57)
    at org.dynamicjava.osgi.da_launcher.internal.bundle.BundleGroupBasedBundleManager.run(BundleGroupBasedBundleManager.java:24)
    at org.dynamicjava.osgi.da_launcher.internal.support.DefaultLauncher.launch(DefaultLauncher.java:68)
    at org.dynamicjava.osgi.da_launcher.internal.support.DefaultLauncher.launch(DefaultLauncher.java:86)
    at org.dynamicjava.osgi.da_launcher.main.Main.run(Main.java:34)
    at org.dynamicjava.osgi.da_launcher.main.Main.main(Main.java:24)
Caused by: org.osgi.framework.BundleException: Activator start error in bundle com.javaworld.sample.HelloWorld [7].
    at org.apache.felix.framework.Felix.startBundle(Felix.java:1506)
    at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:779)
    at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:760)
    at org.dynamicjava.osgi.da_launcher.internal.bundle.group.DefaultBundleGroup.startBundle(DefaultBundleGroup.java:178)
    ... 7 more
Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/Logger
    at com.javaworld.sample.helloworld.Activator.start(Activator.java:16)
    at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:589)
    at org.apache.felix.framework.Felix.startBundle(Felix.java:1458)
    ... 10 more


Thank you,
Laura Cobarzan


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Re: Integrate log4j

Posted by Cobarzan Laura <cl...@yahoo.com>.
1) On the ps command I see all bundles are installed and active:
-> ps
START LEVEL 1
   ID   State         Level  Name
[   0] [Active     ] [    0] System Bundle (2.0.1)
[   1] [Resolved   ] [    1] HelloWorld Plug-in (1.0.0)
[   2] [Active     ] [    1] Apache Commons Logging Plug-in (1.1.1.v200904062255)
[   3] [Active     ] [    1] Apache Felix Bundle Repository (1.4.2)
[   4] [Active     ] [    1] Apache Felix Shell Service (1.4.1)
[   5] [Active     ] [    1] Apache Felix Shell TUI (1.4.1)
[   6] [Active     ] [    1] Apache Jakarta log4j Plug-in (1.2.15.v200910021404)


2) I have downloaded the log4j bundle from Orbit Download 
3) how can I check is my log4j bundle exports the classes I need?
In the jar archive I see that all the classes are there...

Thank you,
Laura C.

--- On Thu, 11/19/09, Filippo Diotalevi <fi...@gmail.com> wrote:

On Thu, Nov 19, 2009 at 2:33 PM, Cobarzan Laura <cl...@yahoo.com> wrote:
> Hello,
>
> I have a simple Hello World project that uses the log4j library. What is strange is that the log4j bundle is installed and started without any problems, but it through errors saying that it cannot find the needed class (from log4j) library.
> Did anyone faced already this problem?

Hi,
  it's difficult to say what's going wrong in your case, since log4j
works well in any OSGi environment.

A few questions to get started:
1) can you open the console and type "ps" ? The command displays the
list of installed bundles. Is the log4j bundle installed and active?
2) where did you get the log4j bundle? Is it really an OSGi bundle or
just the normal Java library?
3) can you check with the console if your log4j bundle export the
"org/apache/log4j" package?

Regards,
-- 
Filippo Diotalevi

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org




      

Re: Integrate log4j

Posted by Filippo Diotalevi <fi...@gmail.com>.
On Thu, Nov 19, 2009 at 2:33 PM, Cobarzan Laura <cl...@yahoo.com> wrote:
> Hello,
>
> I have a simple Hello World project that uses the log4j library. What is strange is that the log4j bundle is installed and started without any problems, but it through errors saying that it cannot find the needed class (from log4j) library.
> Did anyone faced already this problem?

Hi,
  it's difficult to say what's going wrong in your case, since log4j
works well in any OSGi environment.

A few questions to get started:
1) can you open the console and type "ps" ? The command displays the
list of installed bundles. Is the log4j bundle installed and active?
2) where did you get the log4j bundle? Is it really an OSGi bundle or
just the normal Java library?
3) can you check with the console if your log4j bundle export the
"org/apache/log4j" package?

Regards,
-- 
Filippo Diotalevi

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Integrate log4j

Posted by Guo Du <mr...@gmail.com>.
On Thu, Nov 19, 2009 at 1:33 PM, Cobarzan Laura <cl...@yahoo.com> wrote:
> Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/Logger
>     at com.javaworld.sample.helloworld.Activator.start(Activator.java:16)
You may try "headers" command to verify the the required packages are
installed correctly.

If it doesn't work, then post more information about your runtime:
versions, "ps" and "headers" command output (delete your private
information first)

-Guo

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org