{"action":"created","issue":{"url":"https://api.github.com/repos/crnk-project/crnk-framework/issues/308","repository_url":"https://api.github.com/repos/crnk-project/crnk-framework","labels_url":"https://api.github.com/repos/crnk-project/crnk-framework/issues/308/labels{/name}","comments_url":"https://api.github.com/repos/crnk-project/crnk-framework/issues/308/comments","events_url":"https://api.github.com/repos/crnk-project/crnk-framework/issues/308/events","html_url":"https://github.com/crnk-project/crnk-framework/issues/308","id":320694186,"number":308,"title":"Can not override crnk resource domain","user":{"login":"ThangLeQuoc","id":20574640,"avatar_url":"https://avatars0.githubusercontent.com/u/20574640?v=4","gravatar_id":"","url":"https://api.github.com/users/ThangLeQuoc","html_url":"https://github.com/ThangLeQuoc","followers_url":"https://api.github.com/users/ThangLeQuoc/followers","following_url":"https://api.github.com/users/ThangLeQuoc/following{/other_user}","gists_url":"https://api.github.com/users/ThangLeQuoc/gists{/gist_id}","starred_url":"https://api.github.com/users/ThangLeQuoc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ThangLeQuoc/subscriptions","organizations_url":"https://api.github.com/users/ThangLeQuoc/orgs","repos_url":"https://api.github.com/users/ThangLeQuoc/repos","events_url":"https://api.github.com/users/ThangLeQuoc/events{/privacy}","received_events_url":"https://api.github.com/users/ThangLeQuoc/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-05-07T06:57:32Z","updated_at":"2018-05-07T10:38:39Z","closed_at":null,"author_association":"NONE","body":"Our application is implement with a proxy (Adnovum Proxy). So when _crnk_ generate the URL, the resource is not accessible.\r\nThat's why we want to manually override the generated domain URL to the proxy domain. \r\n\r\nWe implement a filter, followed your (documentation)[ https://www.crnk.io/releases/stable/documentation/#_integrating_using_a_filter] \r\nWe change from current crnk version _1.0.20170721162741_ to _2.6.20180430102904_, and implement the filter and mapping just like in your documentation\r\n\r\n**web.xml**\r\n```\r\n<filter>\r\n\t\t<filter-name>ProjwebCrnkFilter</filter-name>\r\n\t\t<filter-class>ch.adnovum.projweb.jsf2app.web.util.ProjwebCrnkFilter</filter-class>\r\n\t\t<init-param>\r\n\t\t\t<param-name>crnk.config.core.resource.domain</param-name>\r\n\t\t\t<param-value>http://www.mydomain.com</param-value>\r\n\t\t</init-param>\r\n\t</filter>\r\n```\r\n\r\nThe project passed the compile phase, but in phase deploy to wildfly container, it throws exception \r\n\r\n```\r\n[exec] {\"WFLYCTL0062: Composite operation failed and was rolled back. Steps that failed:\" => {\"Operation step-2\" => {\"WFLYCTL0080: Failed services\" => \r\n{\"jboss.undertow.deployment.default-server.default-host./projweb\" => \"org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host./projweb: java.lang.IllegalStateException: already set\r\n\r\n```\r\n\r\nMore information in the log file:\r\n```\r\n2018-05-07 13:23:12,231 INFO  [ServerService T] [resteasy.spi.ResteasyDeployment] Deploying javax.ws.rs.core.Application: class ch.adnovum.projweb.ws.v3.RestApplication$Proxy$_$$_WeldClientProxy\r\n2018-05-07 13:23:12,234 INFO  [ServerService T] [resteasy.spi.ResteasyDeployment] Adding class resource ch.adnovum.projweb.ws.v3.ProjectRestService from Application class ch.adnovum.projweb.ws.v3.RestApplication$Proxy$_$$_WeldClientProxy\r\n2018-05-07 13:23:12,235 INFO  [ServerService T] [resteasy.spi.ResteasyDeployment] Adding class resource ch.adnovum.projweb.ws.v3.SnowProjectRestService from Application class ch.adnovum.projweb.ws.v3.RestApplication$Proxy$_$$_WeldClientProxy\r\n2018-05-07 13:23:12,235 INFO  [ServerService T] [resteasy.spi.ResteasyDeployment] Adding class resource ch.adnovum.projweb.ws.v3.MoRepRestService from Application class ch.adnovum.projweb.ws.v3.RestApplication$Proxy$_$$_WeldClientProxy\r\n2018-05-07 13:23:12,235 INFO  [ServerService T] [resteasy.spi.ResteasyDeployment] Adding class resource ch.adnovum.projweb.ws.v3.SystemRestService from Application class ch.adnovum.projweb.ws.v3.RestApplication$Proxy$_$$_WeldClientProxy\r\n2018-05-07 13:23:12,235 INFO  [ServerService T] [resteasy.spi.ResteasyDeployment] Adding class resource ch.adnovum.projweb.ws.v3.AdnDmsRestService from Application class ch.adnovum.projweb.ws.v3.RestApplication$Proxy$_$$_WeldClientProxy\r\n2018-05-07 13:23:12,235 INFO  [ServerService T] [resteasy.spi.ResteasyDeployment] Adding provider class ch.adnovum.projweb.ws.v2.JacksonObjectMapperProvider from Application class ch.adnovum.projweb.ws.v3.RestApplication$Proxy$_$$_WeldClientProxy\r\n2018-05-07 13:23:12,235 INFO  [ServerService T] [resteasy.spi.ResteasyDeployment] Adding provider class ch.adnovum.projweb.ws.v2.RestCallExceptionMapper from Application class ch.adnovum.projweb.ws.v3.RestApplication$Proxy$_$$_WeldClientProxy\r\n2018-05-07 13:23:12,280 TRACE [ServerService T] [            org.jboss.security] PBOX00354: Setting security roles ThreadLocal: null\r\n2018-05-07 13:23:12,281 ERROR [ServerService T] [              msc.service.fail] MSC000001: Failed to start service jboss.undertow.deployment.default-server.default-host./projweb: org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host.\r\n/projweb: java.lang.IllegalStateException: already set\r\n    at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:85)\r\n    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)\r\n    at java.util.concurrent.FutureTask.run(FutureTask.java:266)\r\n    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)\r\n    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)\r\n    at java.lang.Thread.run(Thread.java:745)\r\n    at org.jboss.threads.JBossThread.run(JBossThread.java:320)\r\nCaused by: java.lang.IllegalStateException: already set\r\n    at io.crnk.core.engine.internal.utils.PreconditionUtil.fail(PreconditionUtil.java:46)\r\n    at io.crnk.core.engine.internal.utils.PreconditionUtil.verify(PreconditionUtil.java:100)\r\n    at io.crnk.core.engine.internal.utils.PreconditionUtil.assertTrue(PreconditionUtil.java:70)\r\n    at io.crnk.core.engine.internal.utils.PreconditionUtil.assertNull(PreconditionUtil.java:94)\r\n    at io.crnk.core.boot.CrnkBoot.setServiceDiscovery(CrnkBoot.java:467)\r\n    at ch.adnovum.projweb.ws.v3.RestApplication.getSingletons(RestApplication.java:45)\r\n    at ch.adnovum.projweb.ws.v3.RestApplication$Proxy$_$$_WeldClientProxy.getSingletons(Unknown Source)\r\n    at org.jboss.resteasy.spi.ResteasyDeployment.processApplication(ResteasyDeployment.java:499)\r\n    at org.jboss.resteasy.spi.ResteasyDeployment.registration(ResteasyDeployment.java:327)\r\n    at org.jboss.resteasy.spi.ResteasyDeployment.start(ResteasyDeployment.java:241)\r\n    at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.init(ServletContainerDispatcher.java:112)\r\n    at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.init(HttpServletDispatcher.java:36)\r\n    at io.undertow.servlet.core.LifecyleInterceptorInvocation.proceed(LifecyleInterceptorInvocation.java:117)\r\n    at org.wildfly.extension.undertow.security.RunAsLifecycleInterceptor.init(RunAsLifecycleInterceptor.java:78)\r\n    at io.undertow.servlet.core.LifecyleInterceptorInvocation.proceed(LifecyleInterceptorInvocation.java:103)\r\n    at io.undertow.servlet.core.ManagedServlet$DefaultInstanceStrategy.start(ManagedServlet.java:230)\r\n    at io.undertow.servlet.core.ManagedServlet.createServlet(ManagedServlet.java:131)\r\n    at io.undertow.servlet.core.DeploymentManagerImpl.start(DeploymentManagerImpl.java:511)\r\n    at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:101)\r\n    at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:82)\r\n    ... 6 more\r\n\r\n2018-05-07 13:23:12,294 ERROR [management-hand] [as.controller.management-operation] WFLYCTL0013: Operation (\"deploy\") failed - address: ({\"deployment\" => \"projweb-web.war\"}) - failure description: {\"WFLYCTL0080: Failed services\" => {\"jboss.undertow.deployment.default-server.defaul\r\nt-host./projweb\" => \"org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host./projweb: java.lang.IllegalStateException: already set\r\n    Caused by: java.lang.IllegalStateException: already set\"}}\r\n2018-05-07 13:23:12,297 ERROR [management-hand] [               jboss.as.server] WFLYSRV0021: Deploy of deployment \"projweb-web.war\" was rolled back with the following failure message: \r\n{\"WFLYCTL0080: Failed services\" => {\"jboss.undertow.deployment.default-server.default-host./projweb\" => \"org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host./projweb: java.lang.IllegalStateException: already set\r\n    Caused by: java.lang.IllegalStateException: already set\"}}\r\n2018-05-07 13:23:12,319 INFO  [MSC service thr] [      connector.deployers.jdbc] WFLYJCA0019: Stopped Driver service with driver-name = projweb-web.war_org.h2.Driver_1_3\r\n2018-05-07 13:23:12,331 TRACE [MSC service thr] [            org.jboss.security] PBOX00337: nextState for action getPolicyConfiguration: open\r\n2018-05-07 13:23:12,331 TRACE [MSC service thr] [            org.jboss.security] PBOX00315: delete, contextID: projweb-web.war\r\n2018-05-07 13:23:12,331 TRACE [MSC service thr] [            org.jboss.security] PBOX00337: nextState for action delete: deleted\r\n2018-05-07 13:23:12,397 INFO  [MSC service thr] [internal.xml.ValidationXmlParser] HV000007: META-INF/validation.xml found. Parsing XML based configuration.\r\n2018-05-07 13:23:12,461 INFO  [MSC service thr] [internal.xml.ValidationBootstrapParameters] HV000004: Using ch.adnovum.projweb.business.internal.ProjectWebMessageInterpolator as message interpolator.\r\n2018-05-07 13:23:12,487 INFO  [ServerService T] [                  jboss.as.jpa] WFLYJPA0011: Stopping Persistence Unit (phase 2 of 2) Service 'projweb-web.war#PROJWEB-UNIT'\r\n2018-05-07 13:23:12,529 INFO  [ServerService T] [                  jboss.as.jpa] WFLYJPA0011: Stopping Persistence Unit (phase 1 of 2) Service 'projweb-web.war#PROJWEB-UNIT'\r\n2018-05-07 13:23:12,530 INFO  [MSC service thr] [           jboss.weld.deployer] WFLYWELD0010: Stopping weld service for deployment projweb-web.war\r\n2018-05-07 13:23:12,718 INFO  [MSC service thr] [          as.server.deployment] WFLYSRV0028: Stopped deployment projweb-web.war (runtime-name: projweb-web.war) in 419ms\r\n2018-05-07 13:23:12,722 INFO  [management-hand] [           jboss.as.controller] WFLYCTL0183: Service status report\r\n```\r\n\r\nThis is the `RestApplication.java` class , the location of exception:\r\n\r\n```\r\n@ApplicationPath(\"/api/v3\")\r\n@ApplicationScoped\r\npublic class RestApplication extends Application {\t\r\n\t@Override\r\n\tpublic Set<Class<?>> getClasses() {\r\n\t\tSet<Class<?>> classes = new HashSet<>();\r\n\r\n\t\tclasses.add(JacksonObjectMapperProvider.class);\r\n\t\tclasses.add(RestCallExceptionMapper.class);\r\n\t\tclasses.add(MoRepRestService.class);\r\n\t\tclasses.add(SystemRestService.class);\r\n\t\tclasses.add(ProjectRestService.class);\r\n\t\tclasses.add(SnowProjectRestService.class);\r\n\t\tclasses.add(AdnDmsRestService.class);\r\n\r\n\r\n\t\treturn classes;\r\n\t}\r\n\r\n\t@Override\r\n\tpublic Set<Object> getSingletons() {\r\n\t\tCrnkFeature crnk = new CrnkFeature();\r\n\t\t((DefaultQuerySpecUrlMapper) crnk.getUrlMapper()).setAllowUnknownAttributes(true);\r\n\t\tcrnk.getBoot().setServiceDiscovery(new CdiServiceDiscovery());\r\n\t\tSet<Object> singletons = new HashSet<>();\r\n\t\tsingletons.add(crnk);\r\n\t\treturn singletons;\r\n\t}\r\n}\r\n```\r\nThis is weird since the exception said that the _setServiceDiscovery()_ got a null object, but we actually instantiated it.\r\n\r\nCan you please help us out ? Thank you"},"comment":{"url":"https://api.github.com/repos/crnk-project/crnk-framework/issues/comments/387026727","html_url":"https://github.com/crnk-project/crnk-framework/issues/308#issuecomment-387026727","issue_url":"https://api.github.com/repos/crnk-project/crnk-framework/issues/308","id":387026727,"user":{"login":"remmeier","id":8008853,"avatar_url":"https://avatars3.githubusercontent.com/u/8008853?v=4","gravatar_id":"","url":"https://api.github.com/users/remmeier","html_url":"https://github.com/remmeier","followers_url":"https://api.github.com/users/remmeier/followers","following_url":"https://api.github.com/users/remmeier/following{/other_user}","gists_url":"https://api.github.com/users/remmeier/gists{/gist_id}","starred_url":"https://api.github.com/users/remmeier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/remmeier/subscriptions","organizations_url":"https://api.github.com/users/remmeier/orgs","repos_url":"https://api.github.com/users/remmeier/repos","events_url":"https://api.github.com/users/remmeier/events{/privacy}","received_events_url":"https://api.github.com/users/remmeier/received_events","type":"User","site_admin":false},"created_at":"2018-05-07T10:38:39Z","updated_at":"2018-05-07T10:38:39Z","author_association":"CONTRIBUTOR","body":"alternatively you can make use of CrnkFeature.setServiceUrlProvider(new ConstantServiveUrlProvider(\"...\")), the property is a shortcut for it."}}
{"actor":{"display_login":"remmeier"}}