JBoss Community

Re: Load on startup is ignored - JaxWS webservice is always initialized first

created by rushead in JBoss AS7 Development - View the full discussion

I now throw an Exception in the @PostConstruct.

It does not causes the failure of the whole deployment, which is now a good solution for me.

 

The only thing which irritates me is that I am only allowed to declare that the method throws "Exception", I'm not allowed to declare a custom implementation of Exception (in my case "ConfigurationException)".

 

 

Caused by: org.jboss.ws.common.injection.InjectionException: Method annotated with @interface javax.annotation.PostConstruct annotation cannot throw checked exceptions: public void servlet.hello.helloservlet.HelloServletImpl.initSettings() throws servlet.hello.helloservlet.exceptions.ConfigurationException

    at org.jboss.ws.common.injection.finders.ReflectionUtils.assertNoCheckedExceptionsAreThrown(ReflectionUtils.java:185)

    at org.jboss.ws.common.injection.finders.AbstractPostConstructPreDestroyAnnotatedMethodFinder.validate(AbstractPostConstructPreDestroyAnnotatedMethodFinder.java:67)

    at org.jboss.ws.common.injection.finders.PostConstructMethodFinder.validate(PostConstructMethodFinder.java:46)

    at org.jboss.ws.common.injection.finders.AbstractPostConstructPreDestroyAnnotatedMethodFinder.validate(AbstractPostConstructPreDestroyAnnotatedMethodFinder.java:35)

    at org.jboss.ws.common.reflection.AbstractClassProcessor.process(AbstractClassProcessor.java:54)

    at org.jboss.ws.common.injection.InjectionHelper.callPostConstructMethod(InjectionHelper.java:169)

    at org.jboss.ws.common.invocation.InvocationHandlerJAXWS.onEndpointInstantiated(InvocationHandlerJAXWS.java:71)

    at org.jboss.ws.common.invocation.AbstractInvocationHandlerJSE.init(AbstractInvocationHandlerJSE.java:63)

    at org.jboss.ws.common.invocation.AbstractInvocationHandlerJSE.invoke(AbstractInvocationHandlerJSE.java:97)

    at org.jboss.wsf.stack.cxf.AbstractInvoker._invokeInternal(AbstractInvoker.java:169)

    ... 32 more

 

 

 

That's no problem, I just don't know why "Exception" is not a catched exception...

Reply to this message by going to Community

Start a new discussion in JBoss AS7 Development at Community