February 12, 2010 – 12:47 am
If you need to unit test classes in a netbeans module and the classes use the Lookup.getDefault() to “lookup” things that you want to mock you probably wonder how you can place the mock objects in the default Lookup
Adding objects to the Netbeans’s default Lookup is relatively simple. Here is the answer:
Replace the Lookup [...]
January 18, 2010 – 10:52 pm
Progress indicator (indeterminate mode) which allows to cancel the task
The easiest way of having a cancellable progress indicator (Progress API) for a task in Netbeans Platform Application is the one below but it´s only worth for tasks that don’t update the progress indicator (indeterminate mode) until the task is finished. If you want to update [...]
By ruben.laguna
|
Posted in java, netbeans
|
Also tagged cancel, cancellable, indicator, progress, progresshandle, requestprocessor, runnable, schedule, task, tasklistener, ui
|
October 1, 2009 – 8:14 am
To add a XJC task to a Netbeans build.xml you need to add a -pre-compile target to your build.xml. If it’s a netbeans module build.xml then you need to make compile depend on -pre-compile and projectized-common.compile (see example below). For regular Java Applications just define the -pre-compile target as the standard build.xml will call [...]
By ruben.laguna
|
Posted in netbeans
|
Also tagged build, build.xml, classes, classpath, compile, jaxb, project, schema, target, taskdef, xjc, xml
|
September 28, 2009 – 8:02 pm
Are you getting a ClassCastException in a Netbeans Platform Application, when you are you sure that the class can be casted? Then check http://wiki.netbeans.org/PlainView.jsp?page=DevFaqModuleCCE. This is most likely the result of the the classes being loaded by different classloaders. So JAXBContextImpl cannot be cast to JAXBContext because that JAXBContext is from Classloader “A” and JAXBContextImpl [...]
September 27, 2009 – 1:30 am
If you are getting
java.lang.ClassCastException: com.sun.xml.bind.v2.runtime.JAXBContextImpl cannot be cast to javax.xml.bind.JAXBContext
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:145)
at javax.xml.bind.ContextFinder.find(ContextFinder.java:277)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:372)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:337)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:244)
[...]
September 18, 2009 – 5:01 pm
If you create the persistence.xml manually in Windows the file will be created with CRLF line endings (windows style line endings) ,that will prevent Netbeans for recognizing Netbeans will not recognize it as the special file it is and won’t be able to to open it with the special/custom visual editor.
I opened an bug [...]
By ruben.laguna
|
Posted in java, netbeans
|
Also tagged break, crlf, editor, ending, eol, feed, file, filetype, jpa, lf, line, line feed, linebreak, linefeed, persistence, recognition, type, visual
|
September 16, 2009 – 7:50 am
In the build.xml of the project (likely this will be a Java Class Library project), override -post-compile or -pre-jar and invoke <openjpac/>. You will need to add the build/classes and the openjpa jars to <taskdef/> and <openjpac/>. The <openjpac/> will enhance all classes mentioned in persistence.xml (which has to be in the classpath)
<?xml version="1.0" [...]
August 25, 2009 – 7:30 pm
Java 6 includes STaX , when I tried to parse a Evernote backup file with it, I got a “OOME” error.
java.lang.OutOfMemoryError: Java heap space
at com.sun.org.apache.xerces.internal.util.XMLStringBuffer.append(XMLStringBuffer.java:205)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.refresh(XMLDocumentScannerImpl.java:1520)
at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.invokeListeners(XMLEntityScanner.java:2070)
at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.peekChar(XMLEntityScanner.java:486)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2679)
[...]
By ruben.laguna
|
Posted in mac, netbeans, windows
|
Also tagged api, bug, exception, implementation, jar, java, library, oome, outofmemoryexception, parser, parsing, provider, service, spi, stax, woodstox, wrapper, xml
|
My first try at using CGLib from a Netbeans RCP ended up in a ClassNotFoundException for net.sf.cglib.proxy.Factory
I had two modules, MainModule and cglib and MainModule was depending on cglib. And the following snippet was raising the ClassNotFoundException.
Enhancer enhancer = new Enhancer();
[...]