开发者

Implementing interface problem after switching from Tomcat 7 to JBoss 4.2.1

I made a Dynamic web project in Eclipse using tomcat 7 (and I used Dynamic web module version 3.0 and JSF 2.0). Now when I had to switch from tomcat 7 to JBoss 4.2.1 it seems there is some kind of compatibility problem because the JBoss doesn't allow Dynamic web module version 3.0 but 2.5 and JSF 1.2 instead of JSF 3.0 that I used. So when I was trying to deploy my old project in new project that will use JBoss this strange error appeared:

I have this DBManager class that implements 2 interfaces (UserManageable and CategoryManageable). In UserManageable I have a method void doInsert(User user), doUpdate(User), etc. but eclipse tells me there is a mistake and offers 2 solutions: 1st to remove the @Override annotation and 2nd to create doInsert(User) in the other interface. If I remove the other interface it just offers me the 1st solution.

Here are the class and the interfaces.

import jsfDP.interfaces.CategoryManageable;
import jsfDP.interfaces.UserManageable;

public class DBManager implements UserManageable, CategoryManageable{

    @Override
    public void doInsert(User user) {
        // here I get 
        // The method doInsert(User) of type DBManager must override a superclass method
        // 2 quick fixes available: 
        // Create doInsert() in supertype 'CategoryManageable'
        // Remove '@Override' annotation
        ....
    }
    ....
}

Interface UserManageable:

import java.util.List;
import jsfDP.beans.User;

public interface UserManageable {
    void doInsert(User user);
    void doUpdate(User user);开发者_Python百科
    void doDelete(User user);

    User getUserById(int userId);
    List<Integer> getUserIds();
    List<User> getAllUsersInList();
}

Interface CategoryManageable:

package jsfDP.interfaces;

import java.util.List;
import jsfDP.beans.Category;

public interface CategoryManageable {
    List<Category> getCagegories();

}


If you are running the JBoss with Java 1.5 (and it seems that way), you need to remove the annotation. The @Override annotation for interfaces is a Java 6 and later feature.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