Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8257011
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T02:03:47+00:00 2026-06-08T02:03:47+00:00

Recently I’ve been assigned to examine Java code coverage using Sonar with Maven. I

  • 0

Recently I’ve been assigned to examine Java code coverage using Sonar with Maven. I run mvn sonar:sonar and the build comes out just fine, plus I can see the result from the dashboard.

However, the test cases come out as errors, which does not happen at all if I run it normally. Here is the error stack trace:

$Proxy11 cannot be cast to com.epsilon.agility.message.dao.MessageDAO
java.lang.ClassCastException: $Proxy11 cannot be cast to                    com.epsilon.agility.message.dao.MessageDAO
at  com.epsilon.agility.message.utils.MessageDBAdaptorService.getMessageDAO(MessageDBAdaptorSer vice.java:32)
at com.epsilon.agility.message.facade.MessageClassificationFacadeImpl.initilaizeDAOs(MessageClassificationFacadeImpl.java:91)
at com.epsilon.agility.message.facade.MessageClassificationFacadeImpl.<init>(MessageClassificationFacadeImpl.java:86)
at com.epsilon.agility.message.dao.test.TestMessageClassificationFacadeImpl.setUp(TestMessageClassificationFacadeImpl.java:85)
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:601)
at org.junit.internal.runners.ClassRoadie.runBefores(ClassRoadie.java:49)
at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:36)
at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
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:601)
at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)

Here is the method involved in the error:

@BeforeClass
@Transactional(propagation = Propagation.REQUIRED, timeout = 10)
public static void setUp() throws IOException {
    conn = TestDBUtils.getDBConnection();

    MessageDBAdaptorService.init(conn);

    msgclassificationFacade = new MessageClassificationFacadeImpl(conn);

    messageDAO = MessageDBAdaptorService.getMessageDAO();
    messageAssetDAO = MessageDBAdaptorService.getMessageAssetDAO();
    channelDAO = MessageDBAdaptorService.getChannelDAO();
    folderItemDAO = MessageDBAdaptorService.getFolderItemDAO();
    folderDAO = MessageDBAdaptorService.getFolderDAO();


    Assert.assertNotNull(messageDAO);
    Assert.assertNotNull(messageAssetDAO);
    Assert.assertNotNull(channelDAO);
    Assert.assertNotNull(folderItemDAO);
    Assert.assertNotNull(folderDAO);

}

I’ve searched the solutions online but it seems that there is no similar solution for Sonar. I suspect that the problem might come from Sonar’s different approach for test cases since the test cases run fine on normal basis.

I will post more code and information if the above are not enough. Thanks for any help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T02:03:48+00:00Added an answer on June 8, 2026 at 2:03 am

    It doesn’t seem to be a Sonar problem.
    From the stack trace I assume that maven surefire plugin can’t execute a particular test.
    If I were you I’d the following.
    – Verify that you custom build and Sonar are using the same maven surefire plugin version and have the same configuration.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

recently I am reading about Thinking in Java. that code in my PC is
Recently I'm doing some work on RTMP streaming, that is using Flowplayer to integrate
Recently I have been dealing with windows LogonUser API. The LogonUser api returns different
recently I started using storyboard and I've the following situation: I want to set
Recently I've begun to code in Objective-C for iOS 5 devices. My brand new
Recently we have released our product. Our team decided to preserve the source code
Recently, we discovered odd behavior in some old code. This code has worked for
Recently downloaded some code for a minor open-source project related to a small webgame
Recently I've been doing quite the project mostly working with the DateTime class. Now,..
recently, while reading former's code in my current project, I encounter the problems below:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.