Results 1 to 7 of 7

Thread: ClassNotFoundException with dm server

  1. #1
    Join Date
    Dec 2008
    Posts
    26

    Default ClassNotFoundException with dm server

    Hello,

    I have a problem with deploying two bundles to dm server 2.0.0.RELEASE.

    First one contains some exception classes in package com.foo.exception and one aspect in package com.foo.aspect. MANIFEST.MF looks like this:

    Code:
    Manifest-Version: 1.0
    Archiver-Version: Plexus Archiver
    Created-By: Apache Maven
    Built-By: iassan
    Build-Jdk: 1.6.0_15
    Export-Package: com.foo.aspect;version="2.0.0";uses:="org.aspectj.lang
     ,org.aspectj.lang.annotation,org.springframework.stereotype,com.foo.e
     xception",com.foo.exception;version="2.0.0"
    Bundle-Vendor: Foo
    Bundle-Version: 2.0.0
    Tool: Bundlor 1.0.0.RELEASE
    Bundle-Name: FooService
    Import-Library: org.springframework.spring;version="[3.0.0,3.1.0)"
    Bundle-ManifestVersion: 2
    Bundle-SymbolicName: com.foo
    Web-ContextPath: FooService
    Import-Package: org.apache.log4j;version="[1.2.15,1.2.15]",org.aspectj
     .lang;version="[1.6.6.RELEASE,1.6.6.RELEASE]",org.aspectj.lang.annota
     tion;version="[1.6.6.RELEASE,1.6.6.RELEASE]",org.springframework.cont
     ext.config;version="[3.0.0,3.1.0)",org.springframework.stereotype;ver
     sion="[3.0.0,3.1.0)"
    Second one tries to use one exception from the first bundle. MANIFEST.MF, among other things, contains:

    Code:
    Import-Package: com.foo.exception;version="[2.0.0,2.0.0]"
    I deploy (copy into pickup directory) first one and it starts OK. But when I deploy second one it gets installed, but cannot be started because I get:

    Code:
    Caused by: java.lang.ClassNotFoundException: com.foo.exception.FooServiceException
    As it is in resolved state I can see in admin console, that the wire between those two bundles exists, versions are OK, but still class cannot be found. I even read part of OSGi R4.2 specification describing class loading, but still have no idea.

    Any clues?

    Best regards

    Jacek Bilski

  2. #2
    Join Date
    Jan 2010
    Location
    Germany
    Posts
    22

    Default

    Hi Iassan,

    what is the bundle classpath of the first bundle? The header Bundle-ClassPath is missing. I don't recall, whether it is set to '.' by default, if missing, but that might be something to check, ie.e. add a header "Bundle-ClassPath: ." to the first bundle.

    HTH,

    Wolfgang

  3. #3
    Join Date
    Dec 2008
    Posts
    26

    Default

    Hello,

    Thanks, it helped. But the specification clearly states:

    The dot (’.’ \u002E) container path is a synonym for ’/’ or the root of a container. The dot is the default value for a bundle or fragment if no Bundle-ClassPath header is specified.
    That would lead to conclusion, that dm server, at least in this point, is not following specification. Am I right?

    Best regards

    Jacek Bilski

  4. #4
    Join Date
    Jan 2010
    Location
    Germany
    Posts
    22

    Default

    Hi Iassan,

    DM Server uses Eclipse Equinox under the hood and I don't think, that Equinox would not follow the spec in this case (it's the reference implementation).

    OK, so maybe your bundle is corrupted? I wrote a script for inspecting jars, wars and bundles, which you can use to check, that the missing class is actually included in the package (see http://gist.github.com/268474 for the script and http://blog.jetztgrad.net/2010/01/sc...s-and-plugins/ for some notes on usage). You can download it (don't forget to make it executable using "chmod +x jinspect") and run

    Code:
    jinspect -c mybundle.jar
    to see a list of all class files.

    Some more options:

    Code:
    jinspect -c mybundle.jar
    list the manifest with entries borken up to be human-readable

    Code:
    jinspect mybundle.jar
    shows the complete contents

    Code:
    jinspect -D Bundle-ClassPath mybundle.jar
    shows the header Bundle-ClassPath.

    See
    Code:
    jinspect -h
    for all options.

    HTH,

    Wolfgang

    to see all class files

  5. #5
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    Moved to dmServer forums.
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

  6. #6
    Join Date
    Apr 2010
    Posts
    2

    Default

    Hi I have a similar problem thats wy i would like to know was your problem solved in any way?

  7. #7
    Join Date
    Dec 2008
    Posts
    26

    Default

    Hi dble,

    Yes, I just had to add "Bundle-Classpath: ." to my MANIFEST.MF nd it worked.

    Best regards

    Jacek Bilski

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •