NetBeans does not detect Apache TomEE as a Java EE 6 Application Server. TomEE is Tomcat bundled with openejb. I've done some digging and it appears that NetBeans traverses the project classpath and matches any file names starting with "openejb-tomcat". The TomEE developers have changed some of their file names and in fact there are multiple files that begin with "openejb-", just not one that is called "openejb-tomcat-*.jar". Could we please change how NetBeans detects openejb inside Tomcat / TomEE? Maybe you can simple check for "openejb-" and not "openejb-tomcat"?
That would help greatly as there are quite a few users out there that would like to use TomEE as their Java EE server under NetBeans but currently run into issues, e.g. JSF Pages from Entity Classes wizard refuses to continue.
Actually support for the Apache TomEE is planned into the NetBeans 8.0. I'm reassigning the issue to the TomEE support author. But I suppose that issues you crossed are already fixed.
Should be already fixed in dev builds.
Thanks, Petr. Is that dev build available somewhere for download so I can test it maybe?
Created attachment 141562 [details]
TomEE Resources.xml with odd back slashes in JDBC URL
URL should look like this:
I downloaded NetBeans trunk and tested TomEE support with TomEE 1.5.2. I generated entities using the Entity Classes from Database wizard and it prompted me to create a new data source. This is greate news for TomEE users since that feature had been there for Glassfish users for a long time.
However, the resources.xml file as some odd back-slashes in the JDBC URL. I've attached a file to this bug report. The application I generated was using my own nbpfcrudgen module (it's a PrimeFaces CRUD app) and the application deploys to TomEE sucessfully. So the JDBC URL doesn't seem to have a negative effect on deployment. It just looks odd.
(In reply to kwrobel from comment #6)
> Hi Petr,
> I downloaded NetBeans trunk and tested TomEE support with TomEE 1.5.2. I
> generated entities using the Entity Classes from Database wizard and it
> prompted me to create a new data source. This is greate news for TomEE users
> since that feature had been there for Glassfish users for a long time.
Glad to hear that.
> However, the resources.xml file as some odd back-slashes in the JDBC URL.
> I've attached a file to this bug report. The application I generated was
> using my own nbpfcrudgen module (it's a PrimeFaces CRUD app) and the
> application deploys to TomEE sucessfully. So the JDBC URL doesn't seem to
> have a negative effect on deployment. It just looks odd.
Well I'm not sure about TomEE internals, but if we assume the properties stored in resources.xml are java properties all the colons should be escaped with backslashes. So I would assume escaped colons are safer unless we found out that TomEE guarantees it would work in all cases without escaping.
I don't know about them guaranteeing anything, but it seems that since JDBC URLs are typically written the way without the backslashes, it would make sense that that's the way to go. Btw, you don't do that for the glassfish-resources.xml file. So why start with TomEE?
Here's a link to their reference: http://tomee.apache.org/datasource-config.html
and some sample configs: http://tomee.apache.org/common-datasource-configurations.html
None of those common data sources have any back-slashes.
Also, the file is poorly formatted.
(In reply to kwrobel from comment #8)
> I don't know about them guaranteeing anything, but it seems that since JDBC
> URLs are typically written the way without the backslashes, it would make
> sense that that's the way to go. Btw, you don't do that for the
> glassfish-resources.xml file. So why start with TomEE?
Well, it's not about url in general. It is because the content of element is just properties text. If it would not use properties it would be without backslashes. So it is also explanation for GlassFish the content of element in GF is xml string.
> Here's a link to their reference:
> and some sample configs:
> None of those common data sources have any back-slashes.
> Also, the file is poorly formatted.
Not sure if we can do something about that (without investing huge amount of time).
We use Properties.store().
I'm not saying your request does not make sense. I'm just explaining the current state and want to be sure we won't brake anything.
The good news is: it's working.
So, isn't there an API function inside NetBeans that performs the equivalent of an SHIFT-ALT+f (format file)? I would think it's just one more call to add after the file has been generated. What do you think?
Petr and Martin: I am reopening this bug because detection for TomEE in NetBeans 8 seems to be broken when you use TomEE 22.214.171.124, their current stable build, vs. 1.6.0, their previous stable build. I have already looked at the source code and identified the issue.
In TomcatFactory.java, there is a a pattern match for tomee-common.x.x.x.jar. Unfortunately, that doesn't work with tomee-common.x.x.x.x.jar. Or even if I was using a snapshot version and the jar would be tomee-common.x.x.x-snapshot.jar wouldn't work. I am proposing a different Regex pattern for the detection of the TomEE version. This affects the three static variables:
I'm taking TOMEE_JAR_PATTERN as an example, and I have tested this in my own test environment. Instead of
I tried this
I have tested the following jar iterations with positive results (simply by renaming that one file in the lib folder):
* tomee-common-1.6.0.jar (getTomeeEEVersion returns "1.6.0")
* tomee-common-126.96.36.199.jar (getTomeeEEVersion returns "188.8.131.52")
* tomee-common-184.108.40.206-snapshot.jar (getTomeeEEVersion returns "220.127.116.11")
* tomee-common-18.104.22.168a-snapshot.jar (getTomeeEEVersion returns "22.214.171.124")
* tomee-common-126.96.36.199.17.jar (getTomeeEEVersion returns "188.8.131.52.17")
In all cases, NetBeans allowed me to use the JSF Pages from Entity wizard without showing an error on screen, and it also behaved differently on the Entity from Database wizard where it prompted me to create a new Data Source (make persistence.xml use a JTA resource) instead of simply picking a Database Connection (makes persistence.xml a non-JTA resource).
Could you please implement this change as soon as possible as TomEE users are really stuck with these messages and don't know what to do. So they probably don't use TomEE with NetBeans.
Fixed in web-main 45f23ea3e7c2.
Thanks for your help. Next time please file a separate issue. Thanks again.
Integrated into 'main-silver', will be available in build *201407160001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
User: Petr Hejl <firstname.lastname@example.org>
Log: #237453 - Apache TomEE / OpenEJB Detection
Awesome. Thank you, Petr, for addressing the issue so quickly. And sorry for not opening a new bug for this. I felt the issue was still related to this bug.
So is this going to roll out via NetBeans update feature, or will it become part of a new NetBeans version rollout?
(In reply to kwrobel from comment #14)
> So is this going to roll out via NetBeans update feature, or will it become
> part of a new NetBeans version rollout?
Expect it in the upcoming release.