2

Hi I am using compile time AspectJ to weave classes However some classes are so big that at compile time it is not able to weave it.

so I have already tried adding argument in plugin: -Xmx2048m

pom.xml:

<plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>aspectj-maven-plugin</artifactId>
                <version>1.11</version>
                <dependencies>
                    <dependency>
                        <groupId>org.aspectj</groupId>
                        <artifactId>aspectjrt</artifactId>
                        <version>${aspectj.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>org.aspectj</groupId>
                        <artifactId>aspectjtools</artifactId>
                        <version>${aspectj.version}</version>
                    </dependency>
                </dependencies>
                <configuration>
                    <argLine>-Xmx2048m</argLine>
                    <complianceLevel>${maven.compiler.target}</complianceLevel>
                    <source>${maven.compiler.target}</source>
                    <target>${maven.compiler.target}</target>
                    <showWeaveInfo>true</showWeaveInfo>
                    <verbose>true</verbose>
                    <Xlint>ignore</Xlint>
                    <encoding>${project.build.sourceEncoding}</encoding>
                    <forceAjcCompile>true</forceAjcCompile>
                    <sources />
                    <weaveDirectories>
                        <weaveDirectory>${project.build.directory}/classes</weaveDirectory>
                    </weaveDirectories>
                </configuration>
                <executions>
                    <execution>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

error log:

Failed to execute goal org.codehaus.mojo:aspectj-maven-plugin:1.11:compile (default) on project lsmvAdverseEvent: AJC compiler errors:
[ERROR] error at SafetyMBean.java::0 The class com.x.y.z.MBean exceeds the maximum class size supported by the JVM (constant pool too big).
[ERROR] abort ABORT -- (RuntimeException) key not found in wovenClassFile
[ERROR] key not found in wovenClassFile
[ERROR] java.lang.RuntimeException: key not found in wovenClassFile
[ERROR] java.lang.RuntimeException: key not found in wovenClassFile
[ERROR]     at org.aspectj.weaver.WeaverStateInfo.findEndOfKey(WeaverStateInfo.java:408)
[ERROR]     at org.aspectj.weaver.WeaverStateInfo.replaceKeyWithDiff(WeaverStateInfo.java:364)
[ERROR]     at org.aspectj.weaver.bcel.LazyClassGen.getJavaClassBytesIncludingReweavable(LazyClassGen.java:711)

How to solve this issue Please Help?

0 Answers0