sca的web app,

今天遇到一个特别XX的问题?
先把配置文件列出
一:InformationService.composite文件
<?xml version="1.0" encoding="UTF-8"?>
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
           targetNamespace="http://sca.spsoft.com.cn"
           xmlns:sample="http://sca.spsoft.com.cn"
           name="informationService">
<component name="informationServiceComponent">
<implementation.java class="cn.com.spsoft.sca.business.impl.InformationServiceImpl"/>
<reference name="bpService" target="bpServiceComponent"></reference>
<reference name="riService" target="riServiceComponent"></reference>
<reference name="jobService" target="jobServiceComponent"></reference>
</component>
<component name="bpServiceComponent">
<implementation.java class="cn.com.spsoft.sca.business.impl.BasicPayServiceImpl"/>
</component>
<component name="riServiceComponent">
<implementation.java class="cn.com.spsoft.sca.business.impl.RegisterInfoServiceImpl"/>
</component>
<component name="jobServiceComponent">
<implementation.java class="cn.com.spsoft.sca.business.impl.JobFinishServiceImpl"/>
</component>
</composite>
二:下面是测试主方法
public static void main(String args[]) {
SCADomain scaDomain = SCADomain
.newInstance("InformationService.composite");
System.out.println("ComponentNames:"+ scaDomain.getComponentManager().getComponentNames());
InformationService informationService = scaDomain.getService(
InformationService.class, "informationServiceComponent");

}
三:说明
运行该主方法后,出现如下面的异常
ComponentNames:[bpServiceComponent, riServiceComponent, jobServiceComponent, informationServiceComponent]
Exception in thread "main" java.lang.NoSuchMethodError: org.osoa.sca.ServiceReference.getService()Ljava/lang/Object;
at org.apache.tuscany.sca.host.embedded.impl.DefaultSCADomain.getService(DefaultSCADomain.java:365)
at cn.com.spsoft.sca.business.ClientTest.main(ClientTest.java:11)

从上面加载配置文件一步应该是正确的,而且取得了配置的几个构件
但总提示找不到getService方法????

四:主要接口与实现
public interface InformationService {

// 每个人基础工资查询(BasicPayService)
public double findByuid(String uid);

// 查询个人注册信息(RegisterInfoService)
public String findInfoByuid(String uid);

// 查询工作完成情况(JobFinishService)
public double findJob(String uid);

}
在该接口的实现中进行了注入
public class InformationServiceImpl implements InformationService {
private BasicPayService bpService;

private RegisterInfoService riService;

private JobFinishService jobService;

@Reference
public void setBpService(BasicPayService bpService) {
this.bpService = bpService;
}

@Reference
public void setRiService(RegisterInfoService riService) {
this.riService = riService;
}

@Reference
public void setJobService(JobFinishService jobService) {
this.jobService = jobService;
}

public double findByuid(String uid) {
// TODO Auto-generated method stub
return bpService.findByuid(uid);
}

public String findInfoByuid(String uid) {
// TODO Auto-generated method stub
return riService.findInfoByuid(uid);
}

public double findJob(String uid) {
// TODO Auto-generated method stub
return jobService.findJob(uid);
}
}

找不到原因,急中...
五:在jsp访问方式中是正确的
如index.jsp
<%@ page language="java" import="java.util.*" pageEncoding="GBK"%>
<!-- 导入内容 -->
<%@ page import="org.osoa.sca.CompositeContext"%>
<%@ page import="org.osoa.sca.CurrentCompositeContext"%>
<%@ page import="cn.com.spsoft.sca.business.MSG"%>
<%@ page import="cn.com.spsoft.sca.business.InformationService" %>
<!-- 代码段 -->
<%
//取得构件上下文环境
CompositeContext context = CurrentCompositeContext.getContext();
//加载接口MSG对应的服务,参数为接口,组件名称
MSG msg = context.locateService(MSG.class, "msgComponent");
InformationService informationService = context.locateService(
InformationService.class, "informationServiceComponent");


%>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>Index Page...</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->

</head>

<body>
<center>
This is a SCA Application!<br>
<%=msg.getMsg("南京","江苏省-省会城市") %>

<br>
<%=informationService.findByuid("1") %><br>
<%=informationService.findInfoByuid("1")%><br>
<%=informationService.findJob("1")%><br>
</center>
</body>
</html>

下附其WEB-INF\default.scdl
<?xml version="1.0" encoding="UTF-8"?>

<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
           targetNamespace="http://sca.spsoft.com.cn"
           xmlns:sample="http://sca.spsoft.com.cn"
    name="informationService">
<component name="informationServiceComponent">
<implementation.java class="cn.com.spsoft.sca.business.impl.InformationServiceImpl"/>
<reference name="bpService">bpServiceComponent</reference>
<reference name="riService">riServiceComponent</reference>
<reference name="jobService">jobServiceComponent</reference>
</component>
<component name="bpServiceComponent">
<implementation.java class="cn.com.spsoft.sca.business.impl.BasicPayServiceImpl"/>
</component>
<component name="riServiceComponent">
<implementation.java class="cn.com.spsoft.sca.business.impl.RegisterInfoServiceImpl"/>
</component>
<component name="jobServiceComponent">
<implementation.java class="cn.com.spsoft.sca.business.impl.JobFinishServiceImpl"/>
</component>
<service name="msg">
<interface.java interface="cn.com.spsoft.sca.business.MSG"/>
<reference>msgComponent</reference>
</service>
<component name="msgComponent">
<implementation.java class="cn.com.spsoft.sca.business.impl.MSGImpl"/>
</component>
</composite>

你可能感兴趣的:(apache,thread,jsp,xml,Web)