aspose file tools*
The moose likes Other Languages and the fly likes AspectJ-1.6.3rc1 getting java.lang.OutOfMemoryError: Java heap space Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Languages » Other Languages
Bookmark "AspectJ-1.6.3rc1 getting java.lang.OutOfMemoryError: Java heap space" Watch "AspectJ-1.6.3rc1 getting java.lang.OutOfMemoryError: Java heap space" New topic
Author

AspectJ-1.6.3rc1 getting java.lang.OutOfMemoryError: Java heap space

Raj Kundu
Greenhorn

Joined: Dec 19, 2008
Posts: 2
Hi,
I am using AspectJ 1.6.3rc1 for Aspect Oriented Programming. I have created an aspect as following:

package com.aspect;

import com.db.DBConnection;

public aspect MyAspect {
pointcut threadCreation(DBConnection conn) : call(* com.app..ResourceServiceImpl.uploadNormalContent*(..)) && (cflow(call(void com.db.DBConnection.close()))) && target(conn);
void around(DBConnection conn) : threadCreation(conn) {
System.out.println("Got Connection:" + conn);
proceed(conn);
}
}

I have my application code having approximately 1063 java files. I am using the following aspect command to compile my aspect program:

ajc -sourceroots C:\npg_ws_aspect\nated -outjar C:\npg_ws_aspect\npg.jar -1.6 -classpath "C:\npg_ws_aspect\nated\WEB-INF\lib\captcha.jar;C:\npg_ws_aspect\nated\WEB-INF\lib\commons-beanutils-1.7.0.jar;C:\npg_ws_aspect\nated\WEB-INF\lib\commons-codec-1.3.jar;C:\npg_ws_aspect\nated\WEB-INF\lib\commons-collections-3.1.jar;C:\npg_ws_aspect\nated\WEB-INF\lib\commons-digester-1.8.jar;C:\npg_ws_aspect\nated\WEB-INF\lib\commons-httpclient-3.0.jar;C:\npg_ws_aspect\nated\WEB-INF\lib\commons-logging-api-1.1.jar;C:\npg_ws_aspect\nated\WEB-INF\lib\contact-importer.jar;C:\npg_ws_aspect\nated\WEB-I NF\lib\cos.jar;C:\npg_ws_aspect\nated\WEB-INF\lib\dom4j-1.5.jar;C:\npg_ws_aspect\nated\WEB-INF\lib\ehcache-1.1.jar;C:\npg_ws_aspect\nated\WEB-INF\lib\imaging.jar;C:\npg_ws_aspect\nated\WEB-INF\lib\ip2location.jar;C:\npg_ws_aspect\nated\WEB-INF\lib\iText-2.1.2u.jar;C:\npg_ws_aspect\nated\WEB-INF\lib\jaxrpc.jar;C:\npg_ws_aspect\nated\WEB-INF\lib\jldap-4.3.jar;C:\npg_ws_aspect\nated\WEB-INF\lib\json.jar;C:\npg_ws_aspect\nated\WEB-INF\lib\jsonrpc.jar;C:\npg_ws_aspect\nated\WEB-INF\lib\jsse.jar;C:\np g_ws_aspect\nated\WEB-INF\lib\jstl.jar;C:\npg_ws_aspect\nated\WEB-INF\lib\ldapjdk.jar;C:\npg_ws_aspect\nated\WEB-INF\lib\libidn-1.0.jar;C:\npg_ws_aspect\nated\WEB-INF\lib\log4j-1.2.14.jar;C:\npg_ws_aspect\nated\WEB-INF\lib\lucene-core-2.3.0.jar;C:\npg_ws_aspect\nated\WEB-INF\lib\lucene-demos-2.3.0.jar;C:\npg_ws_aspect\nated\WEB-INF\lib\mail.jar;C:\npg_ws_aspect\nated\WEB-INF\lib\memcached_client.jar;C:\npg_ws_aspect\nated\WEB-INF\lib\not-yet-commons-ssl-0.3.7.jar;C:\npg_ws_aspect\nated\WEB-INF\l ib\PDFBox-0.7.0.jar;C:\npg_ws_aspect\nated\WEB-INF\lib\poi-3.0-rc4-20070503.jar;C:\npg_ws_aspect\nated\WEB-INF\lib\poi-contrib-3.0-rc4-20070503.jar;C:\npg_ws_aspect\nated\WEB-INF\lib\poi-scratchpad-3.0-rc4-20070503.jar;C:\npg_ws_aspect\nated\WEB-INF\lib\standard.jar;C:\npg_ws_aspect\nated\WEB-INF\lib\tiles-api-2.0.5.jar;C:\npg_ws_aspect\nated\WEB-INF\lib\tiles-core-2.0.5.jar;C:\npg_ws_aspect\nated\WEB-INF\lib\tiles-jsp-2.0.5.jar;C:\npg_ws_aspect\nated\WEB-INF\lib\tm-extractors-0.4.jar;C:\npg_ws_ aspect\nated\WEB-INF\lib\xcc.jar;C:\npg_ws_aspect\nated\WEB-INF\lib\xerces.jar;C:\npg_ws_aspect\nated\WEB-INF\lib\XPAAJ.jar;C:\npg_ws_aspect\nated\WEB-INF\lib\xparser.jar;C:\npg_ws_aspect\nated\WEB-INF\lib\zimbra-charset.jar;C:\npg_ws_aspect\nated\WEB-INF\lib\zimbracommon.jar;C:\npg_ws_aspect\nated\WEB-INF\lib\zimbraim.jar;C:\npg_ws_aspect\nated\WEB-INF\lib\zimbra-native.jar;C:\npg_ws_aspect\nated\WEB-INF\lib\zimbrastore.jar;C:\apache-tomcat-5.5.26\common\lib\commons-el.jar;C:\apache-tomcat-5.5. 26\common\lib\jasper-compiler.jar;C:\apache-tomcat-5.5.26\common\lib\jasper-compiler-jdt.jar;C:\apache-tomcat-5.5.26\common\lib\jasper-runtime.jar;C:\apache-tomcat-5.5.26\common\lib\jsp-api.jar;C:\apache-tomcat-5.5.26\common\lib\mysql-connector-java-5.0.5-bin.jar;C:\apache-tomcat-5.5.26\common\lib\naming-factory.jar;C:\apache-tomcat-5.5.26\common\lib\naming-factory-dbcp.jar;C:\apache-tomcat-5.5.26\common\lib\naming-resources.jar;C:\apache-tomcat-5.5.26\common\lib\servlet-api.jarC:\aspectj1.6\lib \aspectjrt.jar;C:\aspectj1.6\lib\aspectjtools.jar;C:\aspectj1.6\lib\aspectjweaver.jar;C:\aspectj1.6\lib\org.aspectj.matcher.jar;C:\apache-tomcat-5.5.26\common\lib\servlet-api.jar;C:\npg_ws_aspect\nated\WEB-INF\lib\ant.jar;C:\npg_ws_aspect\nated\WEB-INF\lib\ant-launcher.jar"

