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 241893 - AssertionError: Project was null for projectURI: memory://fs32/
Summary: AssertionError: Project was null for projectURI: memory://fs32/
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: JUnit (show other bugs)
Version: 8.0
Hardware: PC Linux
: P3 normal with 1 vote (vote)
Assignee: Theofanis Oikonomou
URL:
Keywords:
: 242052 242053 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-02-14 20:58 UTC by mprentice
Modified: 2014-07-11 15:01 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 207620


Attachments
stacktrace (1.80 KB, text/plain)
2014-02-14 20:58 UTC, mprentice
Details

Note You need to log in before you can comment on or make changes to this bug.
Description mprentice 2014-02-14 20:58:45 UTC
Build: NetBeans IDE Dev (Build 201402140001)
VM: Java HotSpot(TM) 64-Bit Server VM, 24.51-b03, Java(TM) SE Runtime Environment, 1.7.0_51-b13
OS: Linux

User Comments:
mprentice: Trying to debug a test case.
This is a major issue because it blocks debugging and is forcing me to use NB 7.4 to be able to do my work.




Stacktrace: 
java.lang.AssertionError: Project was null for projectURI: memory://fs32/
   at org.netbeans.modules.gsf.testrunner.api.TestSession.getProject(TestSession.java:212)
   at org.netbeans.modules.gsf.testrunner.api.TestSession.getReport(TestSession.java:293)
   at org.netbeans.modules.junit.output.JUnitOutputReader.testCaseFinished(JUnitOutputReader.java:723)
   at org.netbeans.modules.junit.output.JUnitOutputReader.verboseMessageLogged(JUnitOutputReader.java:253)
   at org.netbeans.modules.junit.output.JUnitOutputReader.verboseMessageLogged(JUnitOutputReader.java:203)
   at org.netbeans.modules.junit.output.JUnitAntLogger.messageLogged(JUnitAntLogger.java:292)
Comment 1 mprentice 2014-02-14 20:58:48 UTC
Created attachment 145217 [details]
stacktrace
Comment 2 mprentice 2014-02-14 21:51:22 UTC
This is even more major because after installing and configuring NB 7.4, I am unable to debug my test case there due to a NPE that is fixed in NB 8.0 / Dev.

That issue is: http://statistics.netbeans.org/analytics/detail.do?id=201074
Comment 3 Theofanis Oikonomou 2014-02-17 14:19:26 UTC
From the log I see that the project is in /opt/Wavecrest/CyBlockCloud. Is this correct? Is the project still there? For some reason the infrastructure cannot locate the project from where you are running the tests. Could you please give some more info:
1) is this a default netbeans project? ant or maven?
2) did you modify any ant build script or pom file?
3) are your tests junit or testng?
4) is junit or testng library set as test dependency in the project? I am asking because the stacktrace comes from junit but you filed the bug under testng category
5) how did you invoke the tests?
6) where is the project located? 
7) any custom configuration that I should be aware of?

if you could attach a sample project that gives you this error it would be very helpful. Could you also clean your cache dir as it might interfere? From the log it is here /home/mprentice/.cache/netbeans/dev

Please reopen reporting back if clearing the cache dir helped and if not providing some feedback on the questions above. Thank you
Comment 4 mprentice 2014-02-18 13:39:40 UTC
I see that the project is in /opt/Wavecrest/CyBlockCloud. Is this correct?
Some libraries are located there, but the NetBeans project is in ~/NetBeansProjects/products905.

Is the project still there?
Yes.

1) is this a default netbeans project? ant or maven?
As far as I know, yes. ANT.

2) did you modify any ant build script or pom file?
Since when? We do have a custom ANT build script, I personally haven't changed it.

3) are your tests junit or testng?
JUnit.

4) is junit or testng library set as test dependency in the project? I am asking because the stacktrace comes from junit but you filed the bug under testng category.
I did not specify the component when submitting the report. Apparently Netbeans marked it as TestNG. I've set it to JUnit now.

5) how did you invoke the tests?
Right click on the file in Projects or Editor and select 'Test File' or 'Debug Test File'. Also by right clicking on a test in the Test Results view and selecting to re-run the test.

The issue appears to be related to displaying test results in the Test Results view.

I also get issue when trying to 're-run' tests a second time in the Test Results view. To reproduce: 
Run the whole test suite
In Test Results, select a group of tests to 'Run Again'.
In the new tab for the second run of Test Results, select a test to 'Run Again'. This seems to fail all of the time.
The workaround is to go back to the original test results and select to 'Run Again' the test from there.

Similar exceptions are thrown when expanding a JUnit test suite's results in the Test Results view (http://statistics.netbeans.org/analytics/exception.do?id=713007) or clicking the button to display passed tests in the Test Results view (http://statistics.netbeans.org/analytics/detail.do?id=207731).

6) where is the project located? 
~/NetBeansProjects/products905

7) any custom configuration that I should be aware of?
The product and supporting libraries are installed in /opt/Wavecrest/CyBlockCloud. The project builds and tests the last library needed for the system to function which contains the business logic.

Closing NetBeans, clearing the cache, and restarting NetBeans had no effect. The error occurred on the first test run. It appears to happen when the test has completed and the Test Results view is being updated. In this case, it left the Test Results view saying 'No tests executed' but in the output view I can clearly see that the test finished.
Comment 5 Theofanis Oikonomou 2014-02-18 15:43:36 UTC
(In reply to mprentice from comment #4)
> I see that the project is in /opt/Wavecrest/CyBlockCloud. Is this correct?
> Some libraries are located there, but the NetBeans project is in
> ~/NetBeansProjects/products905.
> 
> Is the project still there?
> Yes.
> 
> 1) is this a default netbeans project? ant or maven?
> As far as I know, yes. ANT.
> 
> 2) did you modify any ant build script or pom file?
> Since when? We do have a custom ANT build script, I personally haven't
> changed it.

