[jboss-user] [Datasource Configuration] - Conexión MySQL y JBoss 7.1.1

Jose Moreno do-not-reply at jboss.com
Wed May 1 09:42:30 EDT 2013


Jose Moreno [https://community.jboss.org/people/josemo] created the discussion

"Conexión MySQL y JBoss 7.1.1"

To view the discussion, visit: https://community.jboss.org/message/811099#811099

--------------------------------------------------------------
Buenos días, 

Desde hace ya un tiempo arrastro el siguiente problema que no me deja continuar con mi desarrollo... Intento conectar una base de datos MySQL (llamada 'login') y un servidor JBoss 7.1.1 en el entorno Eclipse IDE en Windows XP.

Les adjunto los pasos que he realizado para su valoración.

El archivo *standalone.xml*

<datasources>
                <datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true">
                    <connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1</connection-url>
                    <driver>h2</driver>
                    <security>
                        <user-name>sa</user-name>
                        <password>sa</password>
                    </security>
                </datasource>
*<datasource jta="true" jndi-name="java:jboss/datasources/login" pool-name="login" enabled="true" use-java-context="true" use-ccm="true">*
*                    <connection-url>jdbc:mysql://localhost:3306/login</connection-url>*
*                    <driver>mysql</driver>*
*                    <security>*
*                        <user-name>root</user-name>*
*                    </security>*
*                </datasource>*
                <drivers>
                    <driver name="h2" module="com.h2database.h2">
                        <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
*</driver>*
*                    <driver name="mysql" module="com.mysql">*
*                        <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>*
*                    </driver>*
                </drivers>
            </datasources>

Duda 1. ¿La password de la base de datos es una cadena vacía... está bien que se omita? Lo pongo pero JBoss al cargar elimina el tag de <password>

A continuación, en el directorio *modules/com/mysql/main* pegué el .jar de MySQL (mysql-connector-java-5.0.8-bin.jar), se me creó automáticamente el .index de ese .jar y, además, creé el archivo *module.xml* que pego abajo:

*<?xml version="1.0" encoding="UTF-8"?>*
*<module xmlns="urn:jboss:module:1.0" name="mysql">*
*  <resources>*
*    <resource-root path="mysql-connector-java-5.0.8-bin.jar"/>*
*  </resources>*
*  <dependencies>*
*          <module name="javax.api"/>*
*          <module name="javax.transaction.api"/>*
*          <module name="javax.servlet.api" optional="true"/>*
*  </dependencies>*
*</module>*

El método que tengo de conexión en Java es el siguiente...

*private Connection cnn = null;*

*public Connection getConexion (String strDs) throws Exception {*
*              try {*
*                        InitialContext initialContext = new InitialContext();*
*                        DataSource ds = (DataSource) initialContext.lookup(strDs.toString());*
*                        try {*
*                                  cnn = ds.getConnection();                        // Línea en la que falla...*
*                        } catch (SQLException sqle) {*
*                                  System.out.println(*
*                                                      "Error en el método getConexion() de la clase Proceso: " + strDs +*
*                                                                          sqle.getMessage());*
*                                  throw sqle;*
*                        }*
*              } catch (NamingException ne) {*
*                        System.out.println(*
*                                            "Error en el método getConexion() de la clase Proceso: " +*
*                                                                ne.getMessage());*
*                        throw ne;*
*              }*
*              return cnn;*
*          }*

Pego también la consola:

15:12:18,218 INFO  [org.jboss.modules] JBoss Modules version 1.1.1.GA
15:12:19,015 INFO  [org.jboss.msc] JBoss MSC version 1.0.2.GA
15:12:19,171 INFO  [org.jboss.as] JBAS015899: JBoss AS 7.1.1.Final "Brontes" starting
15:12:23,296 INFO  [org.jboss.as.server] JBAS015888: Creating http management service using socket-binding (management-http)
15:12:23,328 INFO  [org.xnio] XNIO Version 3.0.3.GA
15:12:23,328 INFO  [org.xnio.nio] XNIO NIO Implementation Version 3.0.3.GA
15:12:23,343 INFO  [org.jboss.remoting] JBoss Remoting version 3.2.3.GA
15:12:23,609 INFO  [org.jboss.as.configadmin] JBAS016200: Activating ConfigAdmin Subsystem
15:12:23,671 INFO  [org.jboss.as.clustering.infinispan] JBAS010280: Activating Infinispan subsystem.
15:12:23,703 INFO  [org.jboss.as.naming] JBAS011800: Activating Naming Subsystem
15:12:23,734 INFO  [org.jboss.as.osgi] JBAS011940: Activating OSGi Subsystem
15:12:23,906 INFO  [org.jboss.as.security] JBAS013101: Activating Security Subsystem
15:12:23,937 INFO  [org.jboss.as.webservices] JBAS015537: Activating WebServices Extension
15:12:24,203 INFO  [org.jboss.as.logging] JBAS011502: Removing bootstrap log handlers
15:12:25,468 INFO  [org.jboss.as.connector] (MSC service thread 1-2) JBAS010408: Starting JCA Subsystem (JBoss IronJacamar 1.0.9.Final)
15:12:25,484 INFO  [org.jboss.as.mail.extension] (MSC service thread 1-2) JBAS015400: Bound mail session [java:jboss/mail/Default]
15:12:25,953 INFO  [org.apache.coyote.http11.Http11Protocol] (MSC service thread 1-2) Arrancando Coyote HTTP/1.1 en puerto http-localhost-127.0.0.1-8080
15:12:27,296 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-2) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]
15:12:27,343 INFO  [org.jboss.ws.common.management.AbstractServerConfig] (MSC service thread 1-1) JBoss Web Services - Stack CXF Server 4.0.2.GA
15:12:27,609 INFO  [org.jboss.as.remoting] (MSC service thread 1-1) JBAS017100: Listening on /127.0.0.1:9999
15:12:27,687 INFO  [org.jboss.as.server.deployment.scanner] (MSC service thread 1-1) JBAS015012: Started FileSystemDeploymentService for directory C:\Documents and Settings\Administrador\Mis documentos\jboss-as-7.1.1.Final\standalone\deployments
15:12:27,750 INFO  [org.jboss.as.remoting] (MSC service thread 1-1) JBAS017100: Listening on localhost/127.0.0.1:4447
15:12:27,859 INFO  [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) JBAS015003: Found Login_7.1.war in deployment directory. To trigger deployment create a file called Login_7.1.war.dodeploy
15:12:28,125 INFO  [org.jboss.as.controller] (Controller Boot Thread) JBAS014774: Service status report
JBAS014775:    New missing/unsatisfied dependencies:
      service jboss.jdbc-driver.com_mysql_jdbc_Driver (missing) dependents: [service jboss.data-source.java:jboss/datasources/login]  *¿De dónde sale esto?*


