deploying web app to external glassfish4 instance

2019-04-30 20:07发布

问题:

I'm trying to deploy an app using cargo, this is the config for it:

<plugin>
            <groupId>org.codehaus.cargo</groupId>
            <artifactId>cargo-maven2-plugin</artifactId>
            <version>1.4.9</version>
            <configuration>
                <wait>true</wait>
                <container>
                    <containerId>glassfish4x</containerId>
                    <type>remote</type>
                </container>
                <configuration>
                    <type>runtime</type>
                    <properties>
                        <cargo.hostname>remote-IP-address</cargo.hostname>
                        <cargo.remote.username>admin</cargo.remote.username>
                        <cargo.remote.password>######</cargo.remote.password>
                        <cargo.glassfish.admin.port>4848</cargo.glassfish.admin.port>
                        <cargo.glassfish.domain.name>domain1</cargo.glassfish.domain.name>
                    </properties>
                </configuration>
                    <deployables>
                        <deployable>
                            <groupId>${project.groupId}</groupId>
                            <artifactId>${project.artifactId}</artifactId>
                            <type>war</type>
                            <properties>
                                <context>/app</context>
                            </properties>
                        </deployable>
                    </deployables>

            </configuration>
            <dependencies>
                <dependency>
                    <groupId>org.glassfish.deployment</groupId>
                    <artifactId>deployment-client</artifactId>
                    <version>3.2-b06</version>
                </dependency>
            </dependencies>
        </plugin>

Unfortunately, the server throws this exception after after about 30s:

    [2014-09-25T11:39:47.598+0200] [glassfish 4.1] [SEVERE] [NCLS-CORE-00003] [javax.enterprise.system.core] [tid: _ThreadID=339 _ThreadName=admin-listener(44)] [timeMillis: 1411637987598] [levelValue: 1000] [[
  Exception while running a command
java.io.IOException: java.util.concurrent.TimeoutException
        at org.glassfish.admin.payload.PayloadFilesManager.extractFile(PayloadFilesManager.java:584)
        at org.glassfish.admin.payload.PayloadFilesManager.access$600(PayloadFilesManager.java:93)
        at org.glassfish.admin.payload.PayloadFilesManager$DataRequestType$1.processPart(PayloadFilesManager.java:749)
        at org.glassfish.admin.payload.PayloadFilesManager.processPartsExtended(PayloadFilesManager.java:618)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl$UploadedFilesManager.extractFiles(CommandRunnerImpl.java:2074)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl$UploadedFilesManager.<init>(CommandRunnerImpl.java:2046)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl$UploadedFilesManager.<init>(CommandRunnerImpl.java:2025)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1155)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:109)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1846)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1722)
        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.StaticHttpHandlerBase.service(StaticHttpHandlerBase.java:189)
        at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459)
        at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167)
        at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:201)
        at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:175)
        at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)
        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.portunif.PUFilter.handleRead(PUFilter.java:231)
        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.portunif.PUFilter.handleRead(PUFilter.java:231)
        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:561)
        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:565)
        at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:545)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.IOException: java.util.concurrent.TimeoutException
        at org.glassfish.grizzly.nio.transport.TCPNIOTransportFilter.handleRead(TCPNIOTransportFilter.java:90)
        at org.glassfish.grizzly.filterchain.TransportFilter.handleRead(TransportFilter.java:173)
        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.read(DefaultFilterChain.java:351)
        at org.glassfish.grizzly.filterchain.FilterChainContext.read(FilterChainContext.java:695)
        at org.glassfish.grizzly.portunif.BackChannelFilter.handleRead(BackChannelFilter.java:80)
        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.read(DefaultFilterChain.java:351)
        at org.glassfish.grizzly.filterchain.FilterChainContext.read(FilterChainContext.java:695)
        at org.glassfish.grizzly.portunif.BackChannelFilter.handleRead(BackChannelFilter.java:80)
        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.read(DefaultFilterChain.java:351)
        at org.glassfish.grizzly.filterchain.FilterChainContext.read(FilterChainContext.java:695)
        at org.glassfish.grizzly.http.io.InputBuffer.blockingRead(InputBuffer.java:1119)
        at org.glassfish.grizzly.http.server.io.ServerInputBuffer.blockingRead(ServerInputBuffer.java:95)
        at org.glassfish.grizzly.http.io.InputBuffer.fill(InputBuffer.java:1143)
        at org.glassfish.grizzly.http.io.InputBuffer.read(InputBuffer.java:353)
        at org.glassfish.grizzly.http.server.NIOInputStreamImpl.read(NIOInputStreamImpl.java:83)
        at java.io.BufferedInputStream.fill(BufferedInputStream.java:235)
        at java.io.BufferedInputStream.read1(BufferedInputStream.java:275)
        at java.io.BufferedInputStream.read(BufferedInputStream.java:334)
        at java.io.FilterInputStream.read(FilterInputStream.java:133)
        at java.io.PushbackInputStream.read(PushbackInputStream.java:186)
        at java.util.zip.InflaterInputStream.fill(InflaterInputStream.java:238)
        at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:158)
        at java.util.zip.ZipInputStream.read(ZipInputStream.java:193)
        at java.io.FilterInputStream.read(FilterInputStream.java:107)
        at org.glassfish.admin.payload.ZipPayloadImpl$Inbound$ZipEntryInputStream.read(ZipPayloadImpl.java:220)
        at org.glassfish.admin.payload.PayloadFilesManager.extractFile(PayloadFilesManager.java:549)
        ... 46 more
Caused by: java.util.concurrent.TimeoutException
        at org.glassfish.grizzly.nio.tmpselectors.TemporarySelectorReader.read(TemporarySelectorReader.java:126)
        at org.glassfish.grizzly.nio.tmpselectors.TemporarySelectorReader.read(TemporarySelectorReader.java:75)
        at org.glassfish.grizzly.AbstractReader.read(AbstractReader.java:72)
        at org.glassfish.grizzly.nio.transport.TCPNIOTransportFilter.handleRead(TCPNIOTransportFilter.java:77)
        ... 80 more

when I'm trying to do the same localy(changing the host name), it works.The only difference between those two instances is the local is 4.0 and the remote is 4.1. Can anyone tell me what am I doing wrong? I've tried also with setting the protocol to https by using the cargo.protocol property.

Best Regards, Marek

I forgot to post the maven command I execute, here it is: mvn package cargo:deploy

thanx in advance!

回答1:

The bug is already tracked in JIRA as:

https://java.net/jira/browse/GLASSFISH-21180

https://java.net/jira/browse/GLASSFISH-21196

There exists a proposed solution now from oleksiys. Try replacing Grizzly with patched version from the following thread.

https://java.net/jira/browse/GRIZZLY-1713

I'm going to try it soon myself, then I'll confirm it here.

EDIT: Solution confirmed according to our own tests and also by other user in thread Cargo remote deployment Glassfish 4.1 Fails GlassFish uses 100% CPU

Direct download of patched grizzly from Oleksiy Stashok: https://dl.dropboxusercontent.com/u/7319744/glassfish-4.1/nucleus-grizzly-all.jar

Also Grizzly 2.3.16 and later fixes the bug.