• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Maven Dependency errors in STS

 
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everyone, I have a Maven project which I have been working with since June in STS IDE with no issues. But on Monday morning, few days ago now, I opened my workspace and was not able to get it compiled again. The error I'm getting apparently is related to STS not seeing Maven Dependency in WEB-INF/lib. This error is:
SEVERE: Error configuring application listener of class org.springframework.web.context.ContextLoaderListener
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
So the cure for that is to add Maven Dependencies. When I do that (project -> Properties -> Deployment Assembly -> Add -> Java Build Path -> Maven Dependencies) and click Apply And OK, I attempt to "Start the Server"/build again. But this time I get a different build error which is a lot more verbose, the error:

---------------------------------------------------
2012-11-27 13:29:13,670 [pool-2-thread-1] ERROR org.springframework.web.context.ContextLoader - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.authentication.ProviderManager#0': Cannot create inner bean '(inner bean)' of type [org.springframework.security.config.authentication.AuthenticationManagerFactoryBean] while setting bean property 'parent'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)': FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.authenticationManager': Cannot resolve reference to bean 'proscmAuthenticationProvider' while setting bean property 'providers' with key [0]; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [com.proscm.resources.ProscmAuthenticationProvider] for bean with name 'proscmAuthenticationProvider' defined in file [C:\Users\liliyaw\Desktop\springsource\vfabric-tc-server-developer-2.7.0.RELEASE\spring-insight-instance\wtpwebapps\proscm\WEB-INF\classes\META-INF\spring\applicationContext-security.xml]; nested exception is java.lang.ClassNotFoundException: com.proscm.resources.ProscmAuthenticationProvider
-------------------------------------------------------
So the file applicationContext-security.xml did not change. File resources.ProscmAuthenticationProvider does exist and was not updated. Am I missing something? I should mention - this Maven Project is my first one, my experience setting up Maven projects is minimal.

 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is "STS IDE"?

Exactly what was the spring dependency that you added? (You can find this in the pom.xml file, looking at the source.)

It appears that the spring dependency you are relying on requires another dependency. The thing is, that such a dependency should be automatically included (which is why I asked for the exact dependency text). But if the spring component is not properly configured, you will have to add the "proscm" resource in as a dependency to your project. Or is 'proscm' your project?

 
liliya woland
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Peter, STS is Spring + Eclipse IDE (SpringSourse Tool Suite).
I was able to finally build the project, without doing anything different from what I was already doing. I'm not sure what happened to my IDE - it was finding dependencies fine, then it stopped. Now, I can build fine, but I need to physically delete target folder, where freshly compiled files stored for my edits to the files to take place... From what I found on the web STS and Maven are finicky together and some things are not compatible between the two. So I don't know, I don't want to go through the process of re-installing everything if I don't have to.
 
Peter Johnson
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I usually do two things to get m2e and Eclipse to peacefully co-exist:

1) I often do Project > Clean and then clean all projects without automatically rebuilding (this accomplishes the same thing as removing the target folder that you mentioned)

2) I even more often to right-click project > Maven > Update Project (or Update Dependencies for older versions of m2e) and select all projects. This causes m2e to re-evaluate the dependencies and refresh the build classpath that Eclipse uses.

Usually these two actions remove all of the false errors reported by Eclipse.
 
liliya woland
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Peter, I've tried building as you suggested. The second step takes out my Maven Dependencies and doesn't add them back, so I have to add them back manually. "Clean Project" doesn't get rid of the old target dir entirely - target and m2e-wtp dirs are there, but empty. One thing that's also happening, and equally annoying, in this build precess - now I need to do a maven build, then I need to refresh the project to bring in the fresh target files, then I do tc server build. In the past, I did only the server build and that by it self took care of everything, no cleaning or refreshing of the project.
 
Rancher
Posts: 2759
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Check the problem logs in eclipse. It could be that the build failed before maven could process the dependencies which causes eclipse to basically not add any dependencies

What happens when you build the project through command line?
 
Peter Johnson
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you sure that you create a Maven project? It sounds like you created some other kind of project and are now expecting to use Maven to manage dependencies.
 
liliya woland
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, I'm confident it's a Maven project, it has the structure of Maven project. It worked fine for a very long time. This morning it is acting out again - same error, can't get it to compile.
 
reply
    Bookmark Topic Watch Topic
  • New Topic