Detecting deployment location errors for xml files using a JEE schema

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

Detecting deployment location errors for xml files using a JEE schema

Paul Robinson
A common problem I see again and again is when people miss-spell the
filenames of XML artefacts that live in the META-INF and WEB-INF
directories of a JEE archive. I also see people (myself included)
putting these artefacts in the wrong location, For example, putting the
beans.xml file in the META-INF of a .war when it belongs in the WEB-INF.
This can cause a big headache as it looks like you have created the
right artifact, but it is not taking effect. It would be great if we
could detect this type of thing and warn the developer at deploy time.
There seems to be a move towards using marker files (beans.xml,
faces-config.xml) to enable technologies, so this issue could become
more prevalent.

One solution, I was thinking about, is to check the schema type of all
the XML files in the META-INF and WEB-INF directories. For each schema
that we recognize (http://java.sun.com/xml/ns/persistence for example),
we check that it's file name is correct and it is in a location where it
will be processed.

Does this sound like a sensible thing for us to do?

Paul.

--
Paul Robinson
Web service transactions lead
[hidden email]

JBoss, a Division of Red Hat
Registered in England and Wales under Company Registration No. 03798903
Directors: Michael Cunningham (USA), Brendan Lane (Ireland), Matt Parson
(USA), Charlie Peters (USA)

_______________________________________________
jboss-as7-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
Reply | Threaded
Open this post in threaded view
|

Re: Detecting deployment location errors for xml files using a JEE schema

Jim Tyrrell
I think this is a great idea....

Jim Tyrrell
Principal JBoss Solutions Architect








On Feb 24, 2012, at 7:36 AM, Paul Robinson wrote:

A common problem I see again and again is when people miss-spell the
filenames of XML artefacts that live in the META-INF and WEB-INF
directories of a JEE archive. I also see people (myself included)
putting these artefacts in the wrong location, For example, putting the
beans.xml file in the META-INF of a .war when it belongs in the WEB-INF.
This can cause a big headache as it looks like you have created the
right artifact, but it is not taking effect. It would be great if we
could detect this type of thing and warn the developer at deploy time.
There seems to be a move towards using marker files (beans.xml,
faces-config.xml) to enable technologies, so this issue could become
more prevalent.

One solution, I was thinking about, is to check the schema type of all
the XML files in the META-INF and WEB-INF directories. For each schema
that we recognize (<a href="http://java.sun.com/xml/ns/persistence for example">http://java.sun.com/xml/ns/persistence for example),
we check that it's file name is correct and it is in a location where it
will be processed.

Does this sound like a sensible thing for us to do?

Paul.

--
Paul Robinson
Web service transactions lead
[hidden email]

JBoss, a Division of Red Hat
Registered in England and Wales under Company Registration No. 03798903
Directors: Michael Cunningham (USA), Brendan Lane (Ireland), Matt Parson
(USA), Charlie Peters (USA)

_______________________________________________
jboss-as7-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/jboss-as7-dev


_______________________________________________
jboss-as7-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
Reply | Threaded
Open this post in threaded view
|

Re: Detecting deployment location errors for xml files using a JEE schema

jtgreene
Administrator
In reply to this post by Paul Robinson
On 2/24/12 8:36 AM, Paul Robinson wrote:

> A common problem I see again and again is when people miss-spell the
> filenames of XML artefacts that live in the META-INF and WEB-INF
> directories of a JEE archive. I also see people (myself included)
> putting these artefacts in the wrong location, For example, putting the
> beans.xml file in the META-INF of a .war when it belongs in the WEB-INF.
> This can cause a big headache as it looks like you have created the
> right artifact, but it is not taking effect. It would be great if we
> could detect this type of thing and warn the developer at deploy time.
> There seems to be a move towards using marker files (beans.xml,
> faces-config.xml) to enable technologies, so this issue could become
> more prevalent.
>
> One solution, I was thinking about, is to check the schema type of all
> the XML files in the META-INF and WEB-INF directories. For each schema
> that we recognize (http://java.sun.com/xml/ns/persistence for example),
> we check that it's file name is correct and it is in a location where it
> will be processed.
>
> Does this sound like a sensible thing for us to do?

I think the idea is good, but looking at the content of all xml files
would slow down deployment time, especially for large complex nested
deployments. So if we did this as part of deployment it would be more
efficient to do it based on file name matching. Common misspellings
could be checked for using a static map. So I would still prefer
extensive checking like this to be an optional deployment tool/maven
task. If however someone comes up with a patch which is able to
demonstrate no significant delay, we would certain reconsider.

--
Jason T. Greene
JBoss AS Lead / EAP Platform Architect
JBoss, a division of Red Hat
_______________________________________________
jboss-as7-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
Reply | Threaded
Open this post in threaded view
|

Re: Detecting deployment location errors for xml files using a JEE schema

Scott Marlow
In reply to this post by Paul Robinson
I like the idea but wonder what the implementation will look like.  I
think detecting deployment errors and giving good error messages, is a
great idea (improving the developer experience).  I think having some
additional thread-local context available to deployers would help.  I'm
thinking that some base deployment exception class could get additional
context from the thread-local to show in the deployment exception (e.g.
class name that contains a bad annotation and other app details).
Higher level deployment code, would add details to the thread-local that
they want included in lower level deployment exceptions.  We probably
need to start with very specific deployment errors that we want to
present (like noticing a persistence.xml in the wrong place) and build
it up from there.  I'm interested in helping with this if we can agree
on how we want to get started (this approach or something else).

I think we should also include improving the runtime experience as well,
as much as possible by improving error messages to be more
understandable as much as possible.  For example, JBTM-960 improved an
error message to show the actual resource instead of an internal
wrapper.  As we see unclear (runtime) error messages, I'd like to see
them be improved.

At some point, I'd like to see an optional monitor that could collect
details about what occurs in each JTA transaction and report on it.  The
purpose being to reduce the time it takes to understand what happened in
a transaction that didn't complete successfully or to find out how long
each step took. Also, being able to see what happens inside of each
transaction.  We would need a cross project SPI for this that could be
used by JCA/JPA/TM (and some AS.futureVersion).


On 02/24/2012 09:36 AM, Paul Robinson wrote:

> A common problem I see again and again is when people miss-spell the
> filenames of XML artefacts that live in the META-INF and WEB-INF
> directories of a JEE archive. I also see people (myself included)
> putting these artefacts in the wrong location, For example, putting the
> beans.xml file in the META-INF of a .war when it belongs in the WEB-INF.
> This can cause a big headache as it looks like you have created the
> right artifact, but it is not taking effect. It would be great if we
> could detect this type of thing and warn the developer at deploy time.
> There seems to be a move towards using marker files (beans.xml,
> faces-config.xml) to enable technologies, so this issue could become
> more prevalent.
>
> One solution, I was thinking about, is to check the schema type of all
> the XML files in the META-INF and WEB-INF directories. For each schema
> that we recognize (http://java.sun.com/xml/ns/persistence for example),
> we check that it's file name is correct and it is in a location where it
> will be processed.
>
> Does this sound like a sensible thing for us to do?
>
> Paul.
>

_______________________________________________
jboss-as7-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
Reply | Threaded
Open this post in threaded view
|

Re: Detecting deployment location errors for xml files using a JEE schema

Andrig Miller
In reply to this post by jtgreene
Perhaps there could be a "DEBUG" option on the deployers that would do this, and and it could be turned on and off?

Andy

----- Original Message -----

> From: "Jason T. Greene" <[hidden email]>
> To: [hidden email]
> Sent: Friday, February 24, 2012 8:57:34 AM
> Subject: Re: [jboss-as7-dev] Detecting deployment location errors for xml files using a JEE schema
>
> On 2/24/12 8:36 AM, Paul Robinson wrote:
> > A common problem I see again and again is when people miss-spell
> > the
> > filenames of XML artefacts that live in the META-INF and WEB-INF
> > directories of a JEE archive. I also see people (myself included)
> > putting these artefacts in the wrong location, For example, putting
> > the
> > beans.xml file in the META-INF of a .war when it belongs in the
> > WEB-INF.
> > This can cause a big headache as it looks like you have created the
> > right artifact, but it is not taking effect. It would be great if
> > we
> > could detect this type of thing and warn the developer at deploy
> > time.
> > There seems to be a move towards using marker files (beans.xml,
> > faces-config.xml) to enable technologies, so this issue could
> > become
> > more prevalent.
> >
> > One solution, I was thinking about, is to check the schema type of
> > all
> > the XML files in the META-INF and WEB-INF directories. For each
> > schema
> > that we recognize (http://java.sun.com/xml/ns/persistence for
> > example),
> > we check that it's file name is correct and it is in a location
> > where it
> > will be processed.
> >
> > Does this sound like a sensible thing for us to do?
>
> I think the idea is good, but looking at the content of all xml files
> would slow down deployment time, especially for large complex nested
> deployments. So if we did this as part of deployment it would be more
> efficient to do it based on file name matching. Common misspellings
> could be checked for using a static map. So I would still prefer
> extensive checking like this to be an optional deployment tool/maven
> task. If however someone comes up with a patch which is able to
> demonstrate no significant delay, we would certain reconsider.
>
> --
> Jason T. Greene
> JBoss AS Lead / EAP Platform Architect
> JBoss, a division of Red Hat
> _______________________________________________
> jboss-as7-dev mailing list
> [hidden email]
> https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
>
_______________________________________________
jboss-as7-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
Reply | Threaded
Open this post in threaded view
|

Re: Detecting deployment location errors for xml files using a JEE schema

Max Rydahl Andersen-2
alternatively you could have an explicit "sanity-check" operation that you could run on a deployment "after-the-fact" to report issues it finds.

Then have a setting to say if you want this on all deployments or not, but by default run it in case deployments fail.

This would make it easily accessible + not delay the deployment in the "working case" and only pay the price if it fails.

Of course you can still have deployments that doesn't fail but have sanity errors but this is why you should be able to run this after deployment occurred.
/max

On Feb 24, 2012, at 5:48 PM, Andrig Miller wrote:

> Perhaps there could be a "DEBUG" option on the deployers that would do this, and and it could be turned on and off?
>
> Andy
>
> ----- Original Message -----
>> From: "Jason T. Greene" <[hidden email]>
>> To: [hidden email]
>> Sent: Friday, February 24, 2012 8:57:34 AM
>> Subject: Re: [jboss-as7-dev] Detecting deployment location errors for xml files using a JEE schema
>>
>> On 2/24/12 8:36 AM, Paul Robinson wrote:
>>> A common problem I see again and again is when people miss-spell
>>> the
>>> filenames of XML artefacts that live in the META-INF and WEB-INF
>>> directories of a JEE archive. I also see people (myself included)
>>> putting these artefacts in the wrong location, For example, putting
>>> the
>>> beans.xml file in the META-INF of a .war when it belongs in the
>>> WEB-INF.
>>> This can cause a big headache as it looks like you have created the
>>> right artifact, but it is not taking effect. It would be great if
>>> we
>>> could detect this type of thing and warn the developer at deploy
>>> time.
>>> There seems to be a move towards using marker files (beans.xml,
>>> faces-config.xml) to enable technologies, so this issue could
>>> become
>>> more prevalent.
>>>
>>> One solution, I was thinking about, is to check the schema type of
>>> all
>>> the XML files in the META-INF and WEB-INF directories. For each
>>> schema
>>> that we recognize (http://java.sun.com/xml/ns/persistence for
>>> example),
>>> we check that it's file name is correct and it is in a location
>>> where it
>>> will be processed.
>>>
>>> Does this sound like a sensible thing for us to do?
>>
>> I think the idea is good, but looking at the content of all xml files
>> would slow down deployment time, especially for large complex nested
>> deployments. So if we did this as part of deployment it would be more
>> efficient to do it based on file name matching. Common misspellings
>> could be checked for using a static map. So I would still prefer
>> extensive checking like this to be an optional deployment tool/maven
>> task. If however someone comes up with a patch which is able to
>> demonstrate no significant delay, we would certain reconsider.
>>
>> --
>> Jason T. Greene
>> JBoss AS Lead / EAP Platform Architect
>> JBoss, a division of Red Hat
>> _______________________________________________
>> jboss-as7-dev mailing list
>> [hidden email]
>> https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
>>
> _______________________________________________
> jboss-as7-dev mailing list
> [hidden email]
> https://lists.jboss.org/mailman/listinfo/jboss-as7-dev


_______________________________________________
jboss-as7-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
Reply | Threaded
Open this post in threaded view
|

Re: Detecting deployment location errors for xml files using a JEE schema

Radoslaw Rodak
What about adding some info jmx matrics for each deployment with information over used descriptor files...
So the user can see over console which descriptor files jboss has found...
This should not cost to much performance and tell developer what app server found and used on deployment


Am 26.02.2012 um 09:36 schrieb Max Rydahl Andersen:

> alternatively you could have an explicit "sanity-check" operation that you could run on a deployment "after-the-fact" to report issues it finds.
>
> Then have a setting to say if you want this on all deployments or not, but by default run it in case deployments fail.
>
> This would make it easily accessible + not delay the deployment in the "working case" and only pay the price if it fails.
>
> Of course you can still have deployments that doesn't fail but have sanity errors but this is why you should be able to run this after deployment occurred.
> /max
>
> On Feb 24, 2012, at 5:48 PM, Andrig Miller wrote:
>
>> Perhaps there could be a "DEBUG" option on the deployers that would do this, and and it could be turned on and off?
>>
>> Andy
>>
>> ----- Original Message -----
>>> From: "Jason T. Greene" <[hidden email]>
>>> To: [hidden email]
>>> Sent: Friday, February 24, 2012 8:57:34 AM
>>> Subject: Re: [jboss-as7-dev] Detecting deployment location errors for xml files using a JEE schema
>>>
>>> On 2/24/12 8:36 AM, Paul Robinson wrote:
>>>> A common problem I see again and again is when people miss-spell
>>>> the
>>>> filenames of XML artefacts that live in the META-INF and WEB-INF
>>>> directories of a JEE archive. I also see people (myself included)
>>>> putting these artefacts in the wrong location, For example, putting
>>>> the
>>>> beans.xml file in the META-INF of a .war when it belongs in the
>>>> WEB-INF.
>>>> This can cause a big headache as it looks like you have created the
>>>> right artifact, but it is not taking effect. It would be great if
>>>> we
>>>> could detect this type of thing and warn the developer at deploy
>>>> time.
>>>> There seems to be a move towards using marker files (beans.xml,
>>>> faces-config.xml) to enable technologies, so this issue could
>>>> become
>>>> more prevalent.
>>>>
>>>> One solution, I was thinking about, is to check the schema type of
>>>> all
>>>> the XML files in the META-INF and WEB-INF directories. For each
>>>> schema
>>>> that we recognize (http://java.sun.com/xml/ns/persistence for
>>>> example),
>>>> we check that it's file name is correct and it is in a location
>>>> where it
>>>> will be processed.
>>>>
>>>> Does this sound like a sensible thing for us to do?
>>>
>>> I think the idea is good, but looking at the content of all xml files
>>> would slow down deployment time, especially for large complex nested
>>> deployments. So if we did this as part of deployment it would be more
>>> efficient to do it based on file name matching. Common misspellings
>>> could be checked for using a static map. So I would still prefer
>>> extensive checking like this to be an optional deployment tool/maven
>>> task. If however someone comes up with a patch which is able to
>>> demonstrate no significant delay, we would certain reconsider.
>>>
>>> --
>>> Jason T. Greene
>>> JBoss AS Lead / EAP Platform Architect
>>> JBoss, a division of Red Hat
>>> _______________________________________________
>>> jboss-as7-dev mailing list
>>> [hidden email]
>>> https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
>>>
>> _______________________________________________
>> jboss-as7-dev mailing list
>> [hidden email]
>> https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
>
>
> _______________________________________________
> jboss-as7-dev mailing list
> [hidden email]
> https://lists.jboss.org/mailman/listinfo/jboss-as7-dev


_______________________________________________
jboss-as7-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
Reply | Threaded
Open this post in threaded view
|

Re: Detecting deployment location errors for xml files using a JEE schema

Paul Robinson
In reply to this post by Andrig Miller


On 24/02/12 16:48, Andrig Miller wrote:
> Perhaps there could be a "DEBUG" option on the deployers that would do this, and and it could be turned on and off?
This might be the way to go if it turns out to be a costly operation.
During development, i see the user doing many successful deployments,
that do not need this checking in place. However, when setting up a new
application, or adding a new feature, it would make sense to turn this
on, to help troubleshoot.


>
> Andy
>
> ----- Original Message -----
>> From: "Jason T. Greene"<[hidden email]>
>> To: [hidden email]
>> Sent: Friday, February 24, 2012 8:57:34 AM
>> Subject: Re: [jboss-as7-dev] Detecting deployment location errors for xml files using a JEE schema
>>
>> On 2/24/12 8:36 AM, Paul Robinson wrote:
>>> A common problem I see again and again is when people miss-spell
>>> the
>>> filenames of XML artefacts that live in the META-INF and WEB-INF
>>> directories of a JEE archive. I also see people (myself included)
>>> putting these artefacts in the wrong location, For example, putting
>>> the
>>> beans.xml file in the META-INF of a .war when it belongs in the
>>> WEB-INF.
>>> This can cause a big headache as it looks like you have created the
>>> right artifact, but it is not taking effect. It would be great if
>>> we
>>> could detect this type of thing and warn the developer at deploy
>>> time.
>>> There seems to be a move towards using marker files (beans.xml,
>>> faces-config.xml) to enable technologies, so this issue could
>>> become
>>> more prevalent.
>>>
>>> One solution, I was thinking about, is to check the schema type of
>>> all
>>> the XML files in the META-INF and WEB-INF directories. For each
>>> schema
>>> that we recognize (http://java.sun.com/xml/ns/persistence for
>>> example),
>>> we check that it's file name is correct and it is in a location
>>> where it
>>> will be processed.
>>>
>>> Does this sound like a sensible thing for us to do?
>> I think the idea is good, but looking at the content of all xml files
>> would slow down deployment time, especially for large complex nested
>> deployments. So if we did this as part of deployment it would be more
>> efficient to do it based on file name matching. Common misspellings
>> could be checked for using a static map. So I would still prefer
>> extensive checking like this to be an optional deployment tool/maven
>> task. If however someone comes up with a patch which is able to
>> demonstrate no significant delay, we would certain reconsider.
>>
>> --
>> Jason T. Greene
>> JBoss AS Lead / EAP Platform Architect
>> JBoss, a division of Red Hat
>> _______________________________________________
>> jboss-as7-dev mailing list
>> [hidden email]
>> https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
>>
> _______________________________________________
> jboss-as7-dev mailing list
> [hidden email]
> https://lists.jboss.org/mailman/listinfo/jboss-as7-dev

--
Paul Robinson
Web service transactions lead
[hidden email]

JBoss, a Division of Red Hat
Registered in England and Wales under Company Registration No. 03798903
Directors: Michael Cunningham (USA), Brendan Lane (Ireland), Matt Parson
(USA), Charlie Peters (USA)

_______________________________________________
jboss-as7-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
Reply | Threaded
Open this post in threaded view
|

Re: Detecting deployment location errors for xml files using a JEE schema

Paul Robinson
In reply to this post by jtgreene


On 24/02/12 15:57, Jason T. Greene wrote:

> On 2/24/12 8:36 AM, Paul Robinson wrote:
>> A common problem I see again and again is when people miss-spell the
>> filenames of XML artefacts that live in the META-INF and WEB-INF
>> directories of a JEE archive. I also see people (myself included)
>> putting these artefacts in the wrong location, For example, putting the
>> beans.xml file in the META-INF of a .war when it belongs in the WEB-INF.
>> This can cause a big headache as it looks like you have created the
>> right artifact, but it is not taking effect. It would be great if we
>> could detect this type of thing and warn the developer at deploy time.
>> There seems to be a move towards using marker files (beans.xml,
>> faces-config.xml) to enable technologies, so this issue could become
>> more prevalent.
>>
>> One solution, I was thinking about, is to check the schema type of all
>> the XML files in the META-INF and WEB-INF directories. For each schema
>> that we recognize (http://java.sun.com/xml/ns/persistence for example),
>> we check that it's file name is correct and it is in a location where it
>> will be processed.
>>
>> Does this sound like a sensible thing for us to do?
> I think the idea is good, but looking at the content of all xml files
> would slow down deployment time, especially for large complex nested
> deployments. So if we did this as part of deployment it would be more
> efficient to do it based on file name matching. Common misspellings
> could be checked for using a static map. So I would still prefer
> extensive checking like this to be an optional deployment tool/maven
> task. If however someone comes up with a patch which is able to
> demonstrate no significant delay, we would certain reconsider.
>
Would scanning common locations (/, WEB-INF, META-INF...) be that
costly? I don't think we would need to scan the entire archive, to spot
common problems. Also, I would have thought you could obtain the
document schema without parsing the whole XML file.

Paul.

--
Paul Robinson
Web service transactions lead
[hidden email]

JBoss, a Division of Red Hat
Registered in England and Wales under Company Registration No. 03798903
Directors: Michael Cunningham (USA), Brendan Lane (Ireland), Matt Parson
(USA), Charlie Peters (USA)

_______________________________________________
jboss-as7-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
Reply | Threaded
Open this post in threaded view
|

Re: Detecting deployment location errors for xml files using a JEE schema

Carlo de Wolf
In reply to this post by jtgreene
On 02/24/2012 04:57 PM, Jason T. Greene wrote:

> On 2/24/12 8:36 AM, Paul Robinson wrote:
>> A common problem I see again and again is when people miss-spell the
>> filenames of XML artefacts that live in the META-INF and WEB-INF
>> directories of a JEE archive. I also see people (myself included)
>> putting these artefacts in the wrong location, For example, putting the
>> beans.xml file in the META-INF of a .war when it belongs in the WEB-INF.
>> This can cause a big headache as it looks like you have created the
>> right artifact, but it is not taking effect. It would be great if we
>> could detect this type of thing and warn the developer at deploy time.
>> There seems to be a move towards using marker files (beans.xml,
>> faces-config.xml) to enable technologies, so this issue could become
>> more prevalent.
>>
>> One solution, I was thinking about, is to check the schema type of all
>> the XML files in the META-INF and WEB-INF directories. For each schema
>> that we recognize (http://java.sun.com/xml/ns/persistence for example),
>> we check that it's file name is correct and it is in a location where it
>> will be processed.
>>
>> Does this sound like a sensible thing for us to do?
> I think the idea is good, but looking at the content of all xml files
> would slow down deployment time, especially for large complex nested
> deployments. So if we did this as part of deployment it would be more
> efficient to do it based on file name matching. Common misspellings
> could be checked for using a static map. So I would still prefer
> extensive checking like this to be an optional deployment tool/maven
> task. If however someone comes up with a patch which is able to
> demonstrate no significant delay, we would certain reconsider.
>
How about we simple look through META-INF/* and INFO anything that we
can't process?
Keeping a simple configuration in domain with white/black list expressions.

Carlo
_______________________________________________
jboss-as7-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
Reply | Threaded
Open this post in threaded view
|

Re: Detecting deployment location errors for xml files using a JEE schema

Paul Robinson
In reply to this post by Max Rydahl Andersen-2
This seems to give us a good compromise. From the users point of view it
would look the same as if it was done as part of deployment, but it
doesn't affect the deployment time.

As Andy said, it would probably still make sense to allow this to be
turned off. There may be a number of false positives displayed which the
user will have to hunt through when searching for the outcome of the
deployment in the log.

Paul.

On 26/02/12 08:36, Max Rydahl Andersen wrote:

> alternatively you could have an explicit "sanity-check" operation that you could run on a deployment "after-the-fact" to report issues it finds.
>
> Then have a setting to say if you want this on all deployments or not, but by default run it in case deployments fail.
>
> This would make it easily accessible + not delay the deployment in the "working case" and only pay the price if it fails.
>
> Of course you can still have deployments that doesn't fail but have sanity errors but this is why you should be able to run this after deployment occurred.
> /max
>
> On Feb 24, 2012, at 5:48 PM, Andrig Miller wrote:
>
>> Perhaps there could be a "DEBUG" option on the deployers that would do this, and and it could be turned on and off?
>>
>> Andy
>>
>> ----- Original Message -----
>>> From: "Jason T. Greene"<[hidden email]>
>>> To: [hidden email]
>>> Sent: Friday, February 24, 2012 8:57:34 AM
>>> Subject: Re: [jboss-as7-dev] Detecting deployment location errors for xml files using a JEE schema
>>>
>>> On 2/24/12 8:36 AM, Paul Robinson wrote:
>>>> A common problem I see again and again is when people miss-spell
>>>> the
>>>> filenames of XML artefacts that live in the META-INF and WEB-INF
>>>> directories of a JEE archive. I also see people (myself included)
>>>> putting these artefacts in the wrong location, For example, putting
>>>> the
>>>> beans.xml file in the META-INF of a .war when it belongs in the
>>>> WEB-INF.
>>>> This can cause a big headache as it looks like you have created the
>>>> right artifact, but it is not taking effect. It would be great if
>>>> we
>>>> could detect this type of thing and warn the developer at deploy
>>>> time.
>>>> There seems to be a move towards using marker files (beans.xml,
>>>> faces-config.xml) to enable technologies, so this issue could
>>>> become
>>>> more prevalent.
>>>>
>>>> One solution, I was thinking about, is to check the schema type of
>>>> all
>>>> the XML files in the META-INF and WEB-INF directories. For each
>>>> schema
>>>> that we recognize (http://java.sun.com/xml/ns/persistence for
>>>> example),
>>>> we check that it's file name is correct and it is in a location
>>>> where it
>>>> will be processed.
>>>>
>>>> Does this sound like a sensible thing for us to do?
>>> I think the idea is good, but looking at the content of all xml files
>>> would slow down deployment time, especially for large complex nested
>>> deployments. So if we did this as part of deployment it would be more
>>> efficient to do it based on file name matching. Common misspellings
>>> could be checked for using a static map. So I would still prefer
>>> extensive checking like this to be an optional deployment tool/maven
>>> task. If however someone comes up with a patch which is able to
>>> demonstrate no significant delay, we would certain reconsider.
>>>
>>> --
>>> Jason T. Greene
>>> JBoss AS Lead / EAP Platform Architect
>>> JBoss, a division of Red Hat
>>> _______________________________________________
>>> jboss-as7-dev mailing list
>>> [hidden email]
>>> https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
>>>
>> _______________________________________________
>> jboss-as7-dev mailing list
>> [hidden email]
>> https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
>
> _______________________________________________
> jboss-as7-dev mailing list
> [hidden email]
> https://lists.jboss.org/mailman/listinfo/jboss-as7-dev

--
Paul Robinson
Web service transactions lead
[hidden email]

JBoss, a Division of Red Hat
Registered in England and Wales under Company Registration No. 03798903
Directors: Michael Cunningham (USA), Brendan Lane (Ireland), Matt Parson
(USA), Charlie Peters (USA)

_______________________________________________
jboss-as7-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
Reply | Threaded
Open this post in threaded view
|

Re: Detecting deployment location errors for xml files using a JEE schema

Paul Robinson
In reply to this post by Scott Marlow


On 24/02/12 16:01, Scott Marlow wrote:
> At some point, I'd like to see an optional monitor that could collect
> details about what occurs in each JTA transaction and report on it.  The
> purpose being to reduce the time it takes to understand what happened in
> a transaction that didn't complete successfully or to find out how long
> each step took. Also, being able to see what happens inside of each
> transaction.  We would need a cross project SPI for this that could be
> used by JCA/JPA/TM (and some AS.futureVersion).
I'm not sure this is related to this issue. However, this is something
I've thought would be handy for many years. I was thinking about a tool
that would visualise a transaction, showing what boundaries it crossed
and what resources where enlisted within each boundary. You could also
see participant votes in 2PC and any other reason why a rollback occured
(presumed abort, for example). Also, we now have bridging between
different transaction types (currently WS-AT to JTA and visa versa, but
more to come). It could be useful to visualize the transaction types and
where bridging occurs.

Is this the type of thing you where thinking about?

I originally offered a simplification of this as an internship project.
I'll see if I can dig out the spec.

Paul.

>
>
> On 02/24/2012 09:36 AM, Paul Robinson wrote:
>> A common problem I see again and again is when people miss-spell the
>> filenames of XML artefacts that live in the META-INF and WEB-INF
>> directories of a JEE archive. I also see people (myself included)
>> putting these artefacts in the wrong location, For example, putting the
>> beans.xml file in the META-INF of a .war when it belongs in the WEB-INF.
>> This can cause a big headache as it looks like you have created the
>> right artifact, but it is not taking effect. It would be great if we
>> could detect this type of thing and warn the developer at deploy time.
>> There seems to be a move towards using marker files (beans.xml,
>> faces-config.xml) to enable technologies, so this issue could become
>> more prevalent.
>>
>> One solution, I was thinking about, is to check the schema type of all
>> the XML files in the META-INF and WEB-INF directories. For each schema
>> that we recognize (http://java.sun.com/xml/ns/persistence for example),
>> we check that it's file name is correct and it is in a location where it
>> will be processed.
>>
>> Does this sound like a sensible thing for us to do?
>>
>> Paul.
>>
> _______________________________________________
> jboss-as7-dev mailing list
> [hidden email]
> https://lists.jboss.org/mailman/listinfo/jboss-as7-dev

--
Paul Robinson
Web service transactions lead
[hidden email]

JBoss, a Division of Red Hat
Registered in England and Wales under Company Registration No. 03798903
Directors: Michael Cunningham (USA), Brendan Lane (Ireland), Matt Parson
(USA), Charlie Peters (USA)

_______________________________________________
jboss-as7-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
Reply | Threaded
Open this post in threaded view
|

Re: Detecting deployment location errors for xml files using a JEE schema

Paul Robinson
In reply to this post by Carlo de Wolf


On 29/02/12 11:51, Carlo de Wolf wrote:

> On 02/24/2012 04:57 PM, Jason T. Greene wrote:
>> On 2/24/12 8:36 AM, Paul Robinson wrote:
>>> A common problem I see again and again is when people miss-spell the
>>> filenames of XML artefacts that live in the META-INF and WEB-INF
>>> directories of a JEE archive. I also see people (myself included)
>>> putting these artefacts in the wrong location, For example, putting the
>>> beans.xml file in the META-INF of a .war when it belongs in the WEB-INF.
>>> This can cause a big headache as it looks like you have created the
>>> right artifact, but it is not taking effect. It would be great if we
>>> could detect this type of thing and warn the developer at deploy time.
>>> There seems to be a move towards using marker files (beans.xml,
>>> faces-config.xml) to enable technologies, so this issue could become
>>> more prevalent.
>>>
>>> One solution, I was thinking about, is to check the schema type of all
>>> the XML files in the META-INF and WEB-INF directories. For each schema
>>> that we recognize (http://java.sun.com/xml/ns/persistence for example),
>>> we check that it's file name is correct and it is in a location where it
>>> will be processed.
>>>
>>> Does this sound like a sensible thing for us to do?
>> I think the idea is good, but looking at the content of all xml files
>> would slow down deployment time, especially for large complex nested
>> deployments. So if we did this as part of deployment it would be more
>> efficient to do it based on file name matching. Common misspellings
>> could be checked for using a static map. So I would still prefer
>> extensive checking like this to be an optional deployment tool/maven
>> task. If however someone comes up with a patch which is able to
>> demonstrate no significant delay, we would certain reconsider.
>>
> How about we simple look through META-INF/* and INFO anything that we
> can't process?
> Keeping a simple configuration in domain with white/black list expressions.
Sounds like it hits my requirements:

1) User puts a file in the wrong location. As long as they put it in a
"sensible" location, we flag it as not processed.
2) User puts a file in the right location but with a typo in the name.
We flag it as not processed.

It wouldn't be quite as usable as the more expensive approach. As the
warning would look like this:

"Found unexpected 'beans.xml' in /META-INF. The file was not processed
as it was in the wrong location and/or was not named correctly"

With more information we could say:

"Found unexpected 'beans.xml' in /META-INF. This file should be located
in /WEB-INF."

It seems like the two simplest approaches are:

1) This approach, which has reduced usability due to the available
information for warning messgaes
2) Max's approach of delaying checking till after deployment. This
approach can display better warning messages, but potentially adds noise
after the "deployment complete" log line.

Paul.

--
Paul Robinson
Web service transactions lead
[hidden email]

JBoss, a Division of Red Hat
Registered in England and Wales under Company Registration No. 03798903
Directors: Michael Cunningham (USA), Brendan Lane (Ireland), Matt Parson
(USA), Charlie Peters (USA)

_______________________________________________
jboss-as7-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/jboss-as7-dev