package com.zz.modules.webservice;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Fail;
import org.nutz.mvc.annotation.Ok;
import com.zz.modules.webservice.restws.AbstractCxfModule;
@IocBean(create = "_init", depose = "depose")
@At("/ws")
public class CxfModule extends AbstractCxfModule {
private static final long serialVersionUID = 1L;
@At("/*")
@Ok("void")
@Fail("void")
public void service() throws Exception {
super.service();
}
}
package com.zz.modules.webservice.service;
import javax.jws.WebParam;
import javax.jws.WebService;
@WebService
public interface HelloWorldService {
String sayHi(String text);
// 测试一下无参,有返回值的
String ping();
// 测试一下有参数,有返回值
String echo(@WebParam(name = "str") String str);
}
package com.zz.modules.webservice.impl;
import javax.jws.WebService;
import org.nutz.ioc.loader.annotation.IocBean;
import com.zz.modules.webservice.service.HelloWorldService;
@IocBean
@WebService(endpointInterface = "com.zz.modules.webservice.service.HelloWorldService", serviceName = "HelloWorld")
public class HelloWorldServiceImpl implements HelloWorldService {
@Override
public String sayHi(String text) {
return "Hello " + text;
}
public String ping() {
return "pong"; // ping --> pong 心跳回路
}
public String echo(String str) {
return str; // 简单回显
}
}
已经扫描到 这个类
2018-05-23 14:38:57,135 [INFO][org.nutz.mvc.NutFilter] - NutFilter[nutz] starting ...
2018-05-23 14:38:57,988 [INFO][org.nutz.mvc.impl.NutLoading] - Nutz Version : 1.r.61.r2 2017-04-18
2018-05-23 14:38:57,988 [INFO][org.nutz.mvc.impl.NutLoading] - Nutz.Mvc[nutz] is initializing ...
2018-05-23 14:38:59,126 [INFO][org.nutz.ioc.loader.annotation.AnnotationIocLoader] - Found 123 classes in 1 base-packages!
beans = [ "helloWorldServiceImpl", "baseService", "exportRyExcelService", "demoService", "logInterceptor"]
2018-05-23 14:38:59,139 [INFO][org.nutz.ioc.impl.NutIoc] - NutIoc init begin ...
2018-05-23 14:38:59,143 [INFO][org.nutz.ioc.impl.NutIoc] - ... NutIoc init complete
映射日志
/ws/*
com.hfits.modules.webservice.CxfModule
CxfModule.service(...) : void
OK:void
2018-05-23 14:42:31,441 [WARN][org.nutz.mvc.impl.processor.FailProcessor] - Error@/ws/HelloWorld :
org.nutz.ioc.IocException: IocBean[cxfModule] throw Exception when creating
at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:149)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:210)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:239)
at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:116)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at org.nutz.mvc.impl.processor.EncodingProcessor.process(EncodingProcessor.java:27)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at org.nutz.mvc.impl.processor.UpdateRequestAttributesProcessor.process(UpdateRequestAttributesProcessor.java:15)
at org.nutz.mvc.impl.NutActionChain.doChain(NutActionChain.java:44)
at org.nutz.mvc.impl.ActionInvoker.invoke(ActionInvoker.java:67)
at org.nutz.mvc.ActionHandler.handle(ActionHandler.java:31)
at org.nutz.mvc.NutFilter.doFilter(NutFilter.java:209)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.nutz.lang.born.BorningException: Fail to born or cast to 'com.hfits.modules.webservice.CxfModule'because: java.lang.NoClassDefFoundError: org/nutz/lang/reflect/FastMethod
at org.nutz.lang.born.EmptyArgsConstructorBorning.born(EmptyArgsConstructorBorning.java:17)
at org.nutz.ioc.weaver.DefaultWeaver.born(DefaultWeaver.java:67)
at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:114)
... 27 more
Caused by: java.lang.NoClassDefFoundError: org/nutz/lang/reflect/FastMethod
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at sun.reflect.GeneratedMethodAccessor19.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.nutz.lang.reflect.ReflectTool.defineClass(ReflectTool.java:70)
at org.nutz.lang.reflect.ReflectTool.defineClass(ReflectTool.java:56)
at org.nutz.aop.DefaultClassDefiner.define(DefaultClassDefiner.java:24)
at org.nutz.lang.reflect.FastMethodFactory.make(FastMethodFactory.java:50)
at org.nutz.lang.reflect.FastClassFactory.create(FastClassFactory.java:79)
at org.nutz.lang.reflect.FastClassFactory.get(FastClassFactory.java:45)
at org.nutz.lang.reflect.FastClassFactory.get(FastClassFactory.java:63)
at org.nutz.lang.born.AbstractConstructorBorning.call(AbstractConstructorBorning.java:24)
at org.nutz.lang.born.EmptyArgsConstructorBorning.born(EmptyArgsConstructorBorning.java:14)
... 29 more
Caused by: java.lang.ClassNotFoundException: org.nutz.lang.reflect.FastMethod
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 43 more