获取错误消息只能导入类型

时间:2013-07-03 19:27:17

标签: jsp maven-2 osgi cq5 apache-felix

尝试执行jsp页面时收到错误消息“只能导入类型”。

我收到错误:“只能导入一个类型.com.adobe.cq.TestServiceImpl解析为adobe day cq中的包

我创建了一个捆绑包并安装在felix控制台中。捆绑包的状态也是活动的。它也可以在服务和组件控制台中使用。

这是com.adobe.cq包中的TestServiceImpl类

    package com.adobe.cq;


import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Service;
import org.osgi.framework.BundleContext;
import org.osgi.service.component.ComponentContext;
import javax.jcr.RepositoryException;
import org.apache.felix.scr.annotations.Property;
import org.apache.felix.scr.annotations.Properties;
//src.component
//declares the class component. This will provide a wrapped ManagedService component in the OSGI container. 

//src.service interface="SampleService" 
//declares the service we are offering. Actually, the interface attribute is superflous, as by default, all implemented Interfaces are used. 

/**
@scr.component
@scr.service interface="testService"
*/
@Component(immediate = true, metatype = true)
@Service
@Properties( {
        @Property(name = "service.description", value = "abcd"),
        @Property(name = "label", value = "myLabel") })
public class TestServiceImpl implements TestService {
 public String sayHello() {
     return "Hello World!";
 }
}

这是我的jsp代码。

    <%@include file="/libs/foundation/global.jsp"%><%
%><%@include file="/apps/mine/includes/functions.jsp"%><%
%><%@ page import="com.adobe.cq.TestServiceImpl,
                org.apache.sling.api.SlingHttpServletRequest,
                java.util.List"%><%
%><%
    SlingHttpServletRequest r = (SlingHttpServletRequest)request;    
    TestServiceImpl testService = sling.getService(TestServiceImpl.class);
    out.println("testService:::"+testService);
%>
<div id="te-nav" style="display:block !important;">
</div>

是因为我在TestServiceImpl类中使用了注释吗?

你能告诉我如何解决它吗?

此致 安德森

0 个答案:

没有答案