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 242754 - Java EE version not correctly detected for EJB module
Summary: Java EE version not correctly detected for EJB module
Status: RESOLVED WONTFIX
Alias: None
Product: javaee
Classification: Unclassified
Component: Maven (show other bugs)
Version: 8.0
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Martin Janicek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-03-10 17:07 UTC by yblazart
Modified: 2016-07-07 08:53 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
With ejb-jar.xml (52.17 KB, image/png)
2014-03-11 08:55 UTC, yblazart
Details
Without ejb jar xml (56.08 KB, image/png)
2014-03-11 08:55 UTC, yblazart
Details

Note You need to log in before you can comment on or make changes to this bug.
Description yblazart 2014-03-10 17:07:16 UTC
Hello !
I have a problem with an EJB module. It show me Java EE 5 because it found an ejb-jar.xml. When I remove it, my module is detected as Java EE 6 correctly.

I need my ejb-jar.xml to specify the name of my ejb-module and I don't want to use specific vendors files. This different target break the hot redeploy of my application (because I'm full Java EE 6 of course). This is strange because I specified ejb 3.1 in my ejb-jar.xml.

Let me show : 

<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
                            http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd"
         version="3.1">

    <module-name>extranetexp-services</module-name>

</ejb-jar>
Comment 1 Martin Fousek 2014-03-11 07:27:08 UTC
What kind of project is it? Maven or Ant based one?
Comment 2 yblazart 2014-03-11 07:44:15 UTC
A maven one. Ear project that create ejb module and web module. I've added the ejb-jar.xml.

Tha same effect on Netbean 7.4.

I know there was a lot of discussion about it. But I have the conviction it sould be a good idea to let the user choose wich Java EE version to use.
Comment 3 Martin Fousek 2014-03-11 07:49:58 UTC
Passing to the maven JavaEE area. Martin was solving such issues several times, therefore I expect that he has concept how the recognition of the JavaEE level works and should work.
Comment 4 yblazart 2014-03-11 07:51:54 UTC
Strange, it doesn't do that on my mac os at home on a little example.

I'm going on work in 40 minutes. I will make a short example on windows 7 to test. Otherwise, I can send the full project.
Comment 5 yblazart 2014-03-11 08:55:07 UTC
Created attachment 145937 [details]
With ejb-jar.xml
Comment 6 yblazart 2014-03-11 08:55:38 UTC
Created attachment 145939 [details]
Without ejb jar xml
Comment 7 yblazart 2014-03-11 08:57:15 UTC
I made a new project from scratch. I can't reproduce on this new project.
But as you can see on the screen captures, on my real life ejb project, it continue.

What are the rules to detect Java EE version ? Is it documented somewhere ?
Comment 8 Martin Janicek 2014-03-11 09:14:39 UTC
If I remember correctly, there are two rules:

1/ Check nb-configuration.xml file and if the Java EE version is specified there, then this one should be taken for the project
2/ If there is no explicit specification, NetBeans is checking ejb-jar.xml and looking for a version of that file (in case of 3.1 it should consider it as Java EE 6 project I think)
3/ If both previous checks fails then use Java EE 5 as default version


..I can take a look at it, but without reproducible test case I hardly can guess what could be the problem. Could you try to create reproducible project (e.g. based on configuration files from your real project) ? Thanks in advance
Comment 9 Martin Janicek 2014-03-11 09:15:17 UTC
(In reply to yblazart from comment #2)
> A maven one. Ear project that create ejb module and web module. I've added
> the ejb-jar.xml.
> 
> Tha same effect on Netbean 7.4.
> 
> I know there was a lot of discussion about it. But I have the conviction it
> sould be a good idea to let the user choose wich Java EE version to use.

And I think you are right, but the fact is that it was implemented for Web projects only so far..
Comment 10 yblazart 2014-03-11 09:25:19 UTC
That's the nb-configuration generated when I change the target server to Glassfish 4  : 


<?xml version="1.0" encoding="UTF-8"?>
<project-shared-configuration>
 
    <properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
 
        <org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>gfv3ee6</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_deploy_2e_server>
    </properties>
</project-shared-configuration>
Comment 11 yblazart 2014-03-11 09:28:18 UTC
It's difficult to reproduce it... I will try, and send you all the needed code is a big. 

Well. What is the property to put in nb-configuration ?
Comment 12 yblazart 2014-03-11 09:47:59 UTC
Got it ! 

<org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion>1.6-web</org-netbeans-modules-maven-j2ee.netbeans_2e_hint_2e_j2eeVersion>


With this it works.
Well it seem that the generation of nb-configuration is not very stable. This line was added by NB when I add a new EJB Stateless/LocalBean in my example....
Comment 13 Martin Janicek 2014-03-28 10:38:14 UTC
Usually (or at least if you are creating project in NetBeans) it should be generated automatically during the creation.

I don't know if there is anything I could improve around EE detection. It would make sense to allow to change the value in project properties (same behavior like Maven Web projects), but the recognition mechanism will be the same. Setting TM = Next for now
Comment 14 Martin Balin 2016-07-07 08:53:13 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss