0

我被这段代码困住了。然后我运行客户端不显示检查字符串。无法弄清楚为什么这不起作用。也许如果你看看这个可能会发现问题?

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 并且部署成功。

4

0 回答 0