15:12:28,171 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015876: Starting deployment of "Login_7.1.war"
15:12:29,390 INFO  [org.jboss.web] (MSC service thread 1-1) JBAS018210: Registering web context: /Login_7.1
15:12:29,406 INFO  [org.jboss.as] (MSC service thread 1-2) JBAS015951: Admin console listening on  http://127.0.0.1:9990 http://127.0.0.1:9990
15:12:29,406 ERROR [org.jboss.as] (MSC service thread 1-2) JBAS015875: JBoss AS 7.1.1.Final "Brontes" started (with errors) in 12110ms - Started 175 of 255 services (2 services failed or missing dependencies, 76 services are passive or on-demand)
15:12:29,609 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018559: Deployed "Login_7.1.war"
15:12:44,250 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/Login_7.1].[jsp]] (http-localhost-127.0.0.1-8080-1) Servlet.service() para servlet jsp lanzó excepción: java.lang.NoSuchMethodError: Metodos.bbdd.getConexion(Ljava/lang/String;)V
          at org.apache.jsp.Validacion_jsp._jspService(Validacion_jsp.java:68)
          at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) [jbossweb-7.0.13.Final.jar:]
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
          at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369) [jbossweb-7.0.13.Final.jar:]
          at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326) [jbossweb-7.0.13.Final.jar:]
          at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253) [jbossweb-7.0.13.Final.jar:]
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.13.Final.jar:]
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]
          at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.13.Final.jar:]
          at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.13.Final.jar:]
          at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
          at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.13.Final.jar:]
          at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.13.Final.jar:]
          at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.13.Final.jar:]
          at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.13.Final.jar:]
          at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.13.Final.jar:]
          at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.13.Final.jar:]
          at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.13.Final.jar:]
          at java.lang.Thread.run(Unknown Source) [rt.jar:1.7.0_15]


15:15:43,515 INFO  [org.jboss.as.osgi] (MSC service thread 1-1) JBAS011942: Stopping OSGi Framework
15:15:43,671 INFO  [org.jboss.as.logging] JBAS011503: Restored bootstrap log handlers
15:15:43,984 INFO  [com.arjuna.ats.jbossatx] ARJUNA032018: Destroying TransactionManagerService
15:15:43,984 INFO  [com.arjuna.ats.jbossatx] ARJUNA032014: Stopping transaction recovery manager
15:15:44,000 INFO  [org.jboss.as.server.deployment] JBAS015877: Stopped deployment Login_7.1.war in 510ms
15:15:44,000 INFO  [org.jboss.as.controller] JBAS014774: Service status report
JBAS014776:    Newly corrected services:
      service jboss.jdbc-driver.com_mysql_jdbc_Driver (new available) *¿Por qué cuando apago el servidor aparece este mensaje?*


15:15:44,000 INFO  [org.jboss.as] JBAS015950: JBoss AS 7.1.1.Final "Brontes" stopped in 513ms

Espero que me puedan ayudar con las 'pistas' que les estoy dando.

Muchas gracias, un saludo.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/811099#811099]

Start a new discussion in Datasource Configuration at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2077]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20130501/5e76a07a/attachment-0001.html 


More information about the jboss-user mailing list