没有调用服务方法

时间:2012-07-26 15:57:06

标签: java-ee

我坚持使用此代码。然后我运行客户端不显示检查字符串。无法弄清楚为什么这不起作用。也许如果你看一下这可能会发现问题?

public class ClientApplicationTest {
    public static void main(String[] args) throws ParseException 
    {
        try
        {
            Context jndi = new InitialContext();

            BoatManagementServiceRemote service = (BoatManagementServiceRemote)
                    jndi.lookup("java:global/BoatManagement/BoatManagementServiceImplementation!com.boatmanagement.service.BoatManagementServiceRemote");

             Client cl = new Client("Mark", "Markus", "Birzu 12-44 Street", "+44 333 666 7", "markoff@test.com");
             service.updateClient(cl);
        }
        catch (NamingException e)
        {
            System.out.println(e);
        }
    }
}

这是我的BoatManagement方法:

@Stateless
public class BoatManagementServiceImplementation implements BoatManagementServiceRemote 
{   
    @EJB
    private BoatDataAccess dao;

    public void updateClient(Client client) 
    {
        System.out.println("Check!");
        //dao.updateClient(client);
    }
}

@Remote
public interface BoatManagementServiceRemote 
{
    public void updateClient(Client client);
}

实际上我的updateClient方法实际上根本没有被调用。看不出问题。我使用Glassfish并且部署成功。

0 个答案:

没有答案