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 129078 - Inconsistent displayed EJB names in project View
Summary: Inconsistent displayed EJB names in project View
Status: RESOLVED WONTFIX
Alias: None
Product: javaee
Classification: Unclassified
Component: EJB Project (show other bugs)
Version: 6.x
Hardware: All All
: P4 blocker (vote)
Assignee: David Konecny
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-03-04 07:35 UTC by vp17559
Modified: 2009-12-21 06:54 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description vp17559 2008-03-04 07:35:16 UTC
When creating an EJB project, use the same class but 2 different remote interfaces definitions for 2 session interfaces.
In the Project view, enterprise Beans section the 2 session beans are displayed using the same name instead of using the
names from the ejb-jar.xml <display-name> section.

Example:
ejb-jar.xml:
...
    <enterprise-beans>
        <session>
            <display-name>ChangeManagerSB</display-name>
            <ejb-name>ChangeManagerBean</ejb-name>
            <home>com.ri.cm.ChangeManagerRemoteHome</home>
            <remote>com.ri.cm.ChangeManagerRemote</remote>
            <ejb-class>com.ri.cm.ChangeManagerBean</ejb-class>
            <session-type>Stateless</session-type>
            <transaction-type>Container</transaction-type>
        </session>
        <session>
            <display-name>ApprovalManagerSB</display-name>
            <ejb-name>ApprovalManagerBean</ejb-name>
            <home>com.ri.cm.approval.ApprovalManagerRemoteHome</home>
            <remote>com.ri.cm.approval.ApprovalManagerRemote</remote>
            <ejb-class>com.ri.cm.ChangeManagerBean</ejb-class>
            <session-type>Stateless</session-type>
            <transaction-type>Container</transaction-type>
        </session>
    </enterprise-beans>
 
In the Enterprose beans section of the project the "ChangeManagerSB" is displayed twice instead of 
"ChangeManaerSB" and "ApprovalManagerSB" as written in the <display-name> section of the session.

To reproduce the issue, create session bean using the Wizard "new->" etc.
Once created, 
- edit the ejb-jar.xml, xml file duplicate the <session></session> section.
- change the <display-name>, <ejb-name>, <remote>, <home> sections, BUT keep the same <ejb-class>
- Save

The new name shall appear instead of a duplication of the initial EJB.

This issue prevent to access the new Remote and Home interface from the "projects" view (right-click) sub menus of the
new EJB.
Comment 1 pslechta 2008-06-26 15:48:40 UTC
Confirmed.
The problem is that bean's class is used as ID of the bean.

org.netbeans.modules.j2ee.ejbcore.ui.logicalview.ejb.session.SessionNode:

    public static SessionNode create(final String ejbClass, EjbJar ejbModule, Project project) {
        ClasspathInfo cpInfo = null;
        FileObject[] javaSources = ejbModule.getJavaSources();
        if (javaSources.length > 0) {
            cpInfo = ClasspathInfo.create(
                    ClassPath.getClassPath(javaSources[0], ClassPath.BOOT),
                    ClassPath.getClassPath(javaSources[0], ClassPath.COMPILE),
                    ClassPath.getClassPath(javaSources[0], ClassPath.SOURCE)
                    );
        }
        assert cpInfo != null;
        String ejbName = null;
        try {
            ejbName = ejbModule.getMetadataModel().runReadAction(new MetadataModelAction<EjbJarMetadata, String>() {
                public String run(EjbJarMetadata metadata) throws Exception {
----->              Ejb ejb = metadata.findByEjbClass(ejbClass);
                    return ejb == null ? null : ejb.getEjbName();
                }
            });
        } catch (IOException ioe) {
            Exceptions.printStackTrace(ioe);
        }
        if (ejbName == null) {
            return null;
        } else {
            return new SessionNode(new InstanceContent(), cpInfo, ejbClass, ejbName, ejbModule);
        }
    }

org.netbeans.modules.j2ee.dd.api.ejb.EjbJarMetadata:

public interface EjbJarMetadata {
    EjbJar getRoot();
    Ejb findByEjbClass(String ejbClass);
    FileObject findResource(String resourceName);
}

I won't be easy to solve this issue, because only searching by bean's class is supported now... (API change?)
Comment 2 _ jyothivasa 2008-11-18 18:12:03 UTC
Not critical for 7.0
Comment 3 Quality Engineering 2009-12-21 06:54:45 UTC
This bug was reported against NetBeans IDE 6.0 or an older release, or against a non-maintained module. NetBeans team does not have enough resources to get to this issue, therefore we are closing the issue as a WONTFIX. If you are interested in providing a patch for this bug, please see our NetFIX guidelines for how to proceed. 

We apologize for any inconvenience.


Thank you.
The NetBeans Team