JHipster Eclipse项目的“主"内存不足. [英] JHipster Eclipse project running out of memory in "main"

查看:54
本文介绍了JHipster Eclipse项目的“主"内存不足.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在建立一个基线JHipster项目,该项目不涉及任何麻烦(不包含集群等). 我将使用标准的启用节点的命令行(当然)按照确切的教程步骤进行操作,然后将项目作为Maven项目导入到Eclipse中.根据我对项目的审查,一切看起来应该都可以正常工作,除非我尝试在服务器上运行它或使用mvn命令行来构建它...

I am building up a baseline JHipster project with no bells and whistles involved (no clustering, etc.). I am following the exact tutorial steps using my standard Node-enabled (of course) command line, and am then importing the project into Eclipse as a Maven Project. Everything looks like it should be working fine based on reviewing the project, except when I try to run it on the server or build it using the mvn command line...

INFO: Starting Servlet Engine: Apache Tomcat/7.0.12
Exception in thread "main" 
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "main"

POM/Maven

据我所知,这可能是POM依赖项错误,但是如果是这样的话,那么我将花费大量的时间弄清楚是哪个.我的项目直接配置为使用JRE 1.7.我的POM在下面.另一个想法是,它与从Hipster(在POM之后)安装的原始NPM直接相关:

POM/Maven

From what I can tell, this may be a POM dependency error, but if so then I am having a heck of a time figuring out which. My project is directly configured to use JRE 1.7. My POM is below. Another thought is that it is directly related to the original NPM install from Hipster (after POM):

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.0.0.RC4</version>
</parent>

<profiles>
    <profile>
        <id>dev</id>
        <activation>
            <activeByDefault>true</activeByDefault>
        </activation>
        <properties>
            <!-- Spring profile to use -->
            <spring.profiles.active>dev</spring.profiles.active>
            <!-- log configuration -->
            <logback.loglevel>DEBUG</logback.loglevel>
        </properties>
    </profile>
    <profile>
        <id>prod</id>
        <properties>
            <!-- Spring profile to use -->
            <spring.profiles.active>prod</spring.profiles.active>
            <!-- log configuration -->
            <logback.loglevel>INFO</logback.loglevel>
            <logback.appender>CONSOLE</logback.appender>
        </properties>
        <build>
            <plugins>
                <plugin>
                    <groupId>com.github.trecloux</groupId>
                    <artifactId>yeoman-maven-plugin</artifactId>
                    <version>0.1</version>
                    <configuration>
                        <yeomanProjectDirectory>${project.basedir}</yeomanProjectDirectory>
                    </configuration>
                    <executions>
                        <execution>
                            <id>run-grunt</id>
                            <phase>generate-resources</phase>
                            <goals>
                                <goal>build</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <artifactId>maven-clean-plugin</artifactId>
                    <version>2.5</version>
                    <configuration>
                        <filesets>
                            <fileset>
                                <directory>dist</directory>
                            </fileset>
                            <fileset>
                                <directory>.tmp</directory>
                            </fileset>
                            <fileset>
                                <directory>node_modules</directory>
                            </fileset>
                        </filesets>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                    <configuration>
                        <arguments>
                            <argument>--spring.profiles.active=prod</argument>
                        </arguments>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    </profile>
</profiles>

<properties>
    <!-- Maven build properties -->
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <java.version>1.7</java.version>

    <metrics-spring.version>3.0.0-RC4</metrics-spring.version>
    <HikariCP.version>1.3.3</HikariCP.version>
    <commons-lang.version>2.6</commons-lang.version>
    <commons-io.version>2.4</commons-io.version>
    <javax.inject.version>1</javax.inject.version>
    <joda-time-hibernate.version>1.3</joda-time-hibernate.version>
    <geronimo-javamail_1.4_mail.version>1.8.3</geronimo-javamail_1.4_mail.version>
    <usertype.core.version>3.1.0.CR10</usertype.core.version>
    <springloaded.version>1.2.0.BUILD-20140214.165636-1</springloaded.version>
    <awaitility.version>1.4.0</awaitility.version>
    <json-path.version>0.9.1</json-path.version>
    <assertj-core.version>1.5.0</assertj-core.version>
    <maven-enforcer-plugin.version>1.3.1</maven-enforcer-plugin.version>
    <sonar-maven-plugin.version>2.2</sonar-maven-plugin.version>

    <postgresql.version>9.3-1100-jdbc41</postgresql.version>
</properties>

<repositories>
    <repository>
        <id>spring-milestones</id>
        <name>Spring Milestones</name>
        <url>http://repo.spring.io/milestone</url>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
    </repository>
    <repository>
        <id>spring-snapshots</id>
        <name>Spring Snapshots</name>
        <url>http://repo.spring.io/snapshot</url>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>
    <repository>
        <id>org.jboss.repository.releases</id>
        <name>JBoss Maven Release Repository</name>
        <url>https://repository.jboss.org/nexus/content/repositories/releases</url>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
    </repository>
