首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >类xxx不包含在xxx成为Tapestry服务时自动构建所需的公共构造函数。

类xxx不包含在xxx成为Tapestry服务时自动构建所需的公共构造函数。
EN

Stack Overflow用户
提问于 2013-01-17 22:21:42
回答 1查看 1.6K关注 0票数 0

我正在发现Tynamo的团队在Tapestry和Resteasy之间所做的出色的集成工作。

我正在尝试激活Liveclass在webservices上重新加载。根据医生的说法:

文档

要为REST服务启用活动类重载,唯一需要做的事情是将它们绑定为常规Tapestry IoC服务,并将它们贡献给javax.ws.rs.core.Application.class。了解更多有关服务实现重新加载的工作方式的信息:http://tapestry.apache.org/reload.html 下面是tapestry中的一个示例-resteasy测试套件。

代码语言:javascript
复制
public static void bind(ServiceBinder binder)
{
    binder.bind(ReloadableEchoResource.class, ReloadableEchoResourceImpl.class);
}

@Contribute(javax.ws.rs.core.Application.class)
public static void configureRestResources(Configuration<Object> singletons, ReloadableEchoResource reloadableEchoResource)
{
    singletons.add(reloadableEchoResource);
}

我自己的作品

这正是我要做的(嗯.嗯,至少我认为是这样;D):

我的装订

代码语言:javascript
复制
public static void bind(ServiceBinder binder)
{
    binder.bind(PushMessageService.class, GCMPushMessageServiceImpl.class);
    binder.bind(UserService.class, HibernateUserServiceImpl.class);
    binder.bind(IUserResource.class, UserResourceImpl.class);

}

/**
 * Contributions to the RESTeasy main Application, insert all your RESTeasy singletons services here.
 */
@Contribute(javax.ws.rs.core.Application.class)
public static void configureRestResources(Configuration<Object> singletons, IUserResource userResource)
{
    singletons.add(userResource);
}

我的界面

代码语言:javascript
复制
@Path("/user")
public interface IUserResource {

    /**
     * Lecture de tous les utilisateurs
     * 
     * @return une List des utilisateurs existants
     */
    @GET
    @Produces("application/json")
    public abstract List<User> getAllDomains();

错误

但是当我启动我的应用程序时,我得到了这样的消息:

代码语言:javascript
复制
HTTP ERROR 500

Problem accessing /user. Reason:

Exception constructing service 'ResteasyRequestFilter': Error building service proxy for service 'Application' (at org.tynamo.resteasy.Application(Collection) (at Application.java:14) via org.tynamo.resteasy.ResteasyModule.bind(ServiceBinder) (at ResteasyModule.java:31)): Error invoking service contribution method org.tynamo.resteasy.ResteasyModule.javaxWsRsCoreApplication(Configuration, ObjectLocator, ResteasyPackageManager, ClassNameLocator): Class com.sopragroup.ecommerce.mobile.rest.IUserResource does not contain a public constructor needed to autobuild.

Caused by:

java.lang.RuntimeException: Exception constructing service 'ResteasyRequestFilter': Error building service proxy for service 'Application' (at org.tynamo.resteasy.Application(Collection) (at Application.java:14) via org.tynamo.resteasy.ResteasyModule.bind(ServiceBinder) (at ResteasyModule.java:31)): Error invoking service contribution method org.tynamo.resteasy.ResteasyModule.javaxWsRsCoreApplication(Configuration, ObjectLocator, ResteasyPackageManager, ClassNameLocator): Class com.sopragroup.ecommerce.mobile.rest.IUserResource does not contain a public constructor needed to autobuild.
    at org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.obtainObjectFromCreator(JustInTimeObjectCreator.java:75)
    at org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.createObject(JustInTimeObjectCreator.java:54)

这就像自动绑定不起作用一样(我确实认为是这样)。显然,当我试图不创建界面和绑定时,它就像一种魅力。

谁能给我个线索吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-01-18 09:21:07

我认为问题在于tapestry-resteasy试图自动构建IUserResource,因为它在"rest“包中。

以下是您可能错过的一条非常重要的文档行:

还有一件事:不要将此服务放在自动发现包中。

这是一条重要的行,它不知何故隐藏在文档中,因此我添加了一个警告,使它对未来的用户更加可见:http://docs.codehaus.org/pages/diffpagesbyversion.action?pageId=151847035&selectedPageVersions=24&selectedPageVersions=23

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/14389232

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档