奇怪的“不是抽象的,不会覆盖抽象方法”的错误

时间:2014-01-29 12:01:51

标签: java maven gwt annotations

不要得到错误的说法。我已经实现了方法和返回类型是正确的。

史诗般的错误:

[ERROR] /tmp/build_834873cb-62d2-4c62-9b4e-29df7d0af404/src/main/java/com
/project/server/SearchServiceImpl.java:[8,7] error: SearchServiceImpl is not abstract and does not override abstract method getListings(String,String) in SearchService
       [ERROR] /tmp/build_834873cb-62d2-4c62-9b4e-29df7d0af404/src/main/java/com
/project/server/SearchServiceImpl.java:[10,1] error: method does not override or implement a method from a supertype

SearchService界面:

    package com.project.client.rpcinterfaces;

    @RemoteServiceRelativePath("searchservice")
    public interface SearchService extends RemoteService{
        ArrayList<ListingInterface> getListings(String userName, String idHash);
}

实施:

@Service(value="searchservice")
public class SearchServiceImpl implements SearchService{
     @Autowired
 private ApplicationContext ctx;
     @Override
     public ArrayList<ListingInterface> getListings(String userName, String idHash) {

        UserItemsImpl userItems = ctx.getBean(UserItemsImpl.class);


        ArrayList<ListingInterface> listingsList = userItems.getListings(userName, idHash);


        return listingsList;
    }
}

ListingInterface:

 public interface ListingInterface{

     public List<TermsSearchResultInterface> getSearchResults();

    /*
     * Returns the indexed search result
     */ 
     public TermsSearchResultInterface getSearchResult(int index);

     public String getTitle();

     public void setTitle(String title);

     public String[] getTags();

     public void setSearchResults(List<TermsSearchResultInterface> searchResults);

     public void setTags(String[] tags);

     public String getListingId();

     public void setListingId(String listingId);

     public List<String> getExcludedTerms();

     public void setExcludedTerms(List<String> excludedTerms);



}

程序在开发模式下正确运行。只有当我尝试将其上传到Heroku.com时,maven才会开始错误:)

花了几个小时。如果你能给我指点什么是错的将是大帮助,谢谢! :)

2 个答案:

答案 0 :(得分:0)

试试这个,

使用此课程SearchServiceImpl

扩展您的RemoteServiceServlet
public class SearchServiceImpl extends RemoteServiceServlet implements SearchService{
.
.
.
}

同时检查您的web.xml是否具有适当的servlet和servlet-mapping

  <servlet>
    <servlet-name>SearchServiceImpl</servlet-name>
    <servlet-class>...path.....SearchServiceImpl</servlet-class>
  </servlet>

  <servlet-mapping>
    <servlet-name>searchServiceImpl</servlet-name>
    <url-pattern>/yourPattern</url-pattern>
  </servlet-mapping>

答案 1 :(得分:0)

故障是git repository。这就是为什么它在我的本地机器而不是在服务器中工作的原因。我删除了我的测试服务器,.git然后再次上传它,它工作正常。