Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

deployed JSP throws java.lang.NoClassDefFoundError

 

Hi I am trying to demo clover test optimization in my company do decrease the test execution time. I have a simple JSP Page that refers one of the class file. Project builds fine and get deployed. When I use clover code coverage then only the deployed JSP doesnt work. when i deploy with clover using

 mvn clean clover2:setup verify clover2:clover.

if I open the JSP deployed using :- http://localhost:8080/demo/Math2.jsp it throws error as below :-

java.lang.NoClassDefFoundError: Could not initialize class com.ariba.demo.App
	org.apache.jsp.Math2_jsp._jspService(Math2_jsp.java:64)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:723)

I do see instrumented classes refer this image . In Atlasian answers somebody informed to downgrade to tomcat 6. I did. Still i see the same issue. I need to demo this tomorrow to our team. Here is the project source code  . Please help me to get rid of this.

Thanks

Shankar

1 answer

1 accepted

1 vote
Answer accepted

Hi Shankar,

1) You have an unnecessary dependency to maven-clover2-plugin:

<dependencies>
  ...
  <dependency>
    <groupId>com.atlassian.maven.plugins</groupId>
    <artifactId>maven-clover2-plugin</artifactId>
    <version>4.0.1</version>
  </dependency>
</dependencies>

instead of this, you shall declare a dependency to Clover Core:

<dependencies>
  ...
  <dependency>
    <groupId>com.atlassian.clover</groupId>
    <artifactId>clover</artifactId>
    <version>4.0.1</version>
  </dependency>
</dependencies>

 

2) By the way: the maven-clover2-plugin's version number is missing:

<build>
  <plugins>
    <plugin>
      <groupId>com.atlassian.maven.plugins</groupId>
      <artifactId>maven-clover2-plugin</artifactId>
      <version>4.0.1</version> <!-- add this -->
     ...

 

3) It's also good to define a <jdk> property for maven-clover2-plugin and/or to define <source> property for maven-compiler-plugin. Otherwise your demo project will not compile under JDK8 (a reason is that Clover sees Java 8 and assumes "1.8" source level for instrumentation; at the same time maven-compiler-plugin assumes "1.3" source level).

 

Nevertheless, compilation of your demo project fails (mvn clean verify):

...\ITSeleniumIDETests.java:[48,35] error: no suitable constructor found for ProcessBuilder(String,String)
could not parse error message:     constructor ProcessBuilder.ProcessBuilder(List) is not applicable
      (actual and formal argument lists differ in length)
    constructor ProcessBuilder.ProcessBuilder(String...) is not applicable
      (actual and formal argument lists differ in length)
...\ITTest.java:37: error: method executeScript in interface JavascriptExecutor cannot be applied to given types;
        return js.executeScript(script);
                 ^

 

4) Furthermore, the cargo-maven2-plugin does not have a dependency on com.atlassian.clover:clover artifact. Due to this, the clover.jar is not available on Tomcat's class path and the most probably this is a source of the error you have. Please try adding something like this:

 

&lt;plugin&gt;
  &lt;groupId&gt;org.codehaus.cargo&lt;/groupId&gt;
  &lt;artifactId&gt;cargo-maven2-plugin&lt;/artifactId&gt;
  &lt;version&gt;1.2.0&lt;/version&gt;
  &lt;configuration&gt;
    &lt;container&gt;
      &lt;dependencies&gt;
        &lt;!-- We need clover.jar to be present in container classpath --&gt;
        &lt;dependency&gt;
          &lt;groupId&gt;com.cenqua.clover&lt;/groupId&gt;
          &lt;artifactId&gt;clover&lt;/artifactId&gt;
        &lt;/dependency&gt;
      &lt;/dependencies&gt;
    &lt;/container&gt;
  ...
  &lt;/configuration&gt;
&lt;/plugin&gt;

 

See also this KB article:

https://confluence.atlassian.com/pages/viewpage.action?pageId=317196439

 

Cheers
Marek

Wow Marek,

Thank you Thank you Thank you. Your answer was the exact solution. I made the changes you suggested. It worked like a charm. 

Thank you once again.

You're welcome! :-)

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Marketplace Apps & Integrations

Happy New Year and Welcome New Marketplace Partner Program Partners!

Happy New Year! We hope you all had a safe and restful holiday season. 2020 was a unique year full of unforeseen events; however, as we enter the new year of 2021, we’re optimistic for the light at t...

495 views 7 18
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you