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 157451 - Profile cannot detect main execution class.
Summary: Profile cannot detect main execution class.
Status: RESOLVED FIXED
Alias: None
Product: profiler
Classification: Unclassified
Component: Base (show other bugs)
Version: 6.x
Hardware: Sun Solaris
: P3 blocker (vote)
Assignee: J Bachorik
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-01-26 15:23 UTC by msprauer
Modified: 2011-02-08 10:47 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Working app with main class in jar (14.50 KB, application/octet-stream)
2011-01-26 11:12 UTC, J Bachorik
Details
LibApp.jar (1.15 KB, application/octet-stream)
2011-01-26 15:05 UTC, J Bachorik
Details

Note You need to log in before you can comment on or make changes to this bug.
Description msprauer 2009-01-26 15:23:16 UTC
When running a project in NetBeans, that has a main class set which exists in one of its JAR libraries, the Profiler
can't seem to determine the main class.  I get an error dialog which says: "Project <PROJECT> does not have a main class
set correctly.  Select the main class for profiling:"  and the dialog provides me with a list of classes within the
project which have main methods.

I suspect that upon Profiler execution, the Profiler sees that the main execution class does not exist in the current
project, and doesn't know what to do.  

It should also be noted that I have only recently been having this problem.  I've even tried unintegrating the profiler
from the Project, and reintegrating, but to no avail.
Comment 1 J Bachorik 2009-03-23 15:11:20 UTC
Could you be more specific about the project type?
I've tried this with the j2se projects types and it works just fine, given you had selected the main class in the
project properties dialog.
Comment 2 matusdekanek 2009-09-18 12:07:22 UTC
Without requested information for long time - INVALID. We can't do anything in this case. Reporter, please add requested
information and reopen issue. Thanks in advance.
Comment 3 u_ra 2011-01-26 08:55:25 UTC
Reopening. The problem is that profiler only supports main classes which are within the source tree. My main class is in a jar listed in Run libraries. It is correctly set within project properties (I can run the project just file). But when I try to profile a dialog show up asking me to set the main class.
Comment 4 J Bachorik 2011-01-26 11:12:00 UTC
Created attachment 105361 [details]
Working app with main class in jar

NetBeans Build 201101250001

I am not able to reproduce it using the attached sample project.
Can you attach the project causing you the troubles?
Comment 5 J Bachorik 2011-01-26 11:12:15 UTC
Waiting for input ...
Comment 6 u_ra 2011-01-26 15:02:31 UTC
Can you attach the LibApp.jar, too?
Comment 7 u_ra 2011-01-26 15:04:55 UTC
I'm afraid I can't upload the project. FWIW, I cannot even select the main class from (any) jar. I had to manually type the main class in project properties. I only get offered classes which have main() from the source tree.
Comment 8 J Bachorik 2011-01-26 15:05:06 UTC
Created attachment 105369 [details]
LibApp.jar

Sorry, slipped out :(
Comment 9 u_ra 2011-01-26 15:15:12 UTC
Ok, I put the jar somewhere else, and updated project.properties. Did the profiler integration, and... it doesn't work. Same error.
Comment 10 J Bachorik 2011-01-26 15:20:08 UTC
Which version of NetBeans are you using?
I just entered the main class manually (the browse for main class doesn't work for dependencies as you pointed out) and everything worked just fine.
Anyway, profiler uses the project information to resolve the main class - so if running the project works fine so should profiling, there is no reason it shouldn't.
Comment 11 u_ra 2011-01-26 15:22:51 UTC
This is a 6.9.1 install. Here are the versions of profiling modules:

        org.netbeans.lib.profiler/1 [1.10.2 201007282301]
        org.netbeans.lib.profiler.common/1 [1.10.2 201007282301]
        org.netbeans.lib.profiler.charts/1 [1.6.1 201007282301]
        org.netbeans.lib.profiler.ui/1 [1.9.2 201007282301]
        org.netbeans.modules.profiler.utilities/1 [1.13.1 201007282301]
        org.netbeans.modules.profiler.projectsupport [1.8.1 201007282301]
        org.netbeans.modules.profiler.attach/1 [1.7.1 201007282301]
        org.netbeans.modules.profiler.oql/0 [0.5.1 201007282301]
        org.netbeans.modules.profiler.selector.spi/1 [1.11.1 201007282301]
        org.netbeans.modules.profiler.selector.ui/1 [1.7.1 201007282301]
        org.netbeans.modules.profiler/1 [1.17.2 201007282301]
        org.netbeans.modules.profiler.j2ee.tomcat/1 [1.11.1 201007282301]
        org.netbeans.modules.profiler.j2ee.sunas/1 [1.11.1 201007282301]
        org.netbeans.modules.profiler.j2ee.jboss/1 [1.11.1 201007282301]
        org.netbeans.modules.profiler.j2ee.generic/1 [1.11.1 201007282301]
        org.netbeans.modules.profiler.nbmodule/1 [1.11.1 201007282301]
        org.netbeans.modules.profiler.freeform/1 [1.11.1 201007282301]
        org.netbeans.modules.profiler.attach.impl/2 [1.7.1 201007282301]
        org.netbeans.modules.profiler.j2ee.weblogic/1 [1.11.1 201007282301]
        org.netbeans.modules.profiler.selector.java [1.5.1 201007282301]
        org.netbeans.modules.profiler.j2se/1 [1.11.1 201007282301]
        org.netbeans.modules.profiler.oql.language/0 [0.7.1 201007282301]
Comment 12 J Bachorik 2011-01-26 15:27:25 UTC
Ok, I see. Could you try opening a copy of your project with the latest dev build. It works fine for me so hopefully it will work for you too.

Feel free to reopen the issue ff you still experience the problem.
Comment 13 u_ra 2011-01-26 15:53:55 UTC
I downloaded latest nightly. Same thing. Both with my project and yours.
Comment 14 J Bachorik 2011-01-26 16:11:45 UTC
Ok, found the difference. I had the jar placed under a project directory and it caused the main class to be resolved. When I put the jar anywhere else I start getting the error you are describing.
Comment 15 u_ra 2011-01-26 16:14:54 UTC
I tried to recreate the project. Didn't help. This showed up in the log, not sure whether it will help any.

WARNING [org.netbeans.core.startup.InstalledFileLocatorImpl]: no code name base passed when looking up build.properties at org.netbeans.modules.profiler.j2se.J2SEProjectTypeProfiler.getProjectProperties(J2SEProjectTypeProfiler.java:306)
Comment 16 u_ra 2011-01-27 08:47:44 UTC
I'd like to use this workaround of yours in the meantime. I tried moving the jar under the source directory (I have a project with existing sources), but it didn't help. Any hints?
Comment 17 J Bachorik 2011-01-27 17:13:51 UTC
Fixed in http://hg.netbeans.org/profiler-main/rev/de3da80c8db8

Profiler now checks for presence of the main class in dependecies as well.
Comment 18 Quality Engineering 2011-01-29 05:26:19 UTC
Integrated into 'main-golden', will be available in build *201101290000* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/de3da80c8db8
User: Jaroslav Bachorik <yardus@netbeans.org>
Log: #157451: Profiler can not detect main class located in a binary library
Comment 19 u_ra 2011-02-08 10:31:27 UTC
still present in build 201102080000
Comment 20 J Bachorik 2011-02-08 10:47:48 UTC
Build 201102080000
Using the provided test application and library:

1. Open the App application
2. Resolve reference problems - point to the downloaded LibApp.jar
3. Set the main class *MANUALY* to libapp.LibApp - IDE doesn't support selecting a main class from library
4. Profile the project - everything works fine