When I am executing this command I am getting the following exception:

C:\npg_ws_aspect\nated\src\com\nated\app\resource\dao\impl\ResourceDAOImpl.java
[error] Internal compiler error
java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Arrays.java:2786)
at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:94)
at java.io.PrintStream.write(PrintStream.java:430)
at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:202)
at sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:272)
at sun.nio.cs.StreamEncoder.flushBuffer(StreamEncoder.java:85)
at java.io.OutputStreamWriter.flushBuffer(OutputStreamWriter.java:168)
at java.io.PrintStream.write(PrintStream.java:477)
at java.io.PrintStream.print(PrintStream.java:619)
at org.aspectj.weaver.bcel.LazyMethodGen$BodyPrinter.pad(LazyMethodGen.j
ava:773)
at org.aspectj.weaver.bcel.LazyMethodGen$BodyPrinter.printLabel(LazyMeth
odGen.java:709)
at org.aspectj.weaver.bcel.LazyMethodGen$BodyPrinter.printInstruction(La
zyMethodGen.java:720)
at org.aspectj.weaver.bcel.LazyMethodGen$BodyPrinter.print(LazyMethodGen
.java:670)
at org.aspectj.weaver.bcel.LazyMethodGen$BodyPrinter.run(LazyMethodGen.j
ava:598)
at org.aspectj.weaver.bcel.LazyMethodGen.print(LazyMethodGen.java:559)
at org.aspectj.weaver.bcel.LazyClassGen.printOne(LazyClassGen.java:754)
at org.aspectj.weaver.bcel.LazyClassGen.print(LazyClassGen.java:716)
at org.aspectj.weaver.bcel.LazyClassGen.toLongString(LazyClassGen.java:7
04)
at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1762)
at org.aspectj.weaver.bcel.BcelWeaver.weaveWithoutDump(BcelWeaver.java:1
700)
at org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:146
6)
at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1273)
at org.aspectj.ajdt.internal.compiler.AjPipeliningCompilerAdapter.weaveQ
ueuedEntries(AjPipeliningCompilerAdapter.java:435)
at org.aspectj.ajdt.internal.compiler.AjPipeliningCompilerAdapter.queueF
orWeaving(AjPipeliningCompilerAdapter.java:371)
at org.aspectj.ajdt.internal.compiler.AjPipeliningCompilerAdapter.afterP
rocessing(AjPipeliningCompilerAdapter.java:358)
at org.aspectj.ajdt.internal.compiler.CompilerAdapter.ajc$after$org_aspe
ctj_ajdt_internal_compiler_CompilerAdapter$5$6b855184(CompilerAdapter.aj:98)
at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.process(Compil
er.java:652)
at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.compile(Compil
er.java:392)
at org.aspectj.ajdt.internal.core.builder.AjBuildManager.performCompilat
ion(AjBuildManager.java:975)
at org.aspectj.ajdt.internal.core.builder.AjBuildManager.performBuild(Aj
BuildManager.java:265)
at org.aspectj.ajdt.internal.core.builder.AjBuildManager.batchBuild(AjBu
ildManager.java:179)
at org.aspectj.ajdt.ajc.AjdtCommand.doCommand(AjdtCommand.java:112)

