Java Project: Failed to load ApplicationContext

Looks like you are using maven (src/main/java). In this case put the applicationContext.xml file in the src/main/resources directory. It will be copied in the classpath directory and you should be able to access it with From the Spring-Documentation: A plain path, for example “context.xml”, will be treated as a classpath resource from the same package in which the test class is … Read more

org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘MyController’:

Copied from the stacktrace: BeanInstantiationException: Could not instantiate bean class [com.gestEtu.project.model.dao.CompteDAOHib]: No default constructor found; nested exception is java.lang.NoSuchMethodException: com.gestEtu.project.model.dao.CompteDAOHib.<init>() By default, Spring will try to instantiate beans by calling a default (no-arg) constructor. The problem in your case is that the implementation of the CompteDAOHib has a constructor with a SessionFactory argument. By adding the @Autowired annotation to a constructor, … Read more

“NoClassDefFoundError: Could not initialize class” error

NoClassDefFound error is a nebulous error and is often hiding a more serious issue. It is not the same as ClassNotFoundException (which is thrown when the class is just plain not there). NoClassDefFound may indicate the class is not there, as the javadocs indicate, but it is typically thrown when, after the classloader has loaded the bytes for the … Read more

com.atomikos.icatch.SysException: Error in init: Log already in use? tmlog in ./

I have a very big problem with my atomikos. I cant create bean because of below error: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘authenticatingSignInAdapter’: Unsatisfied dependency expressed through field ‘userRepoAutowired’: Error creating bean with name ‘userRepo’: Invocation of init method failed; nested exception is com.atomikos.icatch.SysException: Error in init: Log already in use? tmlog in ./; … Read more

Understanding Spring @Autowired usage

TL;DR The @Autowired annotation spares you the need to do the wiring by yourself in the XML file (or any other way) and just finds for you what needs to be injected where and does that for you. Full explanation The @Autowired annotation allows you to skip configurations elsewhere of what to inject and just does it for you. … Read more

What is a spring service annotation? [duplicate]

@Service, @Controller, @Repository = {@Component + some more special functionality} Click the below link for more details What’s the difference between @Component, @Repository & @Service annotations in Spring? The @Component annotation marks a java class as a bean so the component-scanning mechanism of spring can pick it up and pull it into the application context. … Read more