Skip to main content



      Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » NoClassDefFoundError during export(Why in "test" everything ok?)
NoClassDefFoundError during export [message #696495] Thu, 14 July 2011 02:09 Go to next message
Eclipse UserFriend
Hi all,

I am developing an Eclipse plug-in extending an existing one which comes from Eclipse.

Inside I code I have added I need log4j and other classes that are inside other JAR built by me (but this is not a plug-in).

Using the Manifest Editor inside Eclipse I have added these two JARs in "Classpath" inside the "Runtime" tab and if I test my plug-in from inside Eclipse using "Run as Eclipse Application" everything is ok.

Problem comes up when I try to export my plug-in because I get some "import can not be resolved" for classes that are inside one of my JAR.

To add these two JARs to my final JAR plug-in I edited the "Runtime Information" inside tab "Build".
In the Manifest.MF tab I can see these two JARs added with:

Bundle-ClassPath: libs/log4j.jar, libs/common.jar  


In fact during export the second JAR is included, but I get "import can not be resolved" inside a log file (created during export).

Why? How can I solve?

Thanks
Marco

[Updated on: Thu, 14 July 2011 02:43] by Moderator

Re: NoClassDefFoundError during export [message #696532 is a reply to message #696495] Thu, 14 July 2011 04:28 Go to previous messageGo to next message
Eclipse UserFriend
For log4j: better than including log4j in the bundle, it is better to rely on existing bundles like org.apache.log4j or slf4j. Add such a bundle as required to your bundle manifest.
Re: NoClassDefFoundError during export [message #696592 is a reply to message #696532] Thu, 14 July 2011 07:00 Go to previous messageGo to next message
Eclipse UserFriend
Which is the difference from what I have done?

And, can you give me some help for error in import?

Thanks
Marco

[Updated on: Thu, 14 July 2011 09:44] by Moderator

Re: NoClassDefFoundError during export [message #696676 is a reply to message #696592] Thu, 14 July 2011 10:58 Go to previous messageGo to next message
Eclipse UserFriend
Referencing a bundle helps to get a smaller bundle and you can reuse existing bundles. Including log4j.jar duplicates classes which are already present.

For the "import can not be resolved" message there is not enough info. Would be good to have the bundle manifest and the build.properties.
Re: NoClassDefFoundError during export [message #696917 is a reply to message #696676] Fri, 15 July 2011 02:10 Go to previous messageGo to next message
Eclipse UserFriend
Ok, this is Manifest

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.wst.xml.ui; singleton:=true
Bundle-Version: 1.1.300.qualifier
Bundle-Activator: org.eclipse.wst.xml.ui.internal.XMLUIPlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Export-Package: org.eclipse.wst.xml.ui,
 org.eclipse.wst.xml.ui.internal;x-friends:="org.eclipse.wst.xsd.ui,org.eclipse.wst.dtd.ui",
 org.eclipse.wst.xml.ui.internal.actions;x-friends:="org.eclipse.wst.xsd.ui,org.eclipse.wst.dtd.ui",
 org.eclipse.wst.xml.ui.internal.autoedit;x-friends:="org.eclipse.wst.xsd.ui,org.eclipse.wst.dtd.ui",
 org.eclipse.wst.xml.ui.internal.catalog;x-friends:="org.eclipse.wst.xsd.ui,org.eclipse.wst.dtd.ui",
 org.eclipse.wst.xml.ui.internal.contentassist;x-friends:="org.eclipse.wst.xsd.ui,org.eclipse.wst.dtd.ui",
 org.eclipse.wst.xml.ui.internal.contentoutline;x-friends:="org.eclipse.wst.xsd.ui,org.eclipse.wst.dtd.ui",
 org.eclipse.wst.xml.ui.internal.correction;x-friends:="org.eclipse.wst.xsd.ui,org.eclipse.wst.dtd.ui",
 org.eclipse.wst.xml.ui.internal.dialogs;x-friends:="org.eclipse.wst.xsd.ui,org.eclipse.wst.dtd.ui",
 org.eclipse.wst.xml.ui.internal.dnd;x-friends:="org.eclipse.wst.xsd.ui,org.eclipse.wst.dtd.ui",
 org.eclipse.wst.xml.ui.internal.doubleclick;x-friends:="org.eclipse.wst.xsd.ui,org.eclipse.wst.dtd.ui",
 org.eclipse.wst.xml.ui.internal.editor;x-friends:="org.eclipse.wst.xsd.ui,org.eclipse.wst.dtd.ui",
 org.eclipse.wst.xml.ui.internal.editor.propertytester,
 org.eclipse.wst.xml.ui.internal.handlers;x-friends:="org.eclipse.wst.xsd.ui,org.eclipse.wst.dtd.ui",
 org.eclipse.wst.xml.ui.internal.hyperlink;x-friends:="org.eclipse.wst.xsd.ui,org.eclipse.wst.dtd.ui",
 org.eclipse.wst.xml.ui.internal.nsedit;x-friends:="org.eclipse.wst.xsd.ui,org.eclipse.wst.dtd.ui",
 org.eclipse.wst.xml.ui.internal.perspective;x-friends:="org.eclipse.wst.xsl.ui",
 org.eclipse.wst.xml.ui.internal.preferences;x-friends:="org.eclipse.wst.xsd.ui,org.eclipse.wst.dtd.ui",
 org.eclipse.wst.xml.ui.internal.projection;x-friends:="org.eclipse.wst.xsd.ui,org.eclipse.wst.dtd.ui",
 org.eclipse.wst.xml.ui.internal.properties;x-friends:="org.eclipse.wst.xsd.ui,org.eclipse.wst.dtd.ui",
 org.eclipse.wst.xml.ui.internal.provisional;x-friends:="org.eclipse.wst.xsd.ui,org.eclipse.wst.dtd.ui",
 org.eclipse.wst.xml.ui.internal.quickoutline,
 org.eclipse.wst.xml.ui.internal.registry;x-friends:="org.eclipse.wst.xsd.ui,org.eclipse.wst.dtd.ui",
 org.eclipse.wst.xml.ui.internal.search;x-friends:="org.eclipse.wst.xsd.ui,org.eclipse.wst.dtd.ui",
 org.eclipse.wst.xml.ui.internal.selection;x-friends:="org.eclipse.wst.xsd.ui,org.eclipse.wst.dtd.ui",
 org.eclipse.wst.xml.ui.internal.spelling,
 org.eclipse.wst.xml.ui.internal.style;x-friends:="org.eclipse.wst.xsd.ui,org.eclipse.wst.dtd.ui",
 org.eclipse.wst.xml.ui.internal.tabletree;x-friends:="org.eclipse.wst.xsd.ui,org.eclipse.wst.dtd.ui",
 org.eclipse.wst.xml.ui.internal.taginfo;x-friends:="org.eclipse.wst.xsd.ui,org.eclipse.wst.dtd.ui",
 org.eclipse.wst.xml.ui.internal.templates;x-friends:="org.eclipse.wst.xsd.ui,org.eclipse.wst.dtd.ui",
 org.eclipse.wst.xml.ui.internal.text;x-friends:="org.eclipse.wst.xsd.ui,org.eclipse.wst.dtd.ui",
 org.eclipse.wst.xml.ui.internal.util;x-friends:="org.eclipse.wst.xsd.ui,org.eclipse.wst.dtd.ui",
 org.eclipse.wst.xml.ui.internal.validation;x-friends:="org.eclipse.wst.xsd.ui,org.eclipse.wst.dtd.ui",
 org.eclipse.wst.xml.ui.internal.validation.core.errorinfo;x-friends:="org.eclipse.wst.xsd.ui,org.eclipse.wst.dtd.ui",
 org.eclipse.wst.xml.ui.internal.views.annotations,
 org.eclipse.wst.xml.ui.internal.views.contentmodel,
 org.eclipse.wst.xml.ui.internal.wizards;x-friends:="org.eclipse.wst.xsd.ui,org.eclipse.wst.dtd.ui",
 org.eclipse.wst.xml.ui.views.contentoutline,
 org.eclipse.wst.xml.ui.views.properties
Import-Package: com.ibm.icu.util; version="3.8",
 com.ibm.icu.text; version="3.8"
Require-Bundle: org.eclipse.ui.ide;bundle-version="[3.5.0,4.0.0)",
 org.eclipse.ui.views;bundle-version="[3.4.0,4.0.0)",
 org.eclipse.jface.text;bundle-version="[3.5.0,4.0.0)",
 org.eclipse.ui.workbench.texteditor;bundle-version="[3.5.0,4.0.0)",
 org.eclipse.wst.sse.ui;bundle-version="[1.2.0,1.4.0)",
 org.eclipse.wst.sse.core;bundle-version="[1.1.500,1.2.0)",
 org.eclipse.ui;bundle-version="[3.5.0,4.0.0)",
 org.eclipse.core.resources;bundle-version="[3.5.0,4.0.0)",
 org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)",
 org.eclipse.wst.common.uriresolver;bundle-version="[1.1.301,1.2.0)",
 org.eclipse.wst.xml.core;bundle-version="[1.1.500,1.2.0)",
 org.eclipse.wst.common.ui;bundle-version="[1.1.400,1.2.0)",
 org.eclipse.wst.validation;bundle-version="[1.2.100,1.3.0)",
 org.eclipse.core.expressions;bundle-version="[3.4.100,4.0.0)",
 org.eclipse.core.filesystem;bundle-version="[1.3.0,2.0.0)"
 
Bundle-ActivationPolicy: lazy; exclude:="org.eclipse.wst.xml.ui.internal.validation.core.errorinfo,org.eclipse.wst.xml.ui.internal.editor.propertytester"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ClassPath: libs/common.jar,
 libs/log4j-1.2.15.jar,
 .


and this is "build.properties"

###############################################################################
# Copyright (c) 2001, 2006 IBM Corporation and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
#
# Contributors:
#     IBM Corporation - initial API and implementation
#     Jens Lukowski/Innoopract - initial renaming/restructuring
#     
###############################################################################
bin.includes = plugin.xml,\
               icons/,\
               plugin.properties,\
               templates/,\
               examples/,\
               META-INF/,\
               .,\
               .options,\
               about.html,\
               about.ini,\
               about.properties,\
               about.mappings,\
               properties/,\
               libs/common.jar,\
               libs/log4j-1.2.15.jar
bin.excludes = bin/**,\
               @dot/**,\
               temp.folder/**
source.. = src/,\
           src-multipage/,\
           src-wizards/,\
           src-catalog/,\
           src-validation/
jars.compile.order = libs/log4j-1.2.15.jar,\
                     libs/common.jar,\
                     .
source.libs/log4j-1.2.15.jar = libs/
output.libs/log4j-1.2.15.jar = bin/
source.libs/common.jar = libs/
output.libs/common.jar = bin/


And I have "import can not be resolved" for classes inside common.jar

Thanks
Marco
Re: NoClassDefFoundError during export [message #697027 is a reply to message #696917] Fri, 15 July 2011 06:54 Go to previous messageGo to next message
Eclipse UserFriend
Since org.eclipse.wst.xml.ui is an exisiting plug-in (Eclipse 3.6.2 comes with version 1.1.103.v201101122108), are you sure that your version 1.1.300.qualifier is used? You can check this with the OSGi console.

In addition: if the plug-in contains classes outside libs/log4j and libs/common.jar, the Bundle-ClassPath should contain the 'dot' or other folders which contain classes.
Re: NoClassDefFoundError during export [message #697044 is a reply to message #697027] Fri, 15 July 2011 07:54 Go to previous message
Eclipse UserFriend
Martin Skorsky wrote on Fri, 15 July 2011 06:54
Since org.eclipse.wst.xml.ui is an exisiting plug-in (Eclipse 3.6.2 comes with version 1.1.103.v201101122108), are you sure that your version 1.1.300.qualifier is used? You can check this with the OSGi console.


What do you mean with this?
I tried to generate the exported JAR without the "failing" library and the "extended" plug-in is correctly loaded, no problem. I have views and everything else I have implemented.

Quote:

In addition: if the plug-in contains classes outside libs/log4j and libs/common.jar, the Bundle-ClassPath should contain the 'dot' or other folders which contain classes.


Bundle class-path has got the dot:

Bundle-ClassPath: libs/common.jar,
 libs/log4j-1.2.15.jar,
 .
Previous Topic:Installing an existing plug-in
Next Topic:"Go Into" a specific project in the package explorer
Goto Forum:
  


Current Time: Fri Jul 04 16:10:36 EDT 2025

Powered by FUDForum. Page generated in 0.03627 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top