ActiveJDBC + Eclipse + m2e + instrumentation = problems.

496 views
Skip to first unread message

Samuel Smith

unread,
Dec 31, 2013, 10:22:53 AM12/31/13
to activejd...@googlegroups.com
Okay, I'm new to ActiveJDBC, and I'm having trouble getting it to instrument my classes. I'm using Eclipse and m2e, and am trying to do the instrumentation process via the pom.xml. Everytime I run the project, I get an instrumentation error:

"failed to determine Model class name, are you sure models have been instrumented?"

Thing is, I'm not sure. I've tried the solutions out there on the web, and I'm still getting the error.

The relevant code in the pom.xml:

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

I have tried using this:

<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.javalite</groupId>
<artifactId> activejdbc-instrumentation </artifactId>
<version> 1.4.1
</version>
<goals>
<goal>instrument</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>

As I've seen posted around the web, but this didn't fix the problem and actually produced warnings during the build (missing dependency lifecycle-mapping).

Where do I go from here?
Thanks for your time,
Sam.

Igor Polevoy

unread,
Dec 31, 2013, 1:20:57 PM12/31/13
to activejd...@googlegroups.com

Samuel Smith

unread,
Jan 1, 2014, 1:07:56 PM1/1/14
to activejd...@googlegroups.com
Thanks Igor, but I don't seem to have found the solution in those pages, and I had read them all before posting.

Is there any other material on this situation?

For reference, here is my current entire build section of my POM:

<build>
<plugins>

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

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.1.2</version>
<executions>
<execution>
<id>attach-sources</id>
<phase>verify</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>

<plugin>
<artifactId>maven-eclipse-plugin</artifactId>
<configuration>
<downloadSources>true</downloadSources>
</configuration>
</plugin>

</plugins>

<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings 
only. It has no influence on the Maven build itself. -->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.javalite</groupId>
<artifactId>
activejdbc-instrumentation
</artifactId>
<versionRange>
[1.2-SNAPSHOT,)
</versionRange>
<goals>
<goal>instrument</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>

</build>

---------------------------

My Maven output when building using this POM:

[INFO] Scanning for projects...
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for start:dauntless:jar:0.0.1-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-eclipse-plugin is missing. @ line 183, column 12
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING] 
[WARNING] The POM for org.eclipse.m2e:lifecycle-mapping:jar:1.0.0 is missing, no dependency information available
[WARNING] Failed to retrieve plugin descriptor for org.eclipse.m2e:lifecycle-mapping:1.0.0: Plugin org.eclipse.m2e:lifecycle-mapping:1.0.0 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.eclipse.m2e:lifecycle-mapping:jar:1.0.0
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Dauntless 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for org.eclipse.m2e:lifecycle-mapping:jar:1.0.0 is missing, no dependency information available
[WARNING] Failed to retrieve plugin descriptor for org.eclipse.m2e:lifecycle-mapping:1.0.0: Plugin org.eclipse.m2e:lifecycle-mapping:1.0.0 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.eclipse.m2e:lifecycle-mapping:jar:1.0.0
[INFO] 
[INFO] >>> exec-maven-plugin:1.2.1:java (default-cli) @ dauntless >>>
[INFO] 
[INFO] <<< exec-maven-plugin:1.2.1:java (default-cli) @ dauntless <<<
[INFO] 
[INFO] --- exec-maven-plugin:1.2.1:java (default-cli) @ dauntless ---


-----------------------


And, finally, my stacktrace when I hit the instrumentation error:


org.javalite.activejdbc.DBException: failed to determine Model class name, are you sure models have been instrumented?
at org.javalite.activejdbc.Model$ClassGetter.getClassName(Model.java:2214)
at org.javalite.activejdbc.Model.getClassName(Model.java:2187)
at org.javalite.activejdbc.Model.getDaClass(Model.java:2179)
at org.javalite.activejdbc.Model.getMetaModel(Model.java:58)
at org.javalite.activejdbc.Model.findAll(Model.java:1765)
at com.dauntless.models.services.LinkService.selectAll(LinkService.java:15)
at com.dauntless.controllers.LinksController.linksGET(LinksController.java:27)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:213)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:126)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:96)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:617)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:578)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:735)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:643)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1331)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:150)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter.doFilter(DefaultLoginPageGeneratingFilter.java:91)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:183)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1302)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:448)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:131)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:524)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1067)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:377)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:192)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1001)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:129)
at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:47)
at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:149)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111)
at org.eclipse.jetty.server.Server.handle(Server.java:360)
at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:454)
at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:890)
at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:944)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:630)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:230)
at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:77)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:622)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:46)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:603)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:538)
at java.lang.Thread.run(Thread.java:744)
Caused by: org.javalite.activejdbc.InitException: failed to determine Model class name, are you sure models have been instrumented?
... 78 more

Igor Polevoy