</repositories>
<pluginRepositories>
    <pluginRepository>
        <id>spring-snapshots</id>
        <url>http://repo.spring.io/libs-snapshot</url>
        <snapshots><enabled>true</enabled></snapshots>
    </pluginRepository>
    <pluginRepository>
        <id>spring-milestones</id>
        <url>http://repo.spring.io/milestone</url>
        <snapshots><enabled>true</enabled></snapshots>
    </pluginRepository>
</pluginRepositories>

<prerequisites>
    <maven>3.0.0</maven>
</prerequisites>

<dependencies>
    <dependency>
        <groupId>com.codahale.metrics</groupId>
        <artifactId>metrics-core</artifactId>
    </dependency>
    <dependency>
        <groupId>com.codahale.metrics</groupId>
        <artifactId>metrics-ehcache</artifactId>
        <version>${codahale-metrics.version}</version>
    </dependency>
    <dependency>
        <groupId>com.codahale.metrics</groupId>
        <artifactId>metrics-graphite</artifactId>
    </dependency>
    <dependency>
        <groupId>com.codahale.metrics</groupId>
        <artifactId>metrics-jvm</artifactId>
        <version>${codahale-metrics.version}</version>
    </dependency>
    <dependency>
        <groupId>com.codahale.metrics</groupId>
        <artifactId>metrics-servlet</artifactId>
        <version>${codahale-metrics.version}</version>
    </dependency>
    <dependency>
        <groupId>com.codahale.metrics</groupId>
        <artifactId>metrics-servlets</artifactId>
        <exclusions>
            <exclusion>
                <groupId>com.codahale.metrics</groupId>
                <artifactId>metrics-healthchecks</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.datatype</groupId>
        <artifactId>jackson-datatype-json-org</artifactId>
        <version>${jackson.version}</version>
    </dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.datatype</groupId>
        <artifactId>jackson-datatype-hppc</artifactId>
        <version>${jackson.version}</version>
    </dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.datatype</groupId>
        <artifactId>jackson-datatype-joda</artifactId>
    </dependency>
    <dependency>
        <groupId>com.ryantenney.metrics</groupId>
        <artifactId>metrics-spring</artifactId>
        <version>${metrics-spring.version}</version>
    </dependency>
    <dependency>
        <groupId>com.zaxxer</groupId>
        <artifactId>HikariCP</artifactId>
        <version>${HikariCP.version}</version>
        <exclusions>
            <exclusion>
                <groupId>com.sun</groupId>
                <artifactId>tools</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <!-- The HikariCP Java Agent is disabled by default, as it is experimental
    <dependency>
        <groupId>com.zaxxer</groupId>
        <artifactId>HikariCP-agent</artifactId>
        <version>1.3.0</version>
    </dependency>
    -->
    <dependency>
        <groupId>commons-lang</groupId>
        <artifactId>commons-lang</artifactId>
        <version>${commons-lang.version}</version>
    </dependency>
    <dependency>
        <groupId>commons-io</groupId>
        <artifactId>commons-io</artifactId>
        <version>${commons-io.version}</version>
    </dependency>
    <dependency>
        <groupId>javax.inject</groupId>
        <artifactId>javax.inject</artifactId>
        <version>${javax.inject.version}</version>
    </dependency>
    <dependency>
        <groupId>joda-time</groupId>
        <artifactId>joda-time</artifactId>
    </dependency>
    <dependency>
        <groupId>joda-time</groupId>
        <artifactId>joda-time-hibernate</artifactId>
        <version>${joda-time-hibernate.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.geronimo.javamail</groupId>
        <artifactId>geronimo-javamail_1.4_mail</artifactId>
        <version>${geronimo-javamail_1.4_mail.version}</version>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core</artifactId>
        <version>${hibernate-entitymanager.version}</version>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-entitymanager</artifactId>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-ehcache</artifactId>
        <version>${hibernate-entitymanager.version}</version>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-validator</artifactId>
    </dependency>
    <dependency>
        <groupId>org.jadira.usertype</groupId>
        <artifactId>usertype.core</artifactId>
        <version>${usertype.core.version}</version>
    </dependency>
    <dependency>
        <groupId>org.liquibase</groupId>
        <artifactId>liquibase-core</artifactId>
    </dependency>
    <dependency>
        <groupId>org.liquibase.ext</groupId>
        <artifactId>liquibase-hibernate4</artifactId>
        <version>3.3</version>
        <exclusions>
            <exclusion>
                <groupId>org.hibernate.javax.persistence</groupId>
                <artifactId>hibernate-jpa-2.0-api</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-actuator</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-autoconfigure</artifactId>
        <version>${spring-boot.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-loader-tools</artifactId>
        <version>${spring-boot.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-logging</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-aop</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-security</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-tomcat</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-thymeleaf</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context-support</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springsource.loaded</groupId>
        <artifactId>springloaded</artifactId>
        <version>${springloaded.version}</version>
        <scope>provided</scope>
    </dependency>       

    <!-- Database dependencies-->
    <dependency>
        <groupId>org.postgresql</groupId>
        <artifactId>postgresql</artifactId>
        <version>9.3-1100-jdbc41</version>
    </dependency>


    <!-- Test dependencies -->
    <dependency>
        <groupId>com.jayway.awaitility</groupId>
        <artifactId>awaitility</artifactId>
        <version>${awaitility.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>com.jayway.jsonpath</groupId>
        <artifactId>json-path</artifactId>
        <version>${json-path.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>com.h2database</groupId>
        <artifactId>h2</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.assertj</groupId>
        <artifactId>assertj-core</artifactId>
        <version>${assertj-core.version}</version>
        <scope>test</scope>
    </dependency>
</dependencies>
<build>
    <resources>
        <resource>
            <directory>src/main/resources</directory>
            <filtering>true</filtering>
            <includes>
                <include>**/*</include>
            </includes>
        </resource>
    </resources>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-enforcer-plugin</artifactId>
            <version>${maven-enforcer-plugin.version}</version>
            <executions>
                <execution>
                    <id>enforce-versions</id>
                    <goals>
                        <goal>enforce</goal>
                    </goals>
                    <configuration>
                        <rules>
                            <requireMavenVersion>
                                <message>You are running an older version of Maven. JHipster requires at least Maven 3.0</message>
                                <version>[3.0.0,)</version>
                            </requireMavenVersion>
                            <requireJavaVersion>
                                <message>You are running an older version of Java. JHipster requires at least JDK 1.7</message>
                                <version>[1.7.0,)</version>
                            </requireJavaVersion>
                        </rules>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
                <argLine>-XX:MaxPermSize=128m -Xmx256m</argLine>
                <forkCount>1</forkCount>
                <reuseForks>false</reuseForks>
                <!-- Force alphabetical order to have a reproducible build -->
                <runOrder>alphabetical</runOrder>
                <classpathDependencyExcludes>
                    <classpathDependencyExclude>org.springsource.loaded:springloaded</classpathDependencyExclude>
                </classpathDependencyExcludes>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <configuration>
                <packagingExcludes>WEB-INF/lib/tomcat-*.jar</packagingExcludes>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-eclipse-plugin</artifactId>
            <configuration>
                <downloadSources>true</downloadSources>
                <downloadJavadocs>true</downloadJavadocs>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>sonar-maven-plugin</artifactId>
            <version>${sonar-maven-plugin.version}</version>
        </plugin>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <configuration>
                <arguments>
                    <argument>--spring.profiles.active=dev</argument>
                </arguments>
            </configuration>
        </plugin>
    </plugins>
</build>

看看最初的JHipster生成时NPM的响应,我实际上也看到了这些日志中的错误,如下所述.有人对此有背景吗?

Looking at what is being responded by NPM at initial JHipster generation, I am actually seeing errors in those logs as well, noted below. Does anyone have any background on this?

2400 verbose etag pad-stdio from cache
2401 error Error: No compatible version found: findup-sync@'^0.1.2'
2401 error Valid install targets:
2401 error ["0.1.0","0.1.1","0.1.2","0.1.3"]
2401 error     at installTargetsError (C:\ProgramFiles\nodejs\node_modules\npm\lib\cache.js:719:10)
2401 error     at C:\Program Files\nodejs\node_modules\npm\lib\cache.js:638:10
2401 error     at saved (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-registry-client\lib\get.js:142:7)

即使出现此错误,我也可以通过直接npm install findup-sync@0.1.2手动包含findup-sync,但这不能解决Tomcat实例的错误.

Even with this error, I was able to manually include findup-sync with a direct npm install findup-sync@0.1.2, but this did not resolve my error with the Tomcat instance.

它必须与com.sun:tools.jar专门相关.通过我的POM进行检查,但是如果有人在使用JHipster之前经历过此事,请大声疾呼. 谢谢您的帮助!

It must be something else specifically to do with com.sun:tools.jar... Looking through my POM, but if anyone has experienced this before with JHipster, please give me a shout. Thank you for the help!

推荐答案

这里有3个问题:

  1. 我的Eclipse配置指向的是JRE而不是JDK (其中包含正确的com.sun:tools jar).但是,为了进行正确的更新,它并不像更新我的JAVA_HOME变量并继续进行那样简单...请参阅下面的步骤1-5.
  1. My Eclipse configuration was pointing to a JRE rather than a JDK (which contained the right com.sun:tools jar). In order to make the correct updates, however, it wasn't as simple as updating my JAVA_HOME variable and moving on... See steps 1-5 below.
    • The StackOverflow article describing this is noted here: Maven 3 Artifact problem

解决方案摘要

  1. 将%JAVA_HOME%更改为JDK
  2. 用以下几行更新eclipse.ini:
    • -vm
    • C:\ Program Files \ Java \ jdk1.7.0_25 \ bin \
  1. Change %JAVA_HOME% to JDK
  2. Update eclipse.ini with the following lines:
    • -vm
    • C:\Program Files\Java\jdk1.7.0_25\bin\

< skip> true< /skip> ...减去多余的空格

< skip>true< /skip> ...minus the extra spaces

首先在Eclipse中运行而不是在Maven中运行的问题-错误日志记录极具误导性!

这篇关于JHipster Eclipse项目的“主"内存不足.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