• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

Corrupted WEB XML File

 
Ranch Hand
Posts: 1964
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have set the Rational Application Developer up on a new computer.

I am moving some servlets from one package to another.
When I do some random line of code in the web.xml gets corrupted.
Another thing that happens is the move function will not work on a subsequent file unless I close the development environment and open it again.

I had this trouble before on my previous computer but at some point I was prompted to do some function on the web.xml to sync it or something to that affect.

I really can't remember the details but after I did this I never had these issues again.
 
Marshal
Posts: 6639
177
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know Rational Application Developer, but maybe someone else here does.  You might get better responses on a forum dedicated to RAD.
 
Saloon Keeper
Posts: 2940
373
Android Eclipse IDE Angular Framework MySQL Database TypeScript Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Steve Dyke wrote:When I do some random line of code in the web.xml gets corrupted.


It's not really clear (to me) what is happening.

Where are you making the code change (web.xml, servlet, ??), and specifically what do you mean by gets corrupted?  Can you share examples or explain further?
 
Steve Dyke
Ranch Hand
Posts: 1964
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Ron McLeod wrote:

Steve Dyke wrote:When I do some random line of code in the web.xml gets corrupted.


It's not really clear (to me) what is happening.

Where are you making the code change (web.xml, servlet, ??), and specifically what do you mean by gets corrupted?  Can you share examples or explain further?



Within my Project Explorer view I right click on a servlet class file???, click the Refactor option, click the Move option, select the package I want to move the servlet class file??? to.
At this point the web.xml does not get auto updated with the selected package path. I open web.xml to search for the servlet.
The servlet definition name will be located in three areas. The normal definition as expected, the mapping area as expected, and the unexpected(what I am calling corrupted). The servlet name will be imbedded into a totally unrelated servlet definition.    
 
Ron McLeod
Saloon Keeper
Posts: 2940
373
Android Eclipse IDE Angular Framework MySQL Database TypeScript Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Steve Dyke wrote:At this point the web.xml does not get auto updated with the selected package path.


Is that supposed to happen?  

I just tried creating a version 2.5 Dynamic Web Project using Eclipse 2019-03.  The web.xml file was created and initialized as expected.  When I created a new Servlet it was automatically populated in the web.xml descriptor, but when I renamed the Servlet, or moved it to a different package, the web.xml descriptor was not changed, and I needed to update the <servlet-class> element manually.

Also, do you really need to use a web.xml descriptor?  Starting with Servlet version 3.0 (Java EE 6?), the configuration can be done using annotations (unless this is a Rational Application Developer ism).
 
Steve Dyke
Ranch Hand
Posts: 1964
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Ron McLeod wrote:

Also, do you really need to use a web.xml descriptor?  Starting with Servlet version 3.0 (Java EE 6?), the configuration can be done using annotations (unless this is a Rational Application Developer ism).



Yes this is RAD.

I am not simply changing the servlet name. I am moving it from one package to another.
 
Ron McLeod
Saloon Keeper
Posts: 2940
373
Android Eclipse IDE Angular Framework MySQL Database TypeScript Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Ron McLeod wrote:... when I renamed the Servlet, or moved it to a different package, the web.xml descriptor was not changed, and I needed to update the <servlet-class> element manually ...



Ahh .. it looks like why it didn't update for me was because I didn't check the Update fully qualified names in non-Java file option when I performed the move.  After doing that, the web.xml descriptor does in-fact get updated properly.  Are you already doing this?



 
Steve Dyke
Ranch Hand
Posts: 1964
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Ron McLeod wrote:

Ron McLeod wrote:... when I renamed the Servlet, or moved it to a different package, the web.xml descriptor was not changed, and I needed to update the <servlet-class> element manually ...



Ahh .. it looks like why it didn't update for me was because I didn't check the Update fully qualified names in non-Java file option when I performed the move.  After doing that, the web.xml descriptor does in-fact get updated properly.  Are you already doing this?



Sorry it has taken so long to get back to you on this.

I have selected the option you suggested. Then I click the preview I get this dialog box message:

Move compilation unit 'ShippingDocumentPackageDataControllerV8.java' to 'com.FAIWebApp._shipping.controllers.

Original Source
<servlet>
<description>
</description>
<display-name>
MOTrackingOPProcessUserOPEmailListServlet</display-name>
<servlet-name>MOTrackingOPProcessUserOPEmailListServlet</servlet-name>
<servlet-class>
com.FAIWebApp.supplierquality.MOTrackingOPProcessUserOPEmailListServlet</servlet-class>
</servlet>

Refactored Source
<servlet>
<description>
</description>
<display-name>
MOTrackingOPProcessUserOPEmailListServlet</display-name>com.FAIWebApp._shipping.controllers.ShippingDocumentPackageDataControllerServletV8s>
com.FAIWebApp.supplierquality.MOTrackingOPProcessUserOPEmailListServlet</servlet-class>
</servlet>

If I proceed then I have to manually adjust the web.xml.
Also. the move process will hang on the next one I try unless I close RAD and reopen it.
 
"To do good, you actually have to do something." -- Yvon Chouinard
Sauce Labs - World's Largest Continuous Testing Cloud for Websites and Mobile Apps
https://coderanch.com/t/722574/Sauce-Labs-World-Largest-Continuous
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!