Spring STS can't find META-INF/spring.schemas - eclipse

Trying to set up a new project, and running into a weird issue. I made a new app context file named backend-context.xml, I've added spring-context as a dependency, and am trying to add namespaces through the bean config file, but it's showing as 1 error, with no explaination.
If I browse into problem explorer, it states the following error:
'Unable to load schema mappings from location [META-INF/spring.schemas]'
If I browse through the Maven Dependencies I can see this file located under the spring-beans jar.
If anyone has ideas on how to fix this, that'd be awesome!
Thanks!

Ended up being caused by a local maven jar being corrupt. Found this out by uploading the code to github and trying on a different computer which worked like a charm. So, cleaned out my local repository from all spring jars and redownloaded.

Related

Eclipse not attaching source automatically

I am using Eclipse Oxygen. Everything was working fine until one day I imported a Spring Boot maven project which has problem in pom.xml saying that tools.jar is missing. In the process of trying to remove this error I messed around with build path and many things. Now Eclipse is no longer able to automatically attach sources and I have to manually attach the source. For example, see below image
The source jar file actually exist but eclipse is not able detect it.
I have to manually click the "Attach Source" and locate the source file, and then only the source code is attached. Eclipse should be doing this under the hood. I googled a lot but all solutions given were not working for me. Please help.

Maven fixing broken dependencies

I just checked out maven based java project from svn to local box in eclipse where maven 3.0.2 is available. However while reviewing class path configuration many of dependencies are broken such as org.restlet-2.0.15.jar. Strange part is C:/Users/daeyoung/.m2/repository has that broken jar file but .lastUpdated is appended. After reading many posts from WWW, the way I understood to fix the problem is delete *.lastUpdated file then re-download it from central repo.
But when I reviewed pom.xml file there is no mention of repository (strange...) and as soon as I delete *.lastUpdated file, it comes back (e.g. org.restlet-2.0.15.jar.lastUpdated).
I am new to Maven.
I'd appreciate if someone can guide me to a right direction to fix this problem.
[update]
I created following user settings.xml file under /Users/daeyoung/.m2/ directory. I thought at least that would take care of downloading org.restlet package.
However when I ran mvn command (literally mvn) inside of project folder, system was saying..
I don't want to modify pom.xml file but rather via user settings.xml I thought I could connect to maven restlet repo and download specified target package but I am not sure what I am missing in here. I think contents of settings.xml is not correct.
I just want to say thanks to all who have given me advice. First I was not well equipped to understand the advice but more I looked at the problem/read about maven articles. It was clear what needs to be done to fix the problem.
Bottom line is I manually downloaded dependencies to ${user_name}/.m2/repository for missing jars. I configured ${MAVEN_HOME}/conf/settings.xml to point to local repository then I ran mvn validate/clean/package sequentially from eclipse via m2e plugin (or I could have done same thing from command line).

Hibernate configuration with tomcat and eclipse

I'm creating a webApp in eclipse using tomcat & hibernate (for mysql). Ive unit tested by code and I am able to connect to the db and pull data, but I'm running into issues when trying it from the web app.
From the exception it looks like it isnt able to get to the hibernate.cfg.xml, but I've tried placing the file in the src folder, WEB-INF/lib & WEB-INF/classes but I still get the same error.
The line of code that it's failing on is:
Configuration configuration = new Configuration();
I would really really appreciate any help!
ClassPath References:
Project References:
Stacktrace:
java.lang.ExceptionInInitializerError
org.hibernate.cfg.Configuration.reset(Configuration.java:324)
org.hibernate.cfg.Configuration.<init>(Configuration.java:289)
org.hibernate.cfg.Configuration.<init>(Configuration.java:293)
root cause
java.lang.NullPointerException
org.hibernate.internal.util.ConfigHelper.getResourceAsStream(ConfigHelper.java:170)
org.hibernate.cfg.Environment.<clinit>(Environment.java:221)
org.hibernate.cfg.Configuration.reset(Configuration.java:324)
org.hibernate.cfg.Configuration.<init>(Configuration.java:289)
org.hibernate.cfg.Configuration.<init>(Configuration.java:293)
SOLUTION
Thanks to #Engineer, I was able to solve this by removing the jars from WEF-INF/lib & from the class path of the run configuration. Then I added them back using the "Deployment Assembly" menu in eclipse. I also have my project references here.
From Ranga Reddy:
Problem: Because of adding the jars in user library class path.
Solution: Instead of adding the jar files using User Library add the jars using classpath.

Maven Project in Eclipse - Initial Setup

I am trying to follow some existing tutorials on Hadoop that I found online.
I have installed cloudera and am using it as the setup environment for all of the work. However when I try to create a Maven project in Eclipse, I end up having issues referencing to the quickstart archetype.
The error I get is the following:
'Creating maven-archetype-quickstart' has encountered a problem.
Could not resolve archetype org.apache.maven.archetypes:maven-archetype-quickstart:RELEASE from any of the configured repositories
The issue seems to be linked with the ~/.m2/ folder. My settings.xml file has been set up per the tutorial and links to the online repositories.
Could not write artifact lastUpdated status /home/cloudera/.m2/repository/org/... (Permission denied)
Please note that I created the whole directory .m2/ as it did not exist. I am running out of ideas, maven is clearly installed on the VM. I am just unsure why everything is referenced back to ~/.m2/ which did not exist and had to be created (and therefore isn't populated).
Whatever help would be appreciated, thanks again for your time!

Spring JAR files not present in new Eclipse Spring project

I installed Spring in Eclipse/EE simply from the Eclipse Marketplace.
However, either the Spring jar files aren't there, or am missing something within the project setup.
I looked to find them in the project library thru "Build path". I even tried searching the .jar files within the Windows directories.
I know I'm missing something big-- please bear with me.
Took me hours.
Note: I saw stackoverflow.com/questions/6288563/adding-external-jar-file-in-eclipse/11004869.
Update: found the jars in an earlier release-- 3.05. OK now i think.
Of course they are not there. There is not reason for them to be in eclipse. Select File > New > Spring Template project. This will create new maven project with spring dependencies included