Instrumentation failes with collect call

22 views
Skip to first unread message

_k-

unread,
Dec 6, 2014, 4:18:00 PM12/6/14
to activejd...@googlegroups.com
Hello,

I have a trouble with (I guess) ActiveJDBC's instrumentation.

I have a class that has a one-to-many relationship with table "phone_numbers". Now, I wanted to include a helper method that returns phone numbers not as a collection of classes, but as a collection of strings. This works:

        List<String> phoneNumbers = new ArrayList<String>();

        for(PhoneNumber number : getPhoneNumbers()) {
            phoneNumbers.add(number.getPhoneNumber());
        }

        return phoneNumbers;

This causes an instrumenation error: "Caused by: org.javalite.activejdbc.InitException: failed to determine Model class name, are you sure models have been instrumented?"

        List<String> phoneNumbers = getPhoneNumbers().stream().map(PhoneNumber::getPhoneNumber).collect(Collectors.toList());
        return phoneNumbers;


Is this a bug or am I missing something?

Igor Polevoy

unread,
Dec 6, 2014, 5:25:38 PM12/6/14
to activejd...@googlegroups.com
I'm assuming you are using dynamic instrumentation. If this is the case, there is currently incompatibility with Java 8 lambdas. 

You will have to switch to static instrumentation - that is run instrumentation as part of your build. 

Thanks

_k-

unread,
Dec 7, 2014, 6:25:05 PM12/7/14
to activejd...@googlegroups.com
Thank you for responding so fast. :)


Unfortunately, I am not. I believe I am using static instrumentation with 1.4.9 version.

Just to be sure:

I have this plugin in my pom.xml:

<plugin>
    <groupId>org.javalite</groupId>
    <artifactId>activejdbc-instrumentation</artifactId>
    <version>1.4.9</version>
    <executions>
        <execution>
            <phase>process-classes</phase>
            <goals>
                <goal>instrument</goal>
            </goals>
        </execution>
    </executions>
</plugin>

Additionally I have the goal run after compilation for JUnit and Application (I'm using Intellij IDEA).

k

Igor Polevoy

unread,
Dec 7, 2014, 6:31:34 PM12/7/14
to activejd...@googlegroups.com
this is strange.
Please see this example: 

This is a simple example with ActiveJDBC (no Maven or Ant for simplicity)
This specific branch is to illustrate this exact issue: https://github.com/javalite/standalone-example/tree/dynamic_instrumentation

Please, take a look at README, clone this app (only this branch!) and experiment with code. 
If you start getting the same exception and static instrumentation, then we can consider opening a defect. 

Also, please switch to 1.4.10-SNAPSHOT, as 1.4.9 release is about a year old (new release is coming soon)

Thanks

_k-

unread,
Dec 8, 2014, 1:35:33 PM12/8/14
to activejd...@googlegroups.com
There is no defect, upgrading to 1.4.10-SNAPSHOT did the trick. Once again. :)

Thank you.

Igor Polevoy

unread,
Dec 9, 2014, 12:07:33 AM12/9/14
to activejd...@googlegroups.com
glad it works for  you
Reply all
Reply to author
Forward
0 new messages