Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
Bug 237453 - Apache TomEE / OpenEJB Detection
Apache TomEE / OpenEJB Detection
Status: RESOLVED FIXED
Product: serverplugins
Classification: Unclassified
Component: TomEE
8.0
All All
: P4 with 3 votes (vote)
: 8.0
Assigned To: issues@serverplugins
issues@serverplugins
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-10-21 22:05 UTC by kwrobel
Modified: 2014-07-18 19:38 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
:


Attachments
TomEE Resources.xml with odd back slashes in JDBC URL (279 bytes, text/xml)
2013-10-25 16:20 UTC, kwrobel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description kwrobel 2013-10-21 22:05:08 UTC
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.
Comment 1 Martin Fousek 2013-10-22 07:49:40 UTC
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.
Comment 2 Petr Hejl 2013-10-22 07:57:37 UTC
Should be already fixed in dev builds.
Comment 3 kwrobel 2013-10-24 22:12:34 UTC
Thanks, Petr. Is that dev build available somewhere for download so I can test it maybe?
Comment 5 kwrobel 2013-10-25 16:20:24 UTC
Created attachment 141562 [details]
TomEE Resources.xml with odd back slashes in JDBC URL

URL should look like this:
jdbcUrl=jdbc:derby://localhost:1527/sample
Comment 6 kwrobel 2013-10-25 16:23:49 UTC
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.

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.
Comment 7 Petr Hejl 2013-10-25 16:49:43 UTC
(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.
Comment 8 kwrobel 2013-10-25 17:06:14 UTC
Petr:

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.
Comment 9 Petr Hejl 2013-10-25 17:16:38 UTC
(In reply to kwrobel from comment #8)
> Petr:
> 
> 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:
> 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.
>
Ok.
 
> 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.
Comment 10 kwrobel 2013-10-25 17:38:45 UTC
Thanks, Petr.

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?
Comment 11 kwrobel 2014-07-15 14:03:31 UTC
Petr and Martin: I am reopening this bug because detection for TomEE in NetBeans 8 seems to be broken when you use TomEE 1.6.0.2, 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:

* TOMEE_JAR_PATTERN
* TOMEE_JAXRS_JAR_PATTERN
* TOMEE_GERONIMO_JAR_PATTERN

I'm taking TOMEE_JAR_PATTERN as an example, and I have tested this in my own test environment. Instead of

    "tomee-common-(\\d+\\.\\d+\\.\\d+)\\.jar"

I tried this

    "tomee-common-(\\d+(\\.\\d+)*).*\\.jar"

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-1.6.0.2.jar           (getTomeeEEVersion returns "1.6.0.2")
* tomee-common-1.6.0.3-snapshot.jar  (getTomeeEEVersion returns "1.6.0.3")
* tomee-common-1.6.0.3a-snapshot.jar (getTomeeEEVersion returns "1.6.0.3")
* tomee-common-1.6.0.3.17.jar        (getTomeeEEVersion returns "1.6.0.3.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.

Thanks.
Comment 12 Petr Hejl 2014-07-15 14:53:42 UTC
Fixed in web-main 45f23ea3e7c2.

Thanks for your help. Next time please file a separate issue. Thanks again.
Comment 13 Quality Engineering 2014-07-16 01:44:39 UTC
Integrated into 'main-silver', will be available in build *201407160001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/45f23ea3e7c2
User: Petr Hejl <phejl@netbeans.org>
Log: #237453 - Apache TomEE / OpenEJB Detection
Comment 14 kwrobel 2014-07-18 15:19:52 UTC
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?
Comment 15 Petr Hejl 2014-07-18 19:38:01 UTC
(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.


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo