NoClassDefFoundError using NetBeans

77 views
Skip to first unread message

William Dunne

unread,
Apr 24, 2015, 11:58:31 AM4/24/15
to java-ch...@googlegroups.com
I'm testing out Maps on Windows running NetBeans for my IDE. I've attached the relevant JARs and have the following imports:


import java.io.File;
import net.openhft.chronicle.map.ChronicleMapBuilder;
import net.openhft.xstream.MapHeaderSerializationXStream;
import net.openhft.xstream.converters.ByteBufferConverter;

However getting this error:

NoClassDefFoundError

On this code:

private Map<Integer, Integer> createChronicleMap(String side) {
            File file = new File(side + ".dat");
            ChronicleMapBuilder<Integer, Integer> builder = ChronicleMapBuilder.of(Integer.class, Integer.class);
            return builder.create(file);
        }


Sorry for the basic question, but any idea on how to fix this?

Peter Lawrey

unread,
Apr 24, 2015, 12:46:06 PM4/24/15
to java-ch...@googlegroups.com

How have you configured maven? Can you so use the dependancy block?

--
You received this message because you are subscribed to the Google Groups "Chronicle" group.
To unsubscribe from this group and stop receiving emails from it, send an email to java-chronicl...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

William Dunne

unread,
Apr 24, 2015, 12:50:56 PM4/24/15
to java-ch...@googlegroups.com
I haven't installed Maven but just included the Jars directly. If I try and just use the dependency block I get this

Caused by: java.lang.RuntimeException: Uncompilable source code - cannot find symbol
  symbol:   class xstream

I'll try setting Maven up.

Peter Lawrey

unread,
Apr 24, 2015, 1:31:57 PM4/24/15
to java-ch...@googlegroups.com

When you use maven, or ivy or gradle it will down load and include any jars you also need.

William Dunne

unread,
Apr 24, 2015, 1:39:16 PM4/24/15
to java-ch...@googlegroups.com
Thinks this is missing:

net.openhft.lang.io.serialization.BytesMarshallerFactory;

Rob Austin

unread,
Apr 24, 2015, 1:45:23 PM4/24/15
to java-ch...@googlegroups.com
that comes from Lang

William Dunne

unread,
Apr 24, 2015, 2:22:58 PM4/24/15
to java-ch...@googlegroups.com
Thanks for the help, managed to get it working.

Odd issue though.

Previously I was using regular treemaps, and a particular task took 62 seconds to execute. Now using ChronicalMaps its taking around 10 minutes - bizarre. 7,500,000 inserts + 2,500,000 removals from the maps - doesn't seem like it should take nearly that long. Just plain old integers.

Peter Lawrey

unread,
Apr 24, 2015, 2:30:27 PM4/24/15
to java-ch...@googlegroups.com

This is in the java-lang library. You are much better off letting maven find the right dependancies for you.

William Dunne

unread,
Apr 24, 2015, 3:20:16 PM4/24/15
to java-ch...@googlegroups.com
Okay I'll give it a shot, tbh I'm just not very familiar with the Java ecosystem. I'll work on getting it set up properly tomorrow.

Peter Lawrey

unread,
Apr 24, 2015, 5:49:28 PM4/24/15
to java-ch...@googlegroups.com

Netbeans is really design to use maven. Once you use a build tool you will wonder how you lived without one.

William Dunne

unread,
Apr 25, 2015, 10:07:13 AM4/25/15
to java-ch...@googlegroups.com
You're right, just set up Maven and it works. Also moved to IDEA.

However still having the performance issue.. its running like crap at the moment.

Around 16x slower, which is a little disappointing than regular treemaps. 

Also getting this error which may be related, but I can't work out why. Only logger I can see, and straight up using your Mavern repo (no other dependencies outside regular java scope)

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation

Luca Burgazzoli

unread,
Apr 25, 2015, 10:13:35 AM4/25/15
to java-ch...@googlegroups.com
About the log message, Chronicle software uses slf4j apis so you can choose the implementation that suits your need better. To use a very simple implementation you can add org.slf4j:slf4j-simple:1.7.10 in maven dependencies. 
lb

Peter Lawrey

unread,
Apr 25, 2015, 10:19:33 AM4/25/15
to java-ch...@googlegroups.com

You need to compare it to another persisted store. The performance of  persistence depends on the speed of your serialization and the speed of your disk sub system.

Reply all
Reply to author
Forward
0 new messages