I think this is where the problem starts. I guess that in that custom script you set ${work.dir} as /opt/Wavecrest/CyBlockCloud. So when the infrastructure tries to locate the project that owns the tests that are run it tries to find a project in /opt/Wavecrest/CyBlockCloud and it naturally fails. Could you please try this:
try to set, in the custom script, either ${work.dir} or if this is not possible ${basedir} to the actual path of the netbeans project: ~/NetBeansProjects/products905? This should do the trick. Please report back
Comment 6 Theofanis Oikonomou 2014-02-18 16:29:37 UTC
*** Bug 242052 has been marked as a duplicate of this bug. ***
Comment 7 Theofanis Oikonomou 2014-02-18 16:30:04 UTC
*** Bug 242053 has been marked as a duplicate of this bug. ***
Comment 8 mprentice 2014-02-18 17:06:46 UTC
${basedir} is the same dir where the build.xml is located ('.') so that is ~/NetBeansProjects/products905. 
This is done via <project name="Main Build Script" basedir="." ...

Working Directory is defined in the Project Properties as /opt/Wavecrest/CyBlockCloud
Comment 9 mprentice 2014-02-18 18:58:58 UTC
Not that the issue is intermittent. If I keep retrying the tests over and over again, eventually (about 30% of the time), I won't get this exception and the Test Results view will display properly.
Comment 10 Theofanis Oikonomou 2014-02-19 09:53:25 UTC
(In reply to mprentice from comment #8)
> ${basedir} is the same dir where the build.xml is located ('.') so that is
> ~/NetBeansProjects/products905. 
> This is done via <project name="Main Build Script" basedir="." ...
> 
> Working Directory is defined in the Project Properties as
> /opt/Wavecrest/CyBlockCloud

well by default work.dir defaults to basedir. In your case you have overridden this through the project's properties.

From the logs I see:
INFO [org.netbeans.modules.junit.output.JUnitAntLogger]: Project was null for project dir: /opt/Wavecrest/CyBlockCloud

since work.dir is set by you to /opt/Wavecrest/CyBlockCloud and I first check work.dir and if that fails basedir, this indicates that basedir is also set to /opt/Wavecrest/CyBlockCloud as well somewhere in the custom build script.

If you have a look at the default nbproject/build-impl.xml file you will see that junit task is using work.dir as parameter. I think that you also need to override each junit tasks, by just copying and pasting basically, and only modifying from "... <junit dir="${work.dir}"..." to "... <junit dir="~/NetBeansProjects/products905"..." and/or any other things you see fit. Does this help?

Please note that I am only guessing here as I do not have your custom build script.
Comment 11 mprentice 2014-02-19 12:59:25 UTC
How does that explain why it works sometimes (about 30%) and then fails with an exception other times when the exact same steps are performed?
Comment 12 Theofanis Oikonomou 2014-02-19 13:12:50 UTC
(In reply to mprentice from comment #11)
> How does that explain why it works sometimes (about 30%) and then fails with
> an exception other times when the exact same steps are performed?

I do not know how relevant this is but from the logs I can see also many 
WARNING [org.netbeans.modules.junit.output.JUnitAntLogger]: Project was null for ant script: /home/mprentice/.cache/netbeans/dev/executor-snippets/junit-debug.xml
WARNING [org.netbeans.modules.masterfs.watcher.Watcher]: Cannot add filesystem watch for /home/mprentice/NetBeansProjects/products905/build/test/classes: java.io.IOException: addWatch on /home/mprentice/NetBeansProjects/products905/build/test/classes errno: 2

not sure why this happens though...

As I said before I cannot offer any concrete answer as you are using a specific project hierarchy and a custom build script that I am not aware of. You need to make sure that the build script works as expected and passes the expected property values to the junit tasks.
Comment 13 mprentice 2014-02-19 14:00:04 UTC
In the build-impl.xml, there is the following:

<project ... basedir=".." ...>
..
        <property name="work.dir" value="${basedir}"/>

This appears to set basedir and work.dir to ~/NetBeansProjects/products905.

/opt/Wavecrest/CyBlockCloud is not found anywhere in the build-impl.xml.
Comment 14 Theofanis Oikonomou 2014-02-19 16:58:08 UTC
(In reply to mprentice from comment #13)
> In the build-impl.xml, there is the following:
> 
> <project ... basedir=".." ...>
> ..
>         <property name="work.dir" value="${basedir}"/>
> 
> This appears to set basedir and work.dir to ~/NetBeansProjects/products905.
> 
> /opt/Wavecrest/CyBlockCloud is not found anywhere in the build-impl.xml.

this is correct but build-impl.xml is automatically created by the ide. You said that you are using some other custom build script. My comment was that chances are that somewhere in that custom script these properties get overridden and later passed to the junit task.
Comment 15 mprentice 2014-02-21 22:32:42 UTC
Changing the Working Directory in the project properties to be blank allows the tests to run. But the product cannot be run that way. So now I have to have a separate configuration for the tests and for the product.

Either way there needs to be better handling of this situation. There should be a useful and informational error message and not an uncaught exception and trouble ticket request.

"Project was null for projectURI: memory://fs32/" is not a useful message for users, even developers.
Comment 16 mprentice 2014-03-03 22:01:59 UTC
Tested again with the 8.0 RC1 (03032014 dev build) and the problem still exists.
Comment 17 Theofanis Oikonomou 2014-07-11 15:01:46 UTC
The way the project is located changed by http://hg.netbeans.org/main-silver/rev/cf2cbc3c4f2f. Please try a latest build and reopen if it still fails for you. Thank you for reporting.