Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Spring and the fly likes Error with web.xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Error with web.xml" Watch "Error with web.xml" New topic
Author

Error with web.xml

sam White
Ranch Hand

Joined: Feb 18, 2011
Posts: 208
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

Joined: Jul 07, 2011
Posts: 55

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:


Thanks and Regards,
Nilesh Sahni | nsahni@infocepts.com | www.infocepts.com
sam White
Ranch Hand

Joined: Feb 18, 2011
Posts: 208
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

Joined: Feb 18, 2011
Posts: 208
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

Joined: Apr 13, 2011
Posts: 206
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.


OCPJP6-05-11
"Your life is in your hands, to make of it what you choose."
sam White
Ranch Hand

Joined: Feb 18, 2011
Posts: 208
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

Joined: Feb 18, 2011
Posts: 208
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

Joined: Feb 18, 2011
Posts: 208
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

Joined: Apr 13, 2011
Posts: 206
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.



 
 
subject: Error with web.xml
 
Similar Threads
JSF 2 - Problem with ManagedBean
Maven web project dependencies
Could not resolve dependencies
Missing CXF plugins??
How to change jetty binding port number in maven.