vSphere

 View Only
  • 1.  Using bundle-classpath while debugging in eclipse

    Posted Aug 18, 2016 07:11 PM

    I have added some 3rd party jars to my project using the bundle-classpath method and it works great. My question is how do I get these jars to load while debugging in eclipse? If I open my manifest.mf file in eclipse and navigate to the runtime tab, I do see the jars added under classpath. But when I launch virgo server and add my project, it says it cannot find classes within my dependencies.

    How do I get around this?



  • 2.  RE: Using bundle-classpath while debugging in eclipse

    Broadcom Employee
    Posted Aug 19, 2016 01:48 PM

    If I understand your question:

    - your bundle's MANIFEST.MF contains  Bundle-ClassPath: .,myOtherLib.jar as described in the FAQ

    - your bundle does include myOtherLib.jar at the root

    - your plugin works fine when you start the Virgo server on the command line

    - but when you start Virgo from Eclipse you get a dependency error because it cannot find classes from myOtherLib.jar

    This is very strange, it shouldn't matter where the server was started from since it is the same plugin bundle, so I want to make sure this is your exact use case.



  • 3.  RE: Using bundle-classpath while debugging in eclipse

    Posted Aug 23, 2016 09:21 PM

    Sorry about the confusion, more information below


    - your bundle's MANIFEST.MF contains  Bundle-ClassPath: .,myOtherLib.jar as described in the FAQ

    Yes

    - your bundle does include myOtherLib.jar at the root

    It does, but not in dev mode when I my plugin is in eclipse and I am running virgo from within eclipse (there is no mypluginservice.jar yet which contains all other jars at the root level). This jar is only built when packaging for production.



  • 4.  RE: Using bundle-classpath while debugging in eclipse

    Broadcom Employee
    Posted Aug 24, 2016 02:36 PM

    There is no reason to package your bundle differently between dev and production mode.  You're looking for trouble :-)



  • 5.  RE: Using bundle-classpath while debugging in eclipse

    Posted Aug 24, 2016 05:54 PM

    Well. We actually just import the project into eclipse like any other project. Do I need to copy my dependencies into the repository/usr folder like before?



  • 6.  RE: Using bundle-classpath while debugging in eclipse

    Posted Sep 13, 2016 12:13 AM

    Hi Laurent,

    Any updates on this? As I have indicated above, when I am debugging my project in eclipse, eclipse does not generate a mypluginservice.jar which contains all other jars (this is usually done by our build script when packaging for production). If I launch Virgo in eclipse and add my plugin service project, it throws ClassNotFoundException, which indicates that my dependencies have not been loaded. I have placed all my dependency jars in the repository/usr folder. But it looks like Bundle-classpath: ., mylib1.jar, mylib2.jar does not actually pick up these. It did work before when I was using import-packages thought. So is there a workaround? Or do I have to maintain 2 manifest files, one that uses the import-package method and the other that uses the bundle-classpath method?

    Virat



  • 7.  RE: Using bundle-classpath while debugging in eclipse

    Posted Sep 13, 2016 01:40 AM

    Never mind, I figured out that all I had to do was place all the dependency jars in the root of my source or resource folder and eclipse would include them. It will not include when if they are in its classpath alone.



  • 8.  RE: Using bundle-classpath while debugging in eclipse

    Broadcom Employee
    Posted Sep 13, 2016 03:19 AM

    Still puzzled that you package jars differently between dev and production but I am glad you found the solution!