简体   繁体   中英

Error invoking command! when deploying war to WebSphere Liberty server using Maven Cargo

I'm currently trying to deploy a war file to a Websphere Liberty server.

    <profile>
        <id>integration</id>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.codehaus.cargo</groupId>
                    <artifactId>cargo-maven2-plugin</artifactId>
                    <version>1.6.11</version>
                    <configuration>
                        <!-- Container configuration -->
                        <container>
                            <containerId>websphere85x</containerId>
                            <type>installed</type>
                        </container>
                        <configuration>
                            <type>existing</type>
                            <home>WebSphere server location</home>
                        </configuration>
                        <deployables>
                            <deployable>
                                <artifactId>artifact</artifactId>
                                <groupId>com.group</groupId>
                                <type>war</type>
                            </deployable>
                        </deployables>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    </profile>

When I run

cargo:deploy -Pintegration

I get the following error

[ERROR] Failed to execute goal org.codehaus.cargo:cargo-maven2->plugin:1.6.11:deploy (default-cli) on project artifact: Execution >default-cli of goal org.codehaus.cargo:cargo-maven2-plugin:1.6.11:deploy >failed: Deploy failed: Cannot execute jython script. Error invoking command! >Cannot run program "null\\bin\\wsadmin.bat": CreateProcess error=2, The system >cannot find the file specified

Anyone know what is causing this?

What plugin\\dependency I should use to get wsadmin.bat?

Or how I can fix this problem?

Thanks in advance

UPDATE

I am almost able to get this working The new config is below

<profile>
    <id>integration</id>
    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.cargo</groupId>
                <artifactId>cargo-maven2-plugin</artifactId>
                <version>1.6.11</version>
                <configuration>
                    <!-- Container configuration -->
                    <container>
                        <containerId>liberty</containerId>
                        <type>installed</type>
                    </container>
                    <configuration>
                        <home>LibertyServer</home>
                    </configuration>
                    <deployables>
                        <deployable>
                            <artifactId>SIS-AM-CONSOL-GSPWeb</artifactId>
                            <groupId>com.group</groupId>
                            <type>war</type>
                        </deployable>
                    </deployables>
                </configuration>
            </plugin>
        </plugins>
    </build>
</profile>

The issue now is that the war file is getting deployed to

LibertyServer\\servers\\defaultServer\\apps

While the correct location should be

LibertyServer\\usr\\servers\\defaultServer\\apps

I have been looking at the reference guide but I don't see a way to have a custom directory.

I did try to add

<files>
    <copy>
        <file>war file</file>
        <toDir>LibertyServer\usr\servers\defaultServer\apps</toDir>
        <overwrite>true</overwrite>
    </copy>
</files>

Into the configuration settings.

But as expected this did not work.

Any ideas?

Thanks again.

Update <home>WebSphere server location</home> to point to your WAS_HOME location. When it tries to locate wsadmin to execute the jython script, it's failing: null\\bin\\wsadmin.bat. null should be the value of WAS_HOME...

Got the deployment working with the following code

<profile>
    <id>integration</id>
    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.cargo</groupId>
                <artifactId>cargo-maven2-plugin</artifactId>
                <version>1.6.11</version>
                <configuration>
                    <!-- Container configuration -->
                    <container>
                        <timeout>600000</timeout>
                        <containerId>liberty</containerId>
                        <type>installed</type>
                        <home>ServerHome</home>
                    </container>
                    <configuration>
                        <type>standalone</type>
                        <home>ServerHome</home>
                    </configuration>
                    <deployables>
                        <deployable>
                            <artifactId>Artifact</artifactId>
                            <groupId>com.group</groupId>
                            <type>war</type>
                        </deployable>
                    </deployables>
                </configuration>
            </plugin>
        </plugins>
    </build>
</profile>

Also it seems that you cannot configure where the war file is deployed to. It will only deploy to defaultServer.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM