This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 233456 - Can't deploy simple app with dependency Jars - java.lang.NoClassDefFoundError
Summary: Can't deploy simple app with dependency Jars - java.lang.NoClassDefFoundError
Status: VERIFIED FIXED
Alias: None
Product: javafx
Classification: Unclassified
Component: Deployment (show other bugs)
Version: 7.4
Hardware: PC Windows 7
: P1 normal with 1 vote (vote)
Assignee: Petr Somol
URL:
Keywords:
: 233545 235475 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-07-26 00:59 UTC by Lou Dasaro
Modified: 2013-09-26 09:50 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lou Dasaro 2013-07-26 00:59:18 UTC
I have JavaFX FXML projects with several external Jars. The project compiles and DEBUGs just fine.

But when I try to RUN the project. either inside the IDE, 
or at the command line from the "dist" subdirectory, 
the Jars that are project dependencies, that the build copied into the lib directory don't load up, and I receive ""JavaFX Launcher Error", "Exception while running Application"

RUNning the project inside the IDE results in a number of errors, leading up to (example): Caused by: java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
    at jfx1.SimpleController.initialize(SimpleController.java:36):

I'm fairly certain it's a classpath issue, related to JavaFX.
But hopeful that it's just lack of documentation and a step I've left out...
Existing documentation did not help and/or did not apply to my configuration.
I will be happy to write-up a page on this for documentation when I get it working.

To reproduce, here are steps taken:

1. Create a NEW Project->JavaFX->JavaFX FXML Application called "jfx1" (uses sample.fxml "Hello, World")

2. Right-click on Libraries->Add Jar/Folder and add the following Jars (source: slf4j.org ):

slf4j-api-1.7.5.jar     slf4j-simple-1.7.5.jar

3. Add the following lines to the beginning of SimpleController.java
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Also add the following lines to initialize(URL url, ResourceBundle rb)
            Logger logger = LoggerFactory.getLogger(SimpleController.class);
            logger.info("Hello World");

4. Edit manifest.mf

add the following line followed by a couple newlines
Class-Path: lib/slf4j-api-1.7.5.jar lib/slf4j-simple-1.7.5.jar
(I have also tried JavaFX-Class-Path: lib/slf4j-api-1.7.5.jar lib/slf4j-simple-1.7.5.jar)
I have also tried with NO changes to manifest.mf

5. Clean and Build project (no problems - jars copied to dist and lib folders )
6. Debug project (no problems - UI starts up, logger sends "hello world" to debug)
7. Attempt to Run project, and received a number of errors leading up to:
Caused by: java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
    at jfx1.SimpleController.initialize(SimpleController.java:36):
(Line 36 corresponds to the first line added where we getLogger)

8. Attempt to run jar from command line in "dist" directory.. 

Received dialog: "JavaFX Launcher Error", "Exception while running Application"

Running Java -jar jfx1.jar -cp lib/* -Djavafx.verbose=true
results in the same errors as seen in the IDE

Environment: NetBeans IDE Dev (Build 201307192300) Windows 7 32-bit. 
Can test in Linux or Win 8 if need be.
Comment 1 Petr Somol 2013-07-29 08:40:51 UTC
Thanks for the report. We need additional info - which exact version of JDK have you used when this occurred ? Have you tried it with other JDK versions as well ? (There might be significant changes in behavior even between various recent JDK7 updates). This info would help to focus better where to search for the cause..
Comment 2 Lou Dasaro 2013-07-29 17:31:22 UTC
Here is the Help->About (before I do any more updates):

Product Version: NetBeans IDE Dev (Build 201307192300)
Updates: Updates available
Java: 1.7.0_25; Java HotSpot(TM) Client VM 23.25-b01
Runtime: Java(TM) SE Runtime Environment 1.7.0_25-b16
System: Windows 7 version 6.1 running on x86; Cp1252; en_US (nb)

I'll be moving to a newer dev build of IDE, but no plans to use other JDK/JRE unless I receive direction to do so.
Comment 3 Petr Somol 2013-07-30 10:03:15 UTC
*** Bug 233545 has been marked as a duplicate of this bug. ***
Comment 4 Petr Somol 2013-07-30 13:42:18 UTC
fixed in jetmain
http://hg.netbeans.org/jet-main/rev/f301772590c4

bug was introduced roughly 2 months ago as part of build-script auto-update changes. Note that the fix should make pre-NB7.4 projects and newly created projects work as expected, but not those projects created in the last 2 months either in NB7.4beta or NB7.4dev.
Comment 5 Quality Engineering 2013-08-01 02:36:14 UTC
Integrated into 'main-silver', will be available in build *201307312300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/f301772590c4
User: Petr Somol <psomol@netbeans.org>
Log: #233456 - Cant deploy simple app with dependency Jars - java.lang.NoClassDefFoundError
Comment 6 Ed888 2013-09-05 03:11:12 UTC
I am jsut wondering when the fix will be available, or included in the new release?

I have downloaded the NetBeans IDE 7.4 Beta (Build 201307092200). I still get the exact same problem as described. My environment is

Product Version: NetBeans IDE 7.4 Beta (Build 201307092200)
Java: 1.7.0_21; Java HotSpot(TM) Client VM 23.21-b01
Runtime: Java(TM) SE Runtime Environment 1.7.0_21-b11
System: Windows XP version 5.1 running on x86; Cp1252; en_AU (nb)

I raised a new bug [Bug 235475] for it and just now realise that it's a duplibate of exising bug 233456.
Comment 7 Ed888 2013-09-05 03:15:22 UTC
*** Bug 235475 has been marked as a duplicate of this bug. ***
Comment 8 Lou Dasaro 2013-09-05 04:53:25 UTC
@Ed888: This has been fixed for over a month. 

However, the Beta is almost two months old. Suggest you download the latest DEV build, which is a definite improvement over the Beta. Also recommend JDK/JRE 7u25 or 7u40.