Java compile error - Nullpointer exception

Bug #504848 reported by Thibaut
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
play framework
Status tracked in 1.0
1.0
Fix Released
Undecided
Guillaume Bort
1.1
Fix Committed
Undecided
Unassigned

Bug Description

Hi,

I'm trying to use play together with katta (0.6-dev from trunk) (katta.sourceforge.net).

The following code will make the play java compiler fail (play precompile Testproject) with a nullpointer exception. I attached the necessary katta library in order to run the test case!

import java.lang.reflect.Method;
import java.util.Arrays;

import net.sf.katta.client.Client;
import net.sf.katta.client.ClientResult;
import net.sf.katta.client.INodeSelectionPolicy;
import net.sf.katta.lib.lucene.DocumentFrequencyWritable;
import net.sf.katta.lib.lucene.ILuceneClient;
import net.sf.katta.lib.lucene.LuceneClient;
import net.sf.katta.lib.lucene.QueryWritable;
import net.sf.katta.util.ClientConfiguration;
import net.sf.katta.util.KattaException;
import net.sf.katta.util.ZkConfiguration;

import org.apache.log4j.Logger;

/**
 * Default implementation of {@link ILuceneClient}.
 */
public class CompileError extends LuceneClient {

 protected final static Logger LOG = Logger.getLogger(TrendsearchClient.class);
 private final static long TIMEOUT = 12000;
}

java.lang.NullPointerException
        at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.getMemberT
ype(BinaryTypeBinding.java:606)
        at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.getTypeFro
mTypeSignature(LookupEnvironment.java:898)
        at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.getTypeFro
mVariantTypeSignature(LookupEnvironment.java:936)
        at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.getTypeArg
umentsFromSignature(LookupEnvironment.java:754)
        at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.getTypeFro
mTypeSignature(LookupEnvironment.java:887)
        at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.cacheParts
From(BinaryTypeBinding.java:240)
        at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.createBina
ryTypeFrom(LookupEnvironment.java:486)
        at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.createBina
ryTypeFrom(LookupEnvironment.java:465)
        at org.eclipse.jdt.internal.compiler.Compiler.accept(Compiler.java:190)
        at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType
(LookupEnvironment.java:99)
        at org.eclipse.jdt.internal.compiler.lookup.UnresolvedReferenceBinding.r
esolve(UnresolvedReferenceBinding.java:43)
        at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.resolveTyp
e(BinaryTypeBinding.java:51)
        at org.eclipse.jdt.internal.compiler.lookup.PackageBinding.getTypeOrPack
age(PackageBinding.java:167)
        at org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.findImp
ort(CompilationUnitScope.java:403)
        at org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.findSin
gleImport(CompilationUnitScope.java:456)
        at org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.faultIn
Imports(CompilationUnitScope.java:321)
        at org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.faultIn
Types(CompilationUnitScope.java:390)
        at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:497)

        at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:329)

        at play.classloading.ApplicationCompiler.compile(ApplicationCompiler.jav
a:262)
        at play.classloading.ApplicationClassloader.getAllClasses(ApplicationCla
ssloader.java:334)
        at play.Play.preCompile(Play.java:408)
        at play.Play.init(Play.java:236)
        at play.server.Server.main(Server.java:83)

Revision history for this message
Thibaut (thibaut-blue) wrote :
Revision history for this message
Thibaut (thibaut-blue) wrote :

When I include that file (haven't tested with the stripped down version from above), play will also complain about @Override tags in my own application files.

Revision history for this message
Guillaume Bort (guillaume-bort) wrote :

If you just remove the

import net.sf.katta.client.ClientResult;

line, then it works.

How was compiled this jar ? It seems that there is a bad binary somewhere (around the ClientResult.class) that make the eclipse compiler fail.

Revision history for this message
Thibaut (thibaut-blue) wrote :

To compile katta:

git clone git://katta.git.sourceforge.net/gitroot/katta/katta
cd katta;
ant dist

The result will be in build/katta-core-0.6-rc1.tar.gz. Just take the katta-0.6-rc1.jar out of it. (http://trendiction.com/tmp/katta-core-0.6-rc1.tar.gz)

The error still persists, also with the new jar from the zip file above.

Btw, play will just start fine, if I build a jar of all my play source application files first, and the put that jar into the play lib dir. But I loose JIT editing of the source files then, and have to copy jar files around on each change.
I couldn't check if katta works in that combination as I don't have katta running on my develop machine.

Revision history for this message
Thibaut (thibaut-blue) wrote :

Could it be related to katta (supposedly, not checked) being compiled into 1.6 class files, while I somewhere read that play generates 1.5 class files by default?

Revision history for this message
Guillaume Bort (guillaume-bort) wrote : Re: [Bug 504848] Re: Java compile error - Nullpointer exception

Yes possible. We'll fix that soon.

On 24 janv. 2010, at 18:48, Thibaut <email address hidden> wrote:

> Could it be related to katta (supposedly, not checked) being compiled
> into 1.6 class files, while I somewhere read that play generates 1.5
> class files by default?
>
> --
> Java compile error - Nullpointer exception
> https://bugs.launchpad.net/bugs/504848
> You received this bug notification because you are subscribed to play
> framework.

Revision history for this message
Thibaut (thibaut-blue) wrote :

The newest eclipse compiler jar from (http://apache.multihomed.net/tomcat/tomcat-6/v6.0.24/bin/apache-tomcat-6.0.24.zip) seems to fix the problem, without having to set the target to 1.6.

Revision history for this message
Guillaume Bort (guillaume-bort) wrote :

Ok, I've updated the eclipse compiler. Let me know.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.