Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error with web.xml

 
sam White
Ranch Hand
Posts: 229
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I created a spring maven project in Netbeans 7. When I ececute Clean and Build, it generated the following errors:



Here is the pom.xml of the project:



WebContent/WEB-INF/web.xml file is:



What is wrong with my project configuration?

Thanks in advance for any suggestion and help.

Sam
 
N Sahni
Ranch Hand
Posts: 55
Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Maven by default looks for web.xml at location: src/main/webapp/WEB-INF/web.xml.
If your web.xml is at right place, you can try giving location explicitly in your pom.xml file as:
 
sam White
Ranch Hand
Posts: 229
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for the suggestion, I can progress further now, with further errors:



Here is my beans.xml file:



What is wrong with my project configuration?

Thanks
Sam
 
sam White
Ranch Hand
Posts: 229
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I uncomment the lines for the "<imports..." it shown a different error.

beans.xml file with "<import..." lines:




Errors:



Thanks
Sam
 
Tommy Delson
Ranch Hand
Posts: 206
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In web.xml you didn't specified the correct path and file cxf.xml on the contextConfigLocation as you defined in beans.xml import statement.
 
sam White
Ranch Hand
Posts: 229
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, thank you for your suggestion.
I don't have cxf.xml.
Where is this file and how to create one for my project?

Thanks
Sam
 
sam White
Ranch Hand
Posts: 229
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is my web.xml file:



But I don't know where and how to define a cxf.xml file.

Thanks
Sam
 
sam White
Ranch Hand
Posts: 229
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I really think that I have missing some cxf packages in my maven project.
What should I include in my pom.xml file in order to have the missing cxf.xml and etc in-placed?

Thanks
Sam
 
Tommy Delson
Ranch Hand
Posts: 206
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, you missed or not created a cxf or cxf-servlet.xml file for you app configuration. I assumed that you know how to configure the configuration file, if not refer to spring documentation or other sources how to created and configure one.

Based on the code you listed look like your beans.xml file is your cxf file, but you defined it twice with cxf name. No need to import anything you defined as showed below.


For single beans.xml file use this configuration:



-----------
For multiple (i.e beans.xml, beans2.xml, beans3.xml...) files use this, this is just like above example, but multiple files:




Remember place all these files in "WEB-INF" directory otherwise it won't find your file, place the file to correct location where you have defined.



 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic