@Autowired not working in openJdk8 but worked in jdk7

75 views Asked by At

I am working on version upgrade of Java application,(Jdk7 to openJdk8). for that purpose, we have upgraded the spring version as per new openJdk8 in pom.xml.

I am able to build the war successfully. After deployment of war on apache-tomee-webprofile-1.7.4 (same before and after java version upgrade) I am able to login the application but not able to @Autowired the bean and hence the bean instance is null causing NullPointerException.

Application is running in Jdk7 but version upgrade (openJdk8 and Spring - 4.1.0.RELEASE) causing @Autowired not working.

Please suggest any solution for the same. We cannot move to Setter/Constructor injection as the @Autowired is used at multiple places.

>     Caused by: java.lang.NullPointerException
>        at AA.BB.CC.SearchRootLayout.MethodName(SearchRootLayout.java:100)
----------------------------------------------------------
    @Autowired
    private AdminService admin; 
    try {
        objects = admin.getObjects(Configuration.class, new String[] { "id" }, 0, 15);
     } catch (XXXXException e) { }

Interface

public interface AdminService extends ServiceBase { }

Implementation class

@Component
@Transactional
public class AdminServiceImpl extends ServiceBaseImpl implements AdminService { }

admin is null causing NullPointerException.

I forget to mention my old spring version is 3.0.5.RELEASE and now because of openJdk8 upgraded to 4.1.0.RELEASE

0

There are 0 answers