[Play 2.0.4-Java] Unresolved dependencies

java

(Paola) #1

Hello
The application uses mysql and also connects to an ADS database (Advantage database server)

In my Build.scala i have this code:

object ApplicationBuild extends Build {
val appName = “acol”
val appVersion = “2.0.14-SNAPSHOT”

val appDependencies = Seq(
  // Add your project dependencies here,
  "mysql" % "mysql-connector-java" % "5.1.+",
  "commons-lang" % "commons-lang" % "2.5",
  "org.jasypt" % "jasypt" % "1.9.+",
  "org.mybatis" % "mybatis" % "3.0.+",
  "ads" % "ads-connector-java" % "9.10", 
  "org.apache.commons" % "commons-email" % "1.2"
)

val main = PlayProject(appName, appVersion, appDependencies, mainLang = JAVA).settings(
  // Add your own project settings here
  lessEntryPoints <<= baseDirectory(_ / "app" / "assets" / "stylesheets" ** "bootstrap.less")
)

}

In the lib directory I have:
ads.ads-connector-java-ads-connector-java-9.10.jar
mysql.mysql-connector-java-mysql-connector-java-5.1.21.jar

When I execute: play run, this error appears:

f:\Pl\acol>play run
[info] Loading project definition from F:\Pl\acol\project
[info] Set current project to acol (in build file:/F:/Pl/acol/)

[info] Updating {file:/F:/Pl/acol/}acol…
[info] Resolving org.hibernate.javax.persistence#hibernate-jpa-2.0-api;1.0.1.Fin

[warn] module not found: ads#ads-connector-java;9.10
[warn] ==== local: tried
[warn] F:\play-2.0.4\framework…\repository/local/ads/ads-connector-java/9.10
/ivys/ivy.xml
[warn] ==== Typesafe Releases Repository: tried
[warn] http://repo.typesafe.com/typesafe/releases/ads/ads-connector-java/9.10/
ads-connector-java-9.10.pom
[warn] ==== Typesafe Snapshots Repository: tried
[warn] http://repo.typesafe.com/typesafe/snapshots/ads/ads-connector-java/9.10
/ads-connector-java-9.10.pom
[warn] ==== public: tried
[warn] http://repo1.maven.org/maven2/ads/ads-connector-java/9.10/ads-connector
-java-9.10.pom
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: ads#ads-connector-java;9.10: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[error] {file:/F:/Pl/acol/}acol/*:update: sbt.ResolveException: unresolved depen
dency: ads#ads-connector-java;9.10: not found
[warn] some of the dependencies were not recompiled properly, so classloader is
not avaialable
[info] Updating {file:/F:/Pl/acol/}acol…
[info] Resolving org.hibernate.javax.persistence#hibernate-jpa-2.0-api;1.0.1.Fin

[warn] module not found: ads#ads-connector-java;9.10
[warn] ==== local: tried
[warn] F:\play-2.0.4\framework…\repository/local/ads/ads-connector-java/9.10
/ivys/ivy.xml
[warn] ==== Typesafe Releases Repository: tried
[warn] http://repo.typesafe.com/typesafe/releases/ads/ads-connector-java/9.10/
ads-connector-java-9.10.pom
[warn] ==== Typesafe Snapshots Repository: tried
[warn] http://repo.typesafe.com/typesafe/snapshots/ads/ads-connector-java/9.10
/ads-connector-java-9.10.pom
[warn] ==== public: tried
[warn] http://repo1.maven.org/maven2/ads/ads-connector-java/9.10/ads-connector
-java-9.10.pom
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: ads#ads-connector-java;9.10: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[error] {file:/F:/Pl/acol/}acol/*:update: sbt.ResolveException: unresolved depen
dency: ads#ads-connector-java;9.10: not found

I do not know how to solve it.
If I remove the line corresponding to the ads-connector in the Build.scala file, the application works, but it does not connect to the ADS database.
I appreciate any help.
Thank you


#2

If you put libraries under lib folder, there isn’t needs to to write its in build.sbt because sbt search dependencies on maven repository.


(Paola) #3

Hello morellik
ok, yes… but I comment this line in Build.scala, I have no mistakes, I’ve already tried it. BUT, it does NOT connect to the database.:

val appDependencies = Seq(
  // Add your project dependencies here,
  "mysql" % "mysql-connector-java" % "5.1.+",
  "commons-lang" % "commons-lang" % "2.5",
  "org.jasypt" % "jasypt" % "1.9.+",
  "org.mybatis" % "mybatis" % "3.0.+",
  //"ads" % "ads-connector-java" % "9.10", 
  "org.apache.commons" % "commons-email" % "1.2"
)

The problem is with play, because I did a small test program in java and it works perfectly. (It is not a network problem or access to the database.)
I do not know what else to try and I can not know where the problem is.
The program works and connects well in the production environment, but not in the testing environment and I must first test the modifications made.
If someone happens to think I can try more, I thank you very much.

