java.lang.VerifyError with java agent


(Wolfram Haußig) #1

Hello,

I am currently playing with Elastic Stack and APM. I have installed ElasticSearch 6.4.3 and APM-Server 6.5.0 without errors.
On a tomcat 8.0.x I added the following options:
-javaagent:/home/user/apm-server-6.5.0-linux-x86_64/elastic-apm-agent-1.0.0.jar
-Delastic.apm.service_name=DEV-TOMCAT
-Delastic.apm.application_packages=com.myPackage
-Delastic.apm.server_urls=http://127.0.0.1:8200"

Without those settings everything is fine but with them the following error occurs:
org.springframework.web.context.support.XmlWebApplicationContext- Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'authutil' defined in ServletContext resource [/WEB-INF/applicationContext-auth.xml]: Initialization of bean failed; nested exception is java.lang.VerifyError: (class: org/apache/commons/dbcp/DelegatingStatement, method: executeQuery signature: (Ljava/lang/String;)Ljava/sql/ResultSet;) Illegal type in constant pool

The application uses Spring 4(no spring boot) and apache commons dbcp 2.2.0.

Any hints what I am doing wrong? Can I not use dbcp when using apm?

Best regards
Wolfram


(Felix Barnsteiner) #2

Hi and thanks for trying out the Java agent!

I'm sorry you are having troubles with it. I have just tested pretty much all dbcp and dbcp2 versions but was not able to reproduce the problem.

That indicates that you are not using dbcp2 but dbcp because otherwise the class name would be org/apache/commons/dbcp2/DelegatingStatement (notice the dbcp2). But dbcp does not have a version 2.2.0. Could you recheck that again?

Which exact Java version and OS are you using?

Thanks,
Felix


(Felix Barnsteiner) #3

A link to the exact version you are using on search.maven.org would be helpful :slight_smile:


(Wolfram Haußig) #4

Hello felix,

Thanks for the fast response. We are using Tomcat 8.0.51 running under openJDK 11 on "Red Hat Enterprise Linux Server release 6.10" - might that be the problem? We are currently evaluating running openJDK because of the oracle license change...

And you are right, I looked into the wrong application - the legacy applications are using Spring 4 too but instead of dbcp2 they use https://search.maven.org/artifact/commons-dbcp/commons-dbcp/1.3/jar
Interestingly, the new application using https://search.maven.org/artifact/org.apache.commons/commons-dbcp2/2.2.0/jar is running fine.

Best regards
Wolfram


(Felix Barnsteiner) #5

Hm, yesterday, I have tried dbcp 1.3 with Open JDK 11. Could you send me the output of java -version so that I can see the exact build you are using?


(Wolfram Haußig) #6

Sure:
[tomcat@sapc3027 ~]$ java -version
openjdk version "11" 2018-09-25
OpenJDK Runtime Environment 18.9 (build 11+28)
OpenJDK 64-Bit Server VM 18.9 (build 11+28, mixed mode)


(Felix Barnsteiner) #7

Could you try out dbcp 1.4? This version is compiled against Java 1.6 whereas dbcp 1.3 has been compiled against Java 1.4 which Byte Buddy (the bytecode manipulation framework we are using) does not support.


(Wolfram Haußig) #8

Perfect! That was the problem.

Thank you very much!!


(system) #9

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.