Skip to main content

Posts

Failure to transfer https://repo.maven.apache.org/maven2 was cached in the local repository

Error : Failure to transfer org.apache.maven.plugins:maven-surefire-plugin:pom:2.17 from https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven.plugins:maven-surefire-plugin:pom:2.17 from/to central (https://repo.maven.apache.org/maven2): The operation was cancelled. pom.xml /LogReaderServer line 1 Maven Configuration Problem Solution : Remove all your failed downloads: For windows: cd %userprofile%\.m2\repository for /r %i in (*.lastUpdated) do del %i

Spring circular dependency solution

I would like to suggest a solution of Dependency Injection which will be as much loyal as possible to the Spring IoC way and will help to overcome the circular dependency error. This means that we will have a single class that will have a reference to all the classes which need to be injected and will be responsible for the injection. I'll try to walk you through the steps. Assuming we have the following service classes which cause the circular error: @Service public class ServiceA{ @Autowire ServiceB serviceB; @Autowire ServiceC serviceC; } @Service public class ServiceB{ @Autowire ServiceA serviceA; @Autowire ServiceC serviceC; }                                               First step is to remove the @Autowire annotations, so we will move the wiring responsibility out of Spring hands. Second step is to create a class which will hold a reference to all the classe...

Injection of persistence dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException:

Exception : org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'employeeController': Injection of persistence dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type  [javax.persistence.EntityManagerFactory] is defined Solution : you are scanning wrong package for controller class change your package declaration.

Maven dependencies Nature is not working in Eclipse

If you have enable the maven nature enables via eclipse and still  All maven dependencies are not loading and its not showing up in the libraries then. Add this entry in your classpath file of project . Just after JRE entry in your classpath file. 1. Ctrl+Shift+R to open up resource . 2. search .classpath 3 .add entry after JRE. <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"/>

Exception java.lang.NoClassDefFoundError: net/sf/cglib/proxy/CallbackFilter

Exception: Caused by: java. lang . NoClassDefFoundError : net/sf/cglib/proxy/CallbackFilter at org. springframework . beans . factory . support . CglibSubclassingInstantiationStrategy . instantiateWithMethodInjection (CglibSubclassingInstantiationStrategy. java : 71 ) at org. springframework . beans . factory . support . SimpleInstantiationStrategy . instantiate (SimpleInstantiationStrategy. java : 75 ) at org. springframework . beans . factory . support . AbstractAutowireCapableBeanFactory . instantiateBean (AbstractAutowireCapableBeanFactory. java : 948 ) ... 13 more Caused by: java. lang . ClassNotFoundException : net. sf . cglib . proxy . CallbackFilter at java. net . URLClassLoader $1. run (Unknown Source) at java. net . URLClassLoader $1. run (Unknown Source) at java. security . AccessController . doPrivileged (Native Method) at java. net . URLClassLoader . findClass (Unknown Source) at java. lang . ClassLoader . loadClass (Unknown Source) at sun. misc . Launch...

Exception at org.hibernate.cfg.OneToOneSecondPass.doSecondPass(OneToOneSecondPass)

You might end up with this exception while doing your one to one ,or many to one relationship in hibernate. Exception: Exception in thread "main" java. lang . NullPointerException at org. hibernate . cfg . OneToOneSecondPass . doSecondPass (OneToOneSecondPass. java : 135 ) at org. hibernate . cfg . Configuration . secondPassCompile (Configuration. java : 1127 ) at org. hibernate . cfg . AnnotationConfiguration . secondPassCompile (AnnotationConfiguration. java : 296 ) at org. hibernate . cfg . Configuration . buildSessionFactory (Configuration. java : 1283 ) at com. javatpoint . Test . main (Test. java : 13 ) To fix correct this exception Check following : 1. Your one to one mapping bean is pointing to correct column. 2. You have configured both table correctly. Once you have correct these your exception will go away.

Maven - Pom.xml Issues.

Maven -- > pom.xml error resolution Problem 1. Could not calculate build plan: Plugin org.apache.maven.plugins:maven-jar-plugin:2.3.2 or one of its dependencies could not be resolved. Soultion :-  1 . Just go to the path  C: \Users \< username> \. m2 \repository \org \apache \maven \plugins 2.  Delete the plugin which is causing the issue . 3. In Eclipse clean and build your project again 4. choose Maven->Update Dependencies. Problem 2 : Could not transfer artifact org.apache.maven.plugins:maven-resources-plugin:pom:2.5 from/to central (http://repo.maven.apache.org/maven2): The operation was cancelled. Solution :-  Rightclick on your project in eclipse and choose Maven->Update Dependencies Choose Force update of snapshot release.