In application.conf I have:

proprietary.db.legacy.driver=com.extendedsystems.jdbc.advantage.ADSDriver
proprietary.db.legacy.url="jdbc:extendedsystems:advantage://192.168.0.12:6262;catalog=D:\\ah\\Marcrefe\\archivos;TableType=cdx;LockType=proprietary"
proprietary.db.legacy.user=AdsSys
proprietary.db.legacy.password=no

the program test (works ok) is:

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;

public class TestADS {
    public static void main(String[] args){
        Connection conn = null;
        long tiempoTotal = 0;
        try{

            Class.forName("com.extendedsystems.jdbc.advantage.ADSDriver");
            tiempoTotal = System.currentTimeMillis();
            long time = System.currentTimeMillis();
            conn = DriverManager.getConnection("jdbc:extendedsystems:advantage://192.168.0.12:6262;catalog=D:\\ah\\Marcrefe\\archivos;TableType=cdx;LockType=proprietary", "AdsSys", "no");
            System.out.println ("Tiempo de conexion: " + (System.currentTimeMillis()-time) + "ms");

            time = System.currentTimeMillis();
            ResultSet rs = conn.createStatement().executeQuery("select * from planes");
        
            while (rs.next()) {
                System.out.println("NOMBRE: "
                    + rs.getString("nombre"));
            }            
        
            System.out.println ("Tiempo de consulta: " + (System.currentTimeMillis()-time) + "ms");

            time = System.currentTimeMillis();
            while (rs.next()){
                rs.getString(1);
            }
            System.out.println ("Tiempo de fetch: " + (System.currentTimeMillis()-time) + "ms");

        }catch (Exception e){
            e.printStackTrace();
        }finally{
            try{
                long time = System.currentTimeMillis();
                conn.close();
                System.out.println ("Tiempo de cerrar conexion: " + (System.currentTimeMillis()-time) + "ms");
            }catch (Exception e){
            }
        }

        System.out.println ("Tiempo total: " + (System.currentTimeMillis()-tiempoTotal) + "ms");
    }
}

(Paola) #4

Hello
The error is in this statement:
SqlSession session = DBUtil.getInstance().openSQLSession();

and the log is:

2018-12-17 16:27:06,699 - [ERROR] - from application in play-akka.actor.actions-dispatcher-10 
Solicitudes - calculate: Error leyendo datos del cliente.
org.apache.ibatis.exceptions.PersistenceException: 
### Error building SqlSession.
### The error may exist in legacy-sqlmap.xml
### Cause: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper   Configuration. Cause: org.apache.ibatis.builder.BuilderException: Error creating document instance.  Cause: org.xml.sax.SAXParseException; lineNumber: 210; columnNumber: 10; El contenido del tipo de elemento "mapper" debe coincidir con "(cache-ref|cache|resultMap*|parameterMap*|sql*|insert*|update*|delete*|select*)+".
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:8) ~[mybatis-3.0.6.jar:3.0.6]
at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:32) ~[mybatis-3.0.6.jar:3.0.6]
at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:24) ~[mybatis-3.0.6.jar:3.0.6]
at drivers.DBUtil.<init>(DBUtil.java:41) ~[classes/:na]
at drivers.DBUtil.getInstance(DBUtil.java:50) ~[classes/:na]
at drivers.DBUtil.getInstance(DBUtil.java:56) ~[classes/:na]
at drivers.Legacy.readClienteByNroDocumento(Legacy.java:24) ~[classes/:na]
at controllers.Solicitudes.checkClientName(Solicitudes.java:67) ~[classes/:na]
at Routes$$anonfun$routes$1$$anonfun$apply$27$$anonfun$apply$28.apply(routes_routing.scala:356) [classes/:na]
at Routes$$anonfun$routes$1$$anonfun$apply$27$$anonfun$apply$28.apply(routes_routing.scala:356) [classes/:na]
at play.core.Router$HandlerInvoker$$anon$5$$anon$1.invocation(Router.scala:1090) [play_2.9.1.jar:2.0.4]
at play.core.j.JavaAction$$anon$1.call(JavaAction.scala:33) [play_2.9.1.jar:2.0.4]
at play.GlobalSettings$1.call(GlobalSettings.java:57) [play_2.9.1.jar:2.0.4]
at controllers.BeforeAfterActions.call(BeforeAfterActions.java:36) [classes/:na]
at play.mvc.Security$AuthenticatedAction.call(Security.java:39) [play_2.9.1.jar:2.0.4]
at play.core.j.JavaAction$class.apply(JavaAction.scala:74) [play_2.9.1.jar:2.0.4]
at play.core.Router$HandlerInvoker$$anon$5$$anon$1.apply(Router.scala:1089) [play_2.9.1.jar:2.0.4]
at play.core.ActionInvoker$$anonfun$receive$1$$anonfun$6.apply(Invoker.scala:126) [play_2.9.1.jar:2.0.4]
at play.core.ActionInvoker$$anonfun$receive$1$$anonfun$6.apply(Invoker.scala:126) [play_2.9.1.jar:2.0.4]
at play.utils.Threads$.withContextClassLoader(Threads.scala:17) [play_2.9.1.jar:2.0.4]
at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:125) [play_2.9.1.jar:2.0.4]
at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:115) [play_2.9.1.jar:2.0.4]
at akka.actor.Actor$class.apply(Actor.scala:318) [akka-actor.jar:2.0.2]
at play.core.ActionInvoker.apply(Invoker.scala:113) [play_2.9.1.jar:2.0.4]
at akka.actor.ActorCell.invoke(ActorCell.scala:626) [akka-actor.jar:2.0.2]
at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:197) [akka-actor.jar:2.0.2]
at akka.dispatch.Mailbox.run(Mailbox.scala:179) [akka-actor.jar:2.0.2]
at akka.dispatch.ForkJoinExecutorConfigurator$MailboxExecutionTask.exec(AbstractDispatcher.scala:516) [akka-actor.jar:2.0.2]
at akka.jsr166y.ForkJoinTask.doExec(ForkJoinTask.java:259) [akka-actor.jar:2.0.2]
at akka.jsr166y.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:975) [akka-actor.jar:2.0.2]
at akka.jsr166y.ForkJoinPool.runWorker(ForkJoinPool.java:1479) [akka-actor.jar:2.0.2]
at akka.jsr166y.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:104) [akka-actor.jar:2.0.2]

Caused by: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xml.sax.SAXParseException; lineNumber: 210; columnNumber: 10; El contenido del tipo de elemento “mapper” debe coincidir con “(cache-ref|cache|resultMap*|parameterMap*|sql*|insert*|update*|delete*|select*)+”.
at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:85) ~[mybatis-3.0.6.jar:3.0.6]
at org.apache.ibatis.builder.xml.XMLConfigBuilder.parse(XMLConfigBuilder.java:69) ~[mybatis-3.0.6.jar:3.0.6]
at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:30) ~[mybatis-3.0.6.jar:3.0.6]
… 30 common frames omitted
Caused by: org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xml.sax.SAXParseException; lineNumber: 210; columnNumber: 10; El contenido del tipo de elemento “mapper” debe coincidir con “(cache-ref|cache|resultMap*|parameterMap*|sql*|insert*|update*|delete*|select*)+”.
at org.apache.ibatis.parsing.XPathParser.createDocument(XPathParser.java:238) ~[mybatis-3.0.6.jar:3.0.6]
at org.apache.ibatis.parsing.XPathParser.(XPathParser.java:107) ~[mybatis-3.0.6.jar:3.0.6]
at org.apache.ibatis.builder.xml.XMLMapperBuilder.(XMLMapperBuilder.java:61) ~[mybatis-3.0.6.jar:3.0.6]
at org.apache.ibatis.builder.xml.XMLConfigBuilder.mapperElement(XMLConfigBuilder.java:256) ~[mybatis-3.0.6.jar:3.0.6]
at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:83) ~[mybatis-3.0.6.jar:3.0.6]
… 32 common frames omitted
Caused by: org.xml.sax.SAXParseException: El contenido del tipo de elemento “mapper” debe coincidir con “(cache-ref|cache|resultMap*|parameterMap*|sql*|insert*|update*|delete*|select*)+”.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source) ~[na:1.7.0_21]
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(Unknown Source) ~[na:1.7.0_21]
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source) ~[na:1.7.0_21]
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source) ~[na:1.7.0_21]
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source) ~[na:1.7.0_21]
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleEndElement(Unknown Source) ~[na:1.7.0_21]
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.endElement(Unknown Source) ~[na:1.7.0_21]
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source) ~[na:1.7.0_21]
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source) ~[na:1.7.0_21]
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source) ~[na:1.7.0_21]
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) ~[na:1.7.0_21]
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source) ~[na:1.7.0_21]
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source) ~[na:1.7.0_21]
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source) ~[na:1.7.0_21]
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(Unknown Source) ~[na:1.7.0_21]
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(Unknown Source) ~[na:1.7.0_21]
at org.apache.ibatis.parsing.XPathParser.createDocument(XPathParser.java:236) ~[mybatis-3.0.6.jar:3.0.6]
… 36 common frames omitted

The files:


I hope I can solve it


(Paola) #5

Hello
I was able to solve the problem.
After a lot of checking and searching for that error, I discovered that the legacy-sqlmap.xml file had a validation error.

I used the link to validate:
https://www.xmlvalidation.com/
Maybe some special character introduced by the pspad editor was bothering

Very thanks