Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Stackmap frame errors when building the aspectj project with Java 1.7

Sorry for the confusing title. It should be corrected as "Stackmap frame errors when building an aspectj project with Java 1.7"

On Tue, Oct 14, 2014 at 11:31 AM, Heshan Suriyaarachchi <heshan.suriyaarachchi@xxxxxxxxx> wrote:
Hi,

I have a project which is using aspectj and it is building fine with Java 1.6. When I update it to Java 1.7 I'm seeing following error.

[INFO] Molva the Destroyer Aspects ....................... FAILURE [2.324s]
[INFO] Molva The Destroyer Client ........................ SKIPPED
[INFO] Molva The Destroyer Parent ........................ SKIPPED
[INFO] Molva The Destroyer Distribution .................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.424s
[INFO] Finished at: Tue Oct 14 11:16:19 PDT 2014
[INFO] Final Memory: 12M/310M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.1:java (default) on project molva-the-destroyer-aspects: An exception occured while executing the Java class. Expecting a stackmap frame at branch target 30
[ERROR] Exception Details:
[ERROR] Location:
[ERROR] com/concur/puma/molva/aspects/TestTarget.main([Ljava/lang/String;)V @12: invokestatic
[ERROR] Reason:
[ERROR] Expected stackmap frame at this location.
[ERROR] Bytecode:
[ERROR] 0000000: 2a4d b200 5e01 012c b800 644e b800 c62d
[ERROR] 0000010: b600 ca2c 2db8 00bb 2db8 00bf 57b1 3a04
[ERROR] 0000020: b800 c62d 1904 b600 ce19 04bf
[ERROR] Exception Handler Table:
[ERROR] bci [12, 30] => handler: 30
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[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/MojoExecutionException



This is what my maven configuration looks like.
    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjrt</artifactId>
            <version>1.6.5</version>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>
        </dependency>
        <dependency>
            <groupId>org.perf4j</groupId>
            <artifactId>perf4j</artifactId>
            <version>0.9.16</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>aspectj-maven-plugin</artifactId>
                <version>1.2</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.1</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>java</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <mainClass>com.concur.puma.molva.aspects.TestTarget</mainClass>
                </configuration>
            </plugin>
        </plugins>
    </build>

The TestTarget class is a simple class (Pasting it here for completeness.)
public class TestTarget {

    static Logger logger = Logger.getLogger(TestTarget.class);

    public static void main(String[] args) throws Exception {
        // Test case 01
        new TestTarget().test1();

        // Test case 02
        for(int i=0;i<10;i++) {
            testCountFast(1000);
        }

        // Test case 03
        for(int i=0;i<5;i++) {
            testCountSlow(1000);
        }

        // Test case 04
//        new TestTarget().test2();
    }

    public static void testCountSlow(int value) {
        count(value,5);
        System.out.println("slow count executed!");
//        logger.info("Slow count complete!");
    }

    public static void testCountFast(int value) {
        count(value,0);
        System.out.println("fast count executed!");
//        logger.info("Fast count complete!");
    }

    private static void count(int value, int delay) {
        for (int i=0;i<value;i++) {
            try {
                Thread.sleep(delay);
            } catch (Exception e) {
                logger.error("Error occurred while sleeping the thread count", e);
            }
        }
    }

    public void test1() {
//        logger.info("TestTarget.test()");
    }

    public void test2() throws Exception {
        throw new Exception("Test exception");
//        logger.info(1/0);
    }
}

I have read some articles on the web and some are suggesting to use -XX:-UseSplitVerifier option but I'm not sure how to include that into this plugin configuration (I did not find any arg option which allows me to put that parameter in).

Any help/pointers in the right direction to resolve this issue is much appreciated as I want to build this project with Java 1.7.
 



--
Regards,
Heshan Suriyaarachchi

http://heshans.blogspot.com/
http://www.linkedin.com/in/heshan

Back to the top