当前位置: 首页 > 知识库问答 >
问题:

使用Netbeans将maven项目部署到glassfish

强宾白
2023-03-14

所以这是我的问题。我正在努力将一个简单的maven应用程序部署到Glassfish服务器中,只是为了检查我的配置是否正确,以便进一步开发。我使用的是NetBeans IDE,但由于它提供的控制台日志很小,几乎无法读取,所以我尝试使用系统终端(我使用的是Fedora)。

我试图部署的应用程序由一个无状态EJB bean(名为DziekanatBean,当前不执行任何操作)和一个Maven POM项目(简称为Maven),它将这个EJB bean作为模块包含在内。我尝试使用

mvn -e glassfish:deploy

项目未部署,则出现以下错误:

[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO] 
[INFO] maven
[INFO] DziekanatBean
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building maven 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-glassfish-plugin:2.1:deploy (default-cli) @ maven ---
Downloading: http://maven.ocean.net.au/release/org/apache/maven/maven-plugin-api/maven-metadata.xml
Downloading: http://maven.ocean.net.au/external/org/apache/maven/maven-plugin-api/maven-metadata.xml
Downloading: http://maven.ocean.net.au/snapshot/org/apache/maven/maven-plugin-api/maven-metadata.xml
[WARNING] Could not transfer metadata org.apache.maven:maven-plugin-api/maven-metadata.xml from/to release.ocean.net.au (http://maven.ocean.net.au/release): maven.ocean.net.au: Ta nazwa lub usługa jest nieznana
[WARNING] Could not transfer metadata org.apache.maven:maven-plugin-api/maven-metadata.xml from/to external.ocean.net.au (http://maven.ocean.net.au/external): maven.ocean.net.au
[WARNING] Could not transfer metadata org.apache.maven:maven-plugin-api/maven-metadata.xml from/to snapshot.ocean.net.au (http://maven.ocean.net.au/snapshot): maven.ocean.net.au
[INFO] asadmin --host localhost --port 4848 --user anonymous --passwordfile /tmp/mgfp3352576098599531177.tmp --interactive=false --echo=true --terse=true deploy --name maven --force=false --precompilejsp=false --verify=false --generatermistubs=false --availabilityenabled=false --asyncreplication=true --keepreposdir=false --keepfailedstubs=false --isredeploy=false --logreportederrors=true --upload=false "/mnt/D/Studia/Semestr 4/java/projekt/maven/target/Dziekanat.jar"
[ERROR] remote failure: File not found : /mnt/D/Studia/Semestr 4/java/projekt/maven/target/Dziekanat.jar
[ERROR] Deployment of /mnt/D/Studia/Semestr 4/java/projekt/maven/target/Dziekanat.jar failed.
[ERROR] For more detail on what might be causing the problem try running maven with the --debug option 
[ERROR] or setting the maven-glassfish-plugin "echo" property to "true".
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] maven ............................................. FAILURE [16.724s]
[INFO] DziekanatBean ..................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 16.893s
[INFO] Finished at: Sat May 18 23:45:39 CEST 2013
[INFO] Final Memory: 12M/172M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.glassfish.maven.plugin:maven-glassfish-plugin:2.1:deploy (default-cli) on project maven: Deployment of /mnt/D/Studia/Semestr 4/java/projekt/maven/target/Dziekanat.jar failed. -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.glassfish.maven.plugin:maven-glassfish-plugin:2.1:deploy (default-cli) on project maven: Deployment of /mnt/D/Studia/Semestr 4/java/projekt/maven/target/Dziekanat.jar failed.
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoFailureException: Deployment of /mnt/D/Studia/Semestr 4/java/projekt/maven/target/Dziekanat.jar failed.
    at org.glassfish.maven.plugin.command.AsadminCommand.execute(AsadminCommand.java:121)
    at org.glassfish.maven.plugin.DeployGlassfishMojo.doExecute(DeployGlassfishMojo.java:66)
    at au.net.ocean.maven.plugin.OceanMojo.execute(OceanMojo.java:67)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    ... 19 more
[ERROR] 
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
                      http://maven.apache.org/xsd/settings-1.0.0.xsd">
    <localRepository/>
    <interactiveMode/>
    <usePluginRegistry/>
    <offline/>
    <pluginGroups/>
    <servers/>
    <mirrors/>
    <priveProfiles>
    <activeProfile>glassfish-context</activeProfile>
</activeProfoxies/>
    <profiles>
        <profile>
            <id>glassfish-context</id>
            <properties>
                <local.glassfish.home>/usr/lib64/glassfish</local.glassfish.home>
                <local.glassfish.user>admin</local.glassfish.user>
                <local.glassfish.domain>domain1</local.glassfish.domain>
                <local.glassfish.httpPort>8080</local.glassfish.httpPort>
                <local.glassfish.adminPort>4848</local.glassfish.adminPort>
            </properties>
        </profile>
    </profiles>
    <activeProfiles>
        <activeProfile>glassfish-context</activeProfile>
    </activeProfiles>
</settings>

pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.zulik</groupId>
    <artifactId>maven</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>pom</packaging>
    <name>maven</name>
    <modules>
        <module>DziekanatBean</module>
    </modules>
    <pluginRepositories>
        <pluginRepository>

            <id>maven.java.net</id>
            <name>Java.net Maven2 Repository</name>
            <url>http://download.java.net/maven/2</url>
        </pluginRepository>
    </pluginRepositories>
    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.11</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <build>
        <finalName>Dziekanat</finalName>
        <plugins>
            <plugin>
                <groupId>org.glassfish.maven.plugin</groupId>
                <artifactId>maven-glassfish-plugin</artifactId>
                <version>2.1</version>
                <configuration>
                    <glassfishDirectory>${local.glassfish.home}</glassfishDirectory>
                    <echo>true</echo>
                    <debug>true</debug>
                    <autoCreate>true</autoCreate>
                    <glassfishDirectory>${local.glassfish.home}</glassfishDirectory>
                    <user>anonymous</user>
                    <adminPassword>password_here</adminPassword>

                    <domain>
                        <name>${local.glassfish.domain}</name>
                        <httpPort>${local.glassfish.httpPort}</httpPort>
                        <adminPort>${local.glassfish.adminPort}</adminPort>
                    </domain>
                    <components>
                        <component>
                            <name>${project.artifactId}</name>
                            <artifact>${project.build.directory}/${project.build.finalName}.jar</artifact>
                        </component>
                    </components>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

事先谢谢你的帮助。

共有1个答案

雍骏俊
2023-03-14

你有没有查过文件

/mnt/D/Studia/Semestr 4/java/projekt/maven/target/Dziekanat.jar

真的有吗?如果不是,请执行

mvn clean install 

在部署之前。

 类似资料:
  • 我刚刚使用Maven,我需要从一个Ant项目上传一些库。为了开发这个任务,我有一个文件夹,其中包含许多“pom.xml”文件,这些文件引用了我希望使用Maven在Eclipse中添加到我的项目中的jar,还有另一个xml文件,即Ant项目本身。 欢迎所有想法。谢谢

  • 我有一个maven项目,我正在Intellij IDEA中导入它。除了部署maven项目控制台时显示以下错误外,一切都很好 [ERROR]未能执行goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy(default-deploy)on project multisite:Deployment Failed:在distributio

  • 我有一个模块化maven项目。在最高层,我有: 我已经尝试了我能想到的一切: 重新执行项目, 清理所有eclipse相关文件, 清理本地maven存储库, 正在清理服务器tmp文件夹并重新添加项目, 更新并安装maven 到目前为止没有任何帮助。 我有一个令人震惊的发现:我添加了一个名为“amodule”的模块。你猜怎么着,它得到了所需的罐子而其他的没有。似乎只有按字母顺序排列的第一个模块获得ja

  • Netbeans IDE日志包含以下内容: 生成的EAR通常可以使用asadmin命令部署到Glassfish。只有当试图通过Netbeans部署它时,它才会失败。 似乎当禁用secure admin时,我可以通过NetBeans执行部署。我遇到了一些安全管理和SSL的问题。 > 我已经对其他EAR项目进行了实验(从netbeans生成了一个新的maven EAR),它将OK部署到GlassFis

  • 设置 我在 Mac OSX Mavericks 上使用 Netbeans 7.4,在我的专用服务器和 上使用 要在本地使用服务器,我设置和 ssh 隧道。以下方式: 这工作得很好,我可以通过本地主机访问服务器,没有任何问题。为了使用此服务器,我在 Netbeans 中添加了一台服务器,请参见 prinscreen: 问题 现在我想将项目部署到服务器(右键单击项目- 现在我检查了错误显示的行,它如下

  • 我有一个带有maven的java ee应用程序,当我构建项目然后部署在目标文件夹上生成的ear时,我试图注册到应用程序,所以我必须调用一个区域设置EJB会话(ConfigUser),我得到以下错误: 当我从netbeans部署时,它工作得很好,因为我知道项目的结构是在pom文件中的,如下所示: 这是jsp页面: