3 Replies Latest reply on Aug 21, 2008 3:42 PM by Guillaume Jeudy

    error about DBUnit:org.dbunit.dataset.DataSetException: java.net.MalformedURLException

    Jessica Cao Newbie
      i use seam 2.0.2CR1,i find the following error when i use DBUnit:
      [testng] [Parser] Running:
         [testng] D:\WorkSpace\ReportBackup202CR1\test-build\testng.xml
         [testng] WARN  [org.jboss.seam.Component] Component class should be serializable: sendEmail
         [testng] Hibernate:
         [testng] select
         [testng] repobackup0_.id as id1_,
         [testng] repobackup0_.bargainPrice as bargainP2_1_,
         [testng] repobackup0_.city as city1_,
         [testng] repobackup0_.countc as countc1_,
         [testng] repobackup0_.email as email1_,
         [testng] repobackup0_.finalUserName as finalUse6_1_,
         [testng] repobackup0_.intendTime as intendTime1_,
         [testng] repobackup0_.owner as owner1_,
         [testng] repobackup0_.product as product1_,
         [testng] repobackup0_.projectName as project10_1_,
         [testng] repobackup0_.province as province1_,
         [testng] repobackup0_.repoBackupTime as repoBac12_1_,
         [testng] repobackup0_.stateid as stateid1_,
         [testng] repobackup0_.repoBackupPersonid as repoBac15_1_,
         [testng] repobackup0_.tele as tele1_
         [testng] from
         [testng] repo_back repobackup0_
         [testng] INFO  [org.ajax4jsf.cache.CacheManager] Selected [org.ajax4jsf.cache.LRUMapCacheFactory] cache factory
         [testng] INFO  [org.ajax4jsf.cache.LRUMapCacheFactory] Creating LRUMap cache instance using parameters: {}
         [testng] INFO  [org.ajax4jsf.cache.LRUMapCacheFactory] Creating LRUMap cache instance of default capacity
         [testng] INFO  [org.ajax4jsf.cache.CacheManager] Selected [org.ajax4jsf.cache.LRUMapCacheFactory] cache factory
         [testng] INFO  [org.ajax4jsf.cache.LRUMapCacheFactory] Creating LRUMap cache instance using parameters: {}
         [testng] INFO  [org.ajax4jsf.cache.LRUMapCacheFactory] Creating LRUMap cache instance of default capacity
         [testng] FAILED CONFIGURATION: @BeforeClass init
         [testng] java.lang.RuntimeException: org.dbunit.dataset.DataSetException: java.net.MalformedURLException
         [testng] at org.jboss.seam.mock.DBUnitSeamTest$DataSetOperation.<init>(DBUnitSeamTest.java:170)
         [testng] at org.jboss.seam.mock.DBUnitSeamTest$DataSetOperation.<init>(DBUnitSeamTest.java:159)
         [testng] at cn.softlink.repo.LoginTest.prepareDBUnitOperations(LoginTest.java:10)
         [testng] at org.jboss.seam.mock.DBUnitSeamTest.setupClass(DBUnitSeamTest.java:112)
         [testng] at org.jboss.seam.mock.BaseSeamTest.init(BaseSeamTest.java:924)
         [testng] at org.jboss.seam.mock.SeamTest.init(SeamTest.java:42)
         [testng] Caused by: org.dbunit.dataset.DataSetException: java.net.MalformedURLException
         [testng] at org.dbunit.dataset.xml.FlatXmlProducer.produce(FlatXmlProducer.java:169)
         [testng] at org.dbunit.dataset.CachedDataSet.<init>(CachedDataSet.java:71)
         [testng] at org.dbunit.dataset.xml.FlatXmlDataSet.<init>(FlatXmlDataSet.java:200)
         [testng] at org.dbunit.dataset.xml.FlatXmlDataSet.<init>(FlatXmlDataSet.java:187)
         [testng] at org.jboss.seam.mock.DBUnitSeamTest$DataSetOperation.<init>(DBUnitSeamTest.java:168)
         [testng] ... 27 more
         [testng] ... Removed 22 stack frames
         [testng] SKIPPED CONFIGURATION: @BeforeClass setDatasourceJndiName
         [testng] SKIPPED CONFIGURATION: @BeforeClass setupClass
         [testng] SKIPPED CONFIGURATION: @BeforeMethod begin
         [testng] SKIPPED CONFIGURATION: @AfterMethod end
         [testng] SKIPPED CONFIGURATION: @AfterClass cleanup
         [testng] SKIPPED: testLogin
         [testng] ===============================================
         [testng] reportBackup test
         [testng] Tests run: 1, Failures: 0, Skips: 1
         [testng] Configuration Failures: 1, Skips: 5
         [testng] ===============================================
         [testng] ===============================================
         [testng] ReportBackup Tests
         [testng] Total tests run: 1, Failures: 0, Skips: 1
         [testng] Configuration Failures: 1, Skips: 5
         [testng] ===============================================
      BUILD SUCCESSFUL
      Total time: 16 seconds

      i have seen the seamdiscs sample,To do my testing project in accordance with examples,but why is my test still wrong?what is reason for error?help me ,thanks a lot!||||||
        • 1. Re: error about DBUnit:org.dbunit.dataset.DataSetException: java.net.MalformedURLException
          Guillaume Jeudy Master

          Seam source code is available and I recommend you run in debug mode to find out what is wrong or just attach the source code in your IDE and read it at the line number provided in your stacktrace. My guess is that you provided an incorrect resource path for your dataset file.


          at cn.softlink.repo.LoginTest.prepareDBUnitOperations(LoginTest.java:10)

          • 2. Re: error about DBUnit:org.dbunit.dataset.DataSetException: java.net.MalformedURLException
            Jessica Cao Newbie
            yes,as you said,i think that the resource path maybe incorrect when i When I brush my teeth this morning,so error disappeared,but i find other errors:

            [testng] FAILED: testLogin
               [testng] java.lang.AssertionError: java.lang.NullPointerException
               [testng] at org.jboss.seam.mock.BaseSeamTest$Request.onException(BaseSeamTest.java:488)
               [testng] at org.jboss.seam.mock.BaseSeamTest$Request$2.doFilter(BaseSeamTest.java:537)
               [testng] at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
               [testng] at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
               [testng] at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
               [testng] at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
               [testng] at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
               [testng] at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
               [testng] at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
               [testng] at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
               [testng] at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
               [testng] at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:154)
               [testng] at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:260)
               [testng] at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:366)
               [testng] at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:493)
               [testng] at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
               [testng] at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
               [testng] at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
               [testng] at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
               [testng] at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
               [testng] at org.jboss.seam.mock.BaseSeamTest$Request.run(BaseSeamTest.java:524)
               [testng] at cn.softlink.repo.LoginTest.testLogin(LoginTest.java:83)
               [testng] Caused by: java.lang.NullPointerException
               [testng] at cn.softlink.repo.LoginTest$4.renderResponse(LoginTest.java:102)
               [testng] at org.jboss.seam.mock.BaseSeamTest$Request.renderResponsePhase(BaseSeamTest.java:637)
               [testng] at org.jboss.seam.mock.BaseSeamTest$Request.emulateJsfLifecycle(BaseSeamTest.java:622)
               [testng] at org.jboss.seam.mock.BaseSeamTest$Request.access$300(BaseSeamTest.java:184)
               [testng] at org.jboss.seam.mock.BaseSeamTest$Request$2.doFilter(BaseSeamTest.java:530)
               [testng] ... 42 more
               [testng] ... Removed 22 stack frames
               [testng] ===============================================
               [testng] reportBackup test
               [testng] Tests run: 1, Failures: 1, Skips: 0
               [testng] ===============================================
               [testng] ===============================================
               [testng] ReportBackup Tests
               [testng] Total tests run: 1, Failures: 1, Skips: 0
               [testng] ===============================================
            BUILD SUCCESSFUL

            how to solve it?
            In addition, I have a problem:
            how the table name of dataset file are named in seamdiscs seample ?it hasn't @Table(name = "ARTIST") in class Artist,
            what the table name of dataset file is based on?

            thanks very much!
            • 3. Re: error about DBUnit:org.dbunit.dataset.DataSetException: java.net.MalformedURLException
              Guillaume Jeudy Master

              It seems like the table name is derived from the class name when no

              @Table

              annotation is specified, whether this is JPA standard or specific to the way hibernate implements JPA is unknown to me.


              Regarding your NPE, I think you should step through code. It seems like this line throws a NPE in the test:


              assert !((Boolean) getValue("#{identity.loggedIn}"));