Community
Participate
Working Groups
Previously, when creating a new EJB project, there was an option to create a default session bean. In current WTP drivers, I don't see this option anymore. Is there a way to create a default session bean programmatically during the EJB project creation?
*** Bug 131406 has been marked as a duplicate of this bug. ***
*** Bug 129195 has been marked as a duplicate of this bug. ***
This could be consider for the next post-Ganymede release.
(In reply to comment #0) > Previously, when creating a new EJB project, there was an option to create a > default session bean. In current WTP drivers, I don't see this option anymore. > > Is there a way to create a default session bean programmatically during the EJB > project creation? > Is this still relevant? In an EJB 3.0 project the ejb-jar.xml is optional. There might be 0 or * beans in the project. Or you would like to see the option only for EJB 2.1< projects?
It is still relevant - even for EJB 3.x modules without ejb-jar.xml. In this case the EJB JAR archive is just an ordinary JAR archive. The only thing that makes it EJB JAR is the annotated bean classes in it. If there is not such class then it is not an EJB JAR. In WTP if you have an EJB 3.0 project without ejb-jar.xml and no bean, then it cannot be exported as valid EJB JAR. Many server runtimes like Glassfish and JBoss fails deploying such JARs, complaining that there is no EJB bean there. So, in EJB 3.0 you still need 1 or * beans in the project.
We will try to implement this enhancements for EJB 3.0 projects in two steps: - implement validation that shows error marker when an EJB 3.0 project has no enterprise bean. - implement two quick fixes for the error marker: "Create Session Bean" and "Create Message-Driven Bean". Each of the quick fixes will call the corresponding wizard.
Created attachment 159938 [details] No beans validation error for EJB 3.x projects I've created a validator (v2) for this problem which shows error on the EJB 3.x project with two quick fixes available allowing the user to open wizards for new session or message-driven bean. It works fine except for the only problem that the validator could be triggered only manually. Perhaps I've implemented something wrong since the validator doesn't trigger when I add/delete a bean from the project. I've debugged it and appears that when I add/delete a bean from the project the method AbstractValidator.validationStarting(...) is being invoked by the framework, but later the UIEJB3Validator.validate(...) method(s) are not invoked. Any ideas?
Created attachment 160088 [details] No beans validation error for EJB 3.x projects v2 This version of the patch works fine. But there is a little hack in it. I'm using the fact that the validationStarting(...) method of my validator is being invoked when it's supposed to and in its body I'm invoking the actual validation. If somebody has an idea how to implement it better, please share it.
Created attachment 160305 [details] patch v3 Thanks for the patch. Everything is functionally correct. I just made some structural and cosmetics changes to the contribution. The most significant is that I moved the UI related code to the jee.ui plugin. This way we avoid the UI dependencies in the jee.ejb plugin.
Patch v3 committed to HEAD.
This caused a dependency cycle between jst.jee.ui (where you added a prereq to jst.ejb.ui) and jst.ejb.ui, which already prereqs jst.jee.ui.
I moved everything you added to org.eclipse.jst.jee.ui over to org.eclipse.jst.ejb.ui - that is the quickest way to fix things up short term. I also noticed that none of the new .java files nor the new .properties file has the EPL header in it. (Except for the Messages.java, which has an old IBM EPL header - that should be fixed up, too.) Please review my changes and fix up as appropriate.
Thanks, Carl! I added the missing copyright headers.
One last change- in UIEJB3Validator, it checks to see if the total number of session and message driven beans are 0. There are circumstances where ejbJar.getEnterpriseBeans() returns null, and this should display the validation error. And there are times where an EJB project could have an Entity bean in it - this should not display the validation error. I am committing a change to HEAD for UIEJB3Validator to fix those scenarios.
One last, last change - the org.eclipse.jst.ejb.ui.internal.quickfixes.ejb was not listed in the Export-Package section of the MANIFEST.MF for org.eclipse.jst.ejb.ui. I am adding it in as an internal package.