grails 关于RMI

yinwenlong_happy 2011-05-18 12:15:40
搞了有一会了,搞不出来。

在Web应用程序中我写的

StudentService.java

interface StudentService{
List getStudents()
}

StudentServiceImpl .java

class StudentServiceImpl implements StudentService{
static expose = ['hessian', 'rmi']
static remote = [
protocol: 'hessian',
iface: StudentService,
host: 'localhost',
port: '8080',
webcontext: 'Student',
]
@Override
public List getStudents() {
ArrayList students=Student.list()
println students
return students;
}
}

Student这个类我序列化了。 我已经安装了插件remoting,其实我是按照http://www.grails.org/plugin/remoting 一步一步操作的。

在客户端的应用程序写的代码:并且加入了hessian-3.2.0.jar

StudentService.java

interface StudentService{
List getStudents()
}

RemoteClient .java

public class RemoteClient {
public static main(args) {
def url = "http://localhost:8080/GrailsTest/hessian/StudentServiceImpl"
def factory = new HessianProxyFactory()
def basic = factory.create(StudentService.class,url)
println basic.getStudents()
}

}

在web控制台的错误:

org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'hessian.StudentServiceImpl' is defined

在客户端应用程序的错误:

Exception in thread "main" com.caucho.hessian.client.HessianConnectionException: 500: java.io.IOException: Server returned HTTP response code: 500 for URL: http://localhost:8080/GrailsTest/hessian/StudentServiceImpl



我的分析:我知道web这里没有配置好,唉,菜鸟嘛,能力有限。。求帮助了。谢谢哈
...全文
133 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

51,409

社区成员

发帖
与我相关
我的任务
社区描述
Java相关技术讨论
javaspring bootspring cloud 技术论坛(原bbs)
社区管理员
  • Java相关社区
  • 小虚竹
  • 谙忆
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