unread,
Jan 1, 2014, 11:37:58 PM1/1/14
to activejd...@googlegroups.com
Samuel, I ran the  sample project in Eclipse, and documented steps to run instrumentation in Eclipse project  on this page: 
I hope this helps. It appears using Eclipse and instrumentation is quite easy 

thanks,
igor

Igor Polevoy

unread,
Jan 1, 2014, 11:39:36 PM1/1/14
to activejd...@googlegroups.com
Also, looking at your stack trace, I see  that you are using SpringMVC. If this is a new project you might want to look at ActiveWeb: 

tx

Augustin

unread,
Jan 7, 2014, 10:34:43 AM1/7/14
to activejd...@googlegroups.com
IntelliJ IDEA has a free version now and works better with ActiveJDBC.  Its maven and git integration are a lot better.  The problem with eclipse is that it ignores the build instructions in your maven file (there are workarounds), but IntelliJ doesn't have this problem.  I've been a long time Eclipse user and I'm thinking of switching over now.

Igor Polevoy

unread,
Jan 7, 2014, 12:16:32 PM1/7/14
to activejd...@googlegroups.com
Augustin, I agree with you on the preference for IntelliJ. I have been using it for the past 10 years or so, and now I have a free open source license from them for ActiveJDBC. However, we cannot request that everyone who wants to use ActiveJDBC must use IntelliJ :)

The instructions I provided work pretty well with Eclipse. I will be putting similar pages for Netbeans and IntelliJ. 

thanks

Samuel Smith

unread,
Jan 9, 2014, 12:13:57 PM1/9/14
to activejd...@googlegroups.com
Sorry about the delayed response, I was on vacation.

Just stepping through that guide you posted me, I'm not getting the expected output from running instrumentation.sh, here's my output:

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Dauntless
[INFO]    task-segment: [process-classes]
[INFO] ------------------------------------------------------------------------
[INFO] [resources:resources {execution: default-resources}]
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 3 resources
[INFO] [compiler:compile {execution: default-compile}]
[INFO] Nothing to compile - all classes are up to date
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4 seconds
[INFO] Finished at: Thu Jan 09 17:08:07 GMT 2014
[INFO] Final Memory: 22M/178M
[INFO] ------------------------------------------------------------------------

No mention of instrumentation in the output.

I hope this can point to what my issue may be. :)

Thanks,
Sam.

Igor Polevoy

unread,
Jan 9, 2014, 4:03:28 PM1/9/14
to activejd...@googlegroups.com
Sam, is this related to Eclipse? Also, what is the content of your pom? Did you get a simple project working... etc. - more questions than answers; :)
you need to provide more info 
tx

Samuel Smith

unread,
Jan 10, 2014, 7:21:08 AM1/10/14
to activejd...@googlegroups.com
No, this isn't related to Eclipse, this is following the "Eclipse Integration Guide" that you shared above. However, this is at a stage before we put the script into the build process.

Where I execute the script and the expected output should be along the lines of:

**************************** START INSTRUMENTATION ****************************
Directory: /home/igor/tmp/simple-example/target/classes
Found model: activejdbc.examples.simple.Employee
Instrumented class: activejdbc.examples.simple.Employee in directory: /home/igor/tmp/simple-example/target/classes/
**************************** END INSTRUMENTATION ****************************

Instead my output is:

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Dauntless
[INFO]    task-segment: [process-classes]
[INFO] ------------------------------------------------------------------------
[INFO] [resources:resources {execution: default-resources}]
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 3 resources
[INFO] [compiler:compile {execution: default-compile}]
[INFO] Nothing to compile - all classes are up to date
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4 seconds
[INFO] Finished at: Thu Jan 09 17:08:07 GMT 2014
[INFO] Final Memory: 22M/178M
[INFO] ------------------------------------------------------------------------

I've attached the entire POM used for the project, rather than pasting it in.
pom.xml

Samuel Smith

unread,
Jan 10, 2014, 7:22:07 AM1/10/14
to activejd...@googlegroups.com
Sorry about being a time sink, your help is very much being appreciated.

Igor Polevoy

unread,
Jan 10, 2014, 3:45:53 PM1/10/14
to activejd...@googlegroups.com
Sam, no worries. WHat happens if you execute: 
mvn process-classes
?
thanks

Igor Polevoy

unread,
Jan 10, 2014, 3:59:29 PM1/10/14
to activejd...@googlegroups.com
wait, the issue is simple, you do not have the instrumentation plugin in <plugins>! You only have it configured in pluginManagement!

Samuel Smith

unread,
Jan 12, 2014, 5:02:46 PM1/12/14
to activejd...@googlegroups.com
Ah, yes, I had removed it from <plugins> a little while back, as m2e kicked off about lifecycle mappings with the execution tag.

However, after readding the information to to the plugins section, and doing some jiggery-pokery to get m2e to ignore it, I can now get it to instrument using the custom builder, as per the guide.

Thank you very much for your time!
Reply all
Reply to author
Forward
0 new messages