(no source information available)
ABORT

Exception thrown from AspectJ 1.6.3rc1

This might be logged as a bug already -- find current bugs at
http://bugs.eclipse.org/bugs/buglist.cgi?product=AspectJ&component=Compiler

Bugs for exceptions thrown have titles File:line from the top stack,
e.g., "SomeFile.java:243"

If you don't find the exception below in a bug, please add a new bug
at http://bugs.eclipse.org/bugs/enter_bug.cgi?product=AspectJ
To make the bug a priority, please include a test program
that can reproduce this exception.
Java heap space

when weaving classes
when weaving
when batch building BuildConfig[null] #Files=1063
Java heap space

Does anybody have any idea on how much memory is required for performing this activity? Is there anything I am doing wrong? I am stuck with this problem for 2 days and not able to understand what to do next. Any kind of hint or information will be very helpful for me.

Thanks in advance for your time.

Thanks & Regards,

Raj Kumar
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

Hi,

Welcome to JavaRanch!

Sorry if this seems to obvious, but: you don't say that you've tried giving the compiler more memory. Have you simply tried something like

javac -JXmx500m ...


[Jess in Action][AskingGoodQuestions]
 
Don't get me started about those stupid light bulbs.
 
subject: AspectJ-1.6.3rc1 getting java.lang.OutOfMemoryError: Java heap space