java - Property 'service' is required when migrate from Spring 2 to Spring 4 -


this server context used work fine spring 2:

<?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans"     xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"     xsi:schemalocation="         http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd">   <bean id="myservice" class = "com.example.service.myservicefactory" factory-method="getinstance"/>    <bean class="org.springframework.remoting.rmi.rmiserviceexporter">     <property name="servicename" value="myservice"/>     <property name="service" ref="myservice"/>     <property name="serviceinterface" value="com.example.service.myservice"/>     <property name="registryport" value="1199"/>   </bean>  </beans> 

however when switch spring 4.1.6-release got error:

java.lang.illegalargumentexception: property 'service' required     @ org.springframework.remoting.support.remoteexporter.checkservice(remoteexporter.java:114)     @ org.springframework.remoting.rmi.rmiserviceexporter.prepare(rmiserviceexporter.java:239)     @ org.springframework.remoting.rmi.rmiserviceexporter.afterpropertiesset(rmiserviceexporter.java:230) 

how can fix it?

by upgrading spring 4, line in myservicefactory.getinstance() fails , returns null, hence error. server context fine, error not entirely unrelated spring 4.

i wish make error more obvious, saying error: property "service" receives null object lot more informative current error message.


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -