Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

Method not found on DMI Call with Spring Bean

$
0
0
I am trying to access a Bean managed by Spring from the DMI implementation. However, I get the following error:

Code:

=== 2014-09-23 18:48:03,700 [80-6] DEBUG RPCDMI - appConfig: isc.Application.create({
    rpcBindings:[
        {
            ID:"Services",
            bean:"interfaceDAO",
            className:"eum.ums.server.listener.Services",
            lookupStyle:"spring",
            visibleMethods:[
                {
                    name:"doNewMsg"
                }
            ]
        }
    ]
})

=== 2014-09-23 18:48:03,701 [80-6] INFO  ServerObject - DMI on Spring bean: interfaceDAO
=== 2014-09-23 18:48:03,704 [80-6] DEBUG ServerObject - Couldn't find a public method named: doNewMsg on class: com.sun.proxy.$Proxy21
Sep 23, 2014 6:48:03 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet admin threw exception
java.lang.NullPointerException
        at com.isomorphic.base.Reflection.methodTakesArgType(Reflection.java:1561)
        at com.isomorphic.rpc.RPCDMI.execute(RPCDMI.java:288)
        at com.isomorphic.rpc.RPCDMI.execute(RPCDMI.java:66)
        at com.isomorphic.rpc.RPCRequest.execute(RPCRequest.java:231)
        at eum.ums.server.AnnouncementHibernateOperationsController.handleRequest(AnnouncementHibernateOperationsController.java:38)

Some extracts of the code:

/shared/app/services.app.xml
Code:

<Application>
    <rpcBindings>
   
        <ServerObject ID="Services" className="eum.ums.server.listener.Services" lookupStyle="spring" bean="interfaceDAO" >
            <visibleMethods>
                <method name="doNewMsg"/>
            </visibleMethods>
        </ServerObject>
               
    </rpcBindings>
</Application>

The Smartgwt call:
Code:

DMI.call("services", "eum.ums.server.listener.Services", "doNewMsg", new RPCCallback() {
        @Override
        public void execute(RPCResponse response, Object rawData,RPCRequest request) {
                SC.say(rawData.toString());

        }}, null);

And DMI class implementation:
Code:

@Controller
public class Services {

@Autowired
    private InterfaceDAO interfaceDAO;       
       
        public String doNewMsg() {
                GenMessage genMsg = new GenMessage();
                genMsg.setMessageType("Alert Message");
                interfaceDAO.storeGenMessage(genMsg);               
                return "Done";
    }       
}

However, if I remove the dependency on this 'InterfaceDAO' bean and produce a 'dummy' method that doesn't use the bean. That is, i remove:
Code:

lookupStyle="spring" bean="interfaceDAO"
and
Code:

@Autowired
private InterfaceDAO interfaceDAO;       
....       
interfaceDAO.storeGenMessage(genMsg);

then it finds and uses the method. All fine...

Any ideas on what I am doing wrong? Or any ideas on examples that I can look at?

Many thanks in advance.

Regards,

Oriol

Viewing all articles
Browse latest Browse all 4756

Trending Articles