Visualizzazione dei risultati da 1 a 10 su 10

Visualizzazione discussione

  1. #7
    ah giusto, non ci avevo fatto caso in effetti.
    quella riga l'ho levata, ed ho anche spostato il UtenteMapper.xml nel resources folder.

    a questo punto ho lanciato il test così modificato:
    codice:
    public class UtenteServiceTest {
    
        private static UtenteService us;
    
        @BeforeClass
        public static void setUpClass() {
            us = new UtenteService();
        }
    
        @AfterClass
        public static void tearDownClass() {
            us = null;
        }
    
        @Test
        public void testGetUtenti() {
            List<Utente> utenti = us.getUtenti();
            Assert.assertNotNull(utenti);
            for (Utente u : utenti) {
                System.out.println(u.getEmail());
            }
        }
    
    }
    ma ottengo un altro errore (non se ne esce più ):
    codice:
    -------------------------------------------------------------------------------
    Test set: UtenteServiceTest
    -------------------------------------------------------------------------------
    Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.211 sec <<< FAILURE!
    testGetUtenti(UtenteServiceTest)  Time elapsed: 0.162 sec  <<< ERROR!
    org.apache.ibatis.exceptions.PersistenceException: 
    ### Error querying database.  Cause: java.sql.SQLException: No suitable driver found for URL_DB
    ### The error may exist in UtenteMapper.xml
    ### The error may involve com.mp.mappers.UtenteMapper.getUtenti
    ### The error occurred while executing a query
    ### Cause: java.sql.SQLException: No suitable driver found for http://ferrons.homepc.it:3306/test
        at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
        at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:150)
        at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141)
        at org.apache.ibatis.binding.MapperMethod.executeForMany(MapperMethod.java:137)
        at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:75)
    ......
    dentro maven ho messo questo però:
    codice:
    <dependency>
                <groupId>mysql</groupId>
                <artifactId>mysql-connector-java</artifactId>
                <version>5.1.6</version>
            </dependency>
    il db in verità è mariaDB, ma da quanto ho capito la compatibilità dovrebbe essere al 100% tra i due db (almeno per quanto riguarda la connessione).

    PS:
    ok risolto mettendo l'url della connessione così: jdbc:mysql://URL:3306/DB_NOME
    adesso funziona tutto.
    grazie mille per l'aiuto!!
    Ultima modifica di fermat; 18-12-2016 a 13:41

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.