eclipse-ee4j / jakartaee-tutorial

Jakarta EE Tutorial
https://eclipse-ee4j.github.io/jakartaee-tutorial
Eclipse Public License 2.0
96 stars 68 forks source link

Unable to build Duke's Forest case-study #143

Open glassfishrobot opened 5 years ago

glassfishrobot commented 5 years ago

Hi, when trying to build Duke's Forest case-study example in the tutorial, I got the same error explained in issue https://github.com/javaee/tutorial/issues/130#issue-264196325 and solved it following the solution posted in StackOverflow (as mentioned in the issue), but then I got two more errors. I could resolve the first one, but not the other one.

The first one is the following: Failed to execute goal org.codehaus.cargo:cargo-maven2-plugin:1.7.0:redeploy (deploy) on project dukes-payment: Execution deploy of goal org.codehaus.cargo:cargo-maven2-plugin:1.7.0:redeploy failed: GlassFish admin command with args (--interactive=false --host localhost --port 4848 --user admin --passwordfile F:\Desarrollo\JakartaEE\glassfish5\glassfish\domains\password.properties deploy --force --contextroot dukes-payment F:\Desarrollo\JakartaEE\glassfish5\docs\javaee-tutorial\examples\case-studies\dukes-forest\dukes-payment\target\dukes-payment.war) failed: asadmin exited 1 -> [Help 1]

server.log showed this:

Caused by: javax.naming.NameNotFoundException: ForestDataSource not found
    at com.sun.enterprise.naming.impl.TransientContext.doLookup(TransientContext.java:237)
    at com.sun.enterprise.naming.impl.TransientContext.lookup(TransientContext.java:204)
    at com.sun.enterprise.naming.impl.TransientContext.lookup(TransientContext.java:208)
    at com.sun.enterprise.naming.impl.SerialContextProviderImpl.lookup(SerialContextProviderImpl.java:66)
    at com.sun.enterprise.naming.impl.LocalSerialContextProviderImpl.lookup(LocalSerialContextProviderImpl.java:114)
    at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:478)
    ... 69 more

I had to add to web.xml in "dukes-payment" project the following config:

    <data-source>
        <name>java:global/ForestDataSource</name>
        <class-name>org.apache.derby.jdbc.ClientDataSource</class-name>
        <server-name>localhost</server-name>
        <port-number>1527</port-number>
        <database-name>forest</database-name>
        <user>forest</user>
        <password>app</password>
        <property>
            <name>connectionAttributes</name>
            <value>;create=true</value>
        </property>
    </data-source>

After that, "dukes-payment" project finally deployed, but then I got the second error. It is the following: Failed to execute goal org.codehaus.cargo:cargo-maven2-plugin:1.7.0:redeploy (deploy) on project dukes-store: Execution deploy of goal org.codehaus.cargo:cargo-maven2-plugin:1.7.0:redeploy failed: GlassFish admin command with args (--interactive=false --host localhost --port 4848 --user admin --passwordfile F:\Desarrollo\JakartaEE\glassfish5\glassfish\domains\password.properties deploy --force --contextroot dukes-store F:\Desarrollo\JakartaEE\glassfish5\docs\javaee-tutorial\examples\case-studies\dukes-forest\dukes-store\target\dukes-store.war) failed: asadmin exited 1 -> [Help 1]

server.log shows this:

Grave:   enterprise.deployment.util.application.fail
Grave:   Exception while deploying the app [dukes-store]
Grave:   Exception during lifecycle processing
java.lang.IllegalStateException: Application validation fails for given application [dukes-store] for jndi-name [java:global/jms/OrderQueue]
    at com.sun.enterprise.deployment.util.ApplicationValidator.accept(ApplicationValidator.java:113)
    at com.sun.enterprise.deployment.BundleDescriptor.visit(BundleDescriptor.java:641)
    at com.sun.enterprise.deployment.archivist.ApplicationFactory.openWith(ApplicationFactory.java:235)
    at org.glassfish.javaee.core.deployment.DolProvider.processDOL(DolProvider.java:197)
    at org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:231)
    at org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:97)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.loadDeployer(ApplicationLifecycle.java:881)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.setupContainerInfos(ApplicationLifecycle.java:821)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:378)
    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:540)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:536)
    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:535)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:566)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:558)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:360)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:557)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1465)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:110)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1847)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1723)
    at org.glassfish.admin.rest.resources.admin.CommandResource.executeCommand(CommandResource.java:408)
    at org.glassfish.admin.rest.resources.admin.CommandResource.execCommandSimpInMultOut(CommandResource.java:235)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory.lambda$static$0(ResourceMethodInvocationHandlerFactory.java:76)
    at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:148)
    at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:191)
    at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:200)
    at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:103)
    at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:493)
    at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:415)
    at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:104)
    at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:277)
    at org.glassfish.jersey.internal.Errors$1.call(Errors.java:272)
    at org.glassfish.jersey.internal.Errors$1.call(Errors.java:268)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:316)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:298)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:268)
    at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:289)
    at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:256)
    at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:703)
    at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.service(GrizzlyHttpContainer.java:377)
    at org.glassfish.admin.rest.adapter.JerseyContainerCommandService$3.service(JerseyContainerCommandService.java:174)
    at org.glassfish.admin.rest.adapter.RestAdapter.service(RestAdapter.java:179)
    at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:463)
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:168)
    at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:206)
    at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:180)
    at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:242)
    at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
    at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
    at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:539)
    at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:593)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:573)
    at java.lang.Thread.run(Thread.java:748)

Grave:   Exception while deploying the app [dukes-store] : Application validation fails for given application [dukes-store] for jndi-name [java:global/jms/OrderQueue]

Note: I'm using NetBeans 8.2, GlassFish 5 (included in Java EE 8 download zip) and JDK 1.8.0_191.

glassfishrobot commented 5 years ago
mmerel commented 5 years ago

I also got the Caused by: javax.naming.NameNotFoundException: ForestDataSource not found exception when building dukes-forest. After adding the data-source java:global/ForestDataSource to the dukes-payment web.xml, I only had to remove the same definition from dukes-store to make sure it deployed correctly.

Source code version: https://github.com/eclipse-ee4j/jakartaee-tutorial-examples/tree/master/case-studies/dukes-forest 9814044 Server: Glassfish 5.0 build 25

ForestDataSourceNameNotFound.patch.txt