0

I am creating a java/jsf web application in NetBeans using by GlassFish Server. When I try to deploy the application, it failed and getting the following error:

GlassFish Server 4, deploy, null, false
C:\Users\Wais\Documents\JSF-Unterlagen\Kapitel_8_JavaServerFaces_im_Einsatz_OnlineBanking\banking\build\nbproject\build-impl.xml:1039: The module has not been deployed.
See the server log for details.
BUILD FAILED (total time: 16 seconds)

GlassFish Server Log File:

[2014-08-17T01:35:04.193+0200] [glassfish 4.0] [SEVERE] [] [javax.enterprise.system.core] [tid: _ThreadID=35 _ThreadName=admin-listener(2)] [timeMillis: 1408232104193] [levelValue: 1000] [[
  Ausnahme beim Deployment der Anwendung [OnlineBanking] : Der Rückgabetyp der Lebenszyklusmethode [init] muss "void" sein. Verwandte Annotationsinformationen: Annotation [@javax.annotation.PostConstruct()] zu annotiertem Element [public java.lang.String de.jsfpraxis.managedbean.DBInit.init()] des Typs [METHOD]. 
Der Rückgabetyp der Lebenszyklusmethode [init] muss "void" sein. Verwandte Annotationsinformationen: Annotation [@javax.annotation.PostConstruct()] zu annotiertem Element [public java.lang.String de.jsfpraxis.managedbean.DBInit.init()] des Typs [METHOD]. 
    at org.glassfish.apf.impl.AnnotationProcessorImpl.process(AnnotationProcessorImpl.java:367)
    at org.glassfish.apf.impl.AnnotationProcessorImpl.process(AnnotationProcessorImpl.java:375)
    at org.glassfish.apf.impl.AnnotationProcessorImpl.processAnnotations(AnnotationProcessorImpl.java:289)
    at org.glassfish.apf.impl.AnnotationProcessorImpl.process(AnnotationProcessorImpl.java:217)
    at org.glassfish.apf.impl.AnnotationProcessorImpl.process(AnnotationProcessorImpl.java:134)
    at com.sun.enterprise.deployment.archivist.Archivist.processAnnotations(Archivist.java:626)
    at com.sun.enterprise.deployment.archivist.Archivist.readAnnotations(Archivist.java:462)
    at com.sun.enterprise.deployment.archivist.Archivist.readAnnotations(Archivist.java:446)
    at com.sun.enterprise.deployment.archivist.Archivist.readRestDeploymentDescriptors(Archivist.java:419)
    at com.sun.enterprise.deployment.archivist.Archivist.readDeploymentDescriptors(Archivist.java:396)
    at com.sun.enterprise.deployment.archivist.Archivist.open(Archivist.java:271)
    at com.sun.enterprise.deployment.archivist.Archivist.open(Archivist.java:280)
    at com.sun.enterprise.deployment.archivist.Archivist.open(Archivist.java:241)
    at com.sun.enterprise.deployment.archivist.ApplicationFactory.openArchive(ApplicationFactory.java:161)
    at org.glassfish.javaee.core.deployment.DolProvider.processDOL(DolProvider.java:198)
    at org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:222)
    at org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:96)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.loadDeployer(ApplicationLifecycle.java:878)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.setupContainerInfos(ApplicationLifecycle.java:818)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:374)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219)
    at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:527)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:523)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:360)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:522)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:546)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1423)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1500(CommandRunnerImpl.java:108)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1762)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1674)
    at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:534)
    at com.sun.enterprise.v3.admin.AdminAdapter.onMissingResource(AdminAdapter.java:224)
    at org.glassfish.grizzly.http.server.StaticHttpHandler.service(StaticHttpHandler.java:297)
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:246)
    at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
    at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
    at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
    at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
    at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
    at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
    at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalArgumentException: Der Rückgabetyp der Lebenszyklusmethode [init] muss "void" sein
    at com.sun.enterprise.deployment.annotation.handlers.AbstractResourceHandler.validateAnnotatedLifecycleMethod(AbstractResourceHandler.java:191)
    at com.sun.enterprise.deployment.annotation.handlers.PostConstructHandler.processAnnotation(PostConstructHandler.java:72)
    at com.sun.enterprise.deployment.annotation.handlers.AbstractResourceHandler.processAnnotation(AbstractResourceHandler.java:142)
    at com.sun.enterprise.deployment.annotation.factory.SJSASFactory$LazyAnnotationHandler.processAnnotation(SJSASFactory.java:148)
    at org.glassfish.apf.impl.AnnotationProcessorImpl.process(AnnotationProcessorImpl.java:344)
    ... 52 more
]]
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Amin
  • 1
  • 1
  • Try switching your environment to English. There are SO MANY MORE hits on among others Google when you paste an English exception message in there. Even when you got a rather self-explaining one ... – BalusC Aug 18 '14 at 05:17
  • The interesting line which is a german sentence: Der Rückgabetyp der Lebenszyklusmethode [init] muss "void" sein means "Be the return type of life cycle method [init] must be "void". – Amin Aug 19 '14 at 12:20
  • Exception while deploying the application [Online Banking]. Related Annotationsinformationen: annotation [@ javax.annotation.PostConstruct ()] to annotated element [public java.lang.String de.jsfpraxis.managedbean.DBInit.init ()] of the type [METHOD]. Be the return type of life cycle method [init] must be "void". Related Annotationsinformationen: annotation [@ javax.annotation.PostConstruct ()] to annotated element [public java.lang.String de.jsfpraxis.managedbean.DBInit.init ()] of the type [METHOD]. – Amin Aug 19 '14 at 12:37
  • I want to know how can I solve this problem? I need an easier way to put or replace the return type "void" in spots. – Amin Aug 19 '14 at 12:52
  • Sorry, I'm a beginner in JSF/Web application and don't have so much knowledge like you, if all class/method names are already mentioned in the exception like you said, why doesn't run my web application. – Amin Aug 19 '14 at 13:05

1 Answers1

0

So, you got this error:

Der Rückgabetyp der Lebenszyklusmethode [init] muss "void" sein.

The English translation of this is:

The return type of lifecycle method [init] MUST be "void".

The remainder of the error says that it concerns the @PostConstruct annotation on this method:

public java.lang.String de.jsfpraxis.managedbean.DBInit.init()

That method apparently returns java.lang.String instead of void:

package de.jsfpraxis.managedbean;

public class DBInit {

    @PostConstruct
    public String init() {
        // ...
    }

}

This is indeed wrong! This violates the contract which says among others:

... The return type of the method MUST be void ...

Fix it accordingly:

package de.jsfpraxis.managedbean;

public class DBInit {

    @PostConstruct
    public void init() {
        // ...
    }

}
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • Now I got it what you say, maybe my english knowledge is not so good, I try to fix it, Thank you in advance! – Amin Aug 19 '14 at 13:25
  • And now, given that the answer is still unaccepted, did you manage to actually solve the problem? – BalusC Aug 21 '14 at 11:55