[jboss-user] [JNDI/Naming/Network] - could not find datasource
sorry my last post didn't show up here is my problem i'm trying to install seam on tomcat,and i have a problem wich is blocking me,the server can't find the datasource,here is a part from the stacktrace | GRAVE: Could not find datasource: java:/mysqlds | javax.naming.NameNotFoundException: Le Nom mysqlds n'est pas lié àce Contexte | at org.apache.naming.NamingContext.lookup(NamingContext.java:770) | at org.apache.naming.NamingContext.lookup(NamingContext.java:153) | at org.apache.naming.SelectorContext.lookup(SelectorContext.java:137) | at javax.naming.InitialContext.lookup(Unknown Source) | at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:52) | at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:124)| | i have created a file mysql-ds.xml in seam\bootstrap\deploy ,and deleted hsql-ds.xml since i'm working with mysql here is the file | datasources | local-tx-datasource | jndi-nameMySqlDS/jndi-name | connection-urljdbc:mysql://mysql-hostname:3306/jbossdb/connection-url | driver-classcom.mysql.jdbc.Driver/driver-class | user-namex/user-name | passwordy/password | exception-sorter-class-nameorg.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter/exception-sorter-class-name | !-- should only be used on drivers after 3.22.1 with ping support | valid-connection-checker-class-nameorg.jboss.resource.adapter.jdbc.vendor.MySQLValidConnectionChecker/valid-connection-checker-class-name | -- | !-- sql to call when connection is created | new-connection-sqlsome arbitrary sql/new-connection-sql | -- | !-- sql to call on an existing pooled connection when it is obtained from pool - MySQLValidConnectionChecker is preferred for newer drivers | check-valid-connection-sqlsome arbitrary sql/check-valid-connection-sql | -- | | !-- corresponding type-mapping in the standardjbosscmp-jdbc.xml -- | metadata |type-mappingmySQL/type-mapping | /metadata | /local-tx-datasource | /datasources | | could you please help me to figure out where is the problem View the original post : http://www.jboss.com/index.html?module=bbop=viewtopicp=4166149#4166149 Reply to the post : http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4166149 ___ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user
[jboss-user] [JNDI/Naming/Network] - Could not find datasource !!!
Hi All. I am stuck in a peculiar problem and struggling with it. I have a created a standalone program in Java that accesses a database through a DataSource which I have configured in JBoss AS. I am trying to access the database using JNDI. I have a program by the name of SaveExample | private static Context jndiContext; | | public static void main(String[] args) { | // TODO Auto-generated method stub | | | Session session = null; | | try{ | System.out.println(Before Session Factory Configuration. !!!); | | SessionFactory sf = new Configuration().configure().buildSessionFactory(); | | | jndiContext = new InitialContext(); | | sf = (SessionFactory)jndiContext.lookup(java:MySqlDS); | | | session = sf.openSession(); | | System.out.println(After Session Factory Configuration. !!!); | | | | }catch(Exception e){ | e.printStackTrace(); | }finally{ | session.flush(); | session.close(); | } | | } | | hibernate.cfg.xml | hibernate-configuration | | session-factory | | property name=hibernate.connection.datasourceMySqlDS/property | property name=hibernate.session_factory_namejava:Mydatabase/property | property name=hibernate.jndi.url/property | property name=hibernate.jndi.class/property | property name=hibernate.connection.username/property | property name=hibernate.connection.password/property | | property name=show_sqltrue/property | property name=format_sqltrue/property | | !-- Show and print nice SQL on stdout. -- | property name=dialectorg.hibernate.dialect.MySQLDialect/property | property name=hibernate.hbm2ddl.autoupdate/property | | !-- List of XML Mapping files -- | mapping resource=contact.hbm.xml/ | !--mapping resource=address.hbm.xml/ -- | | /session-factory | | /hibernate-configuration | | I have put the lib file mysql-connector-java-5.1.5-bin.jar in the server\default\lib folder of JBoss and I have put the mysql-ds.xml file in server\default\deploy directory of JBoss. mysql-ds.xml --- | | datasources | local-tx-datasource | jndi-nameMySqlDS/jndi-name | connection-urljdbc:mysql://localhost:3306/jbossdb/connection-url | !-- Added by me for configuting a data source for remote usage -- | use-java-contextfalse/use-java-context | driver-classcom.mysql.jdbc.Driver/driver-class | user-nameroot/user-name | passwordroot/password | exception-sorter-class-nameorg.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter/exception-sorter-class-name | !-- should only be used on drivers after 3.22.1 with ping support | valid-connection-checker-class-nameorg.jboss.resource.adapter.jdbc.vendor.MySQLValidConnectionChecker/valid-connection-checker-class-name | -- | !-- sql to call when connection is created | new-connection-sqlsome arbitrary sql/new-connection-sql | -- | !-- sql to call on an existing pooled connection when it is obtained from pool - MySQLValidConnectionChecker is preferred for newer drivers | check-valid-connection-sqlsome arbitrary sql/check-valid-connection-sql | -- | | !-- corresponding type-mapping in the standardjbosscmp-jdbc.xml -- | metadata |type-mappingmySQL/type-mapping | /metadata | /local-tx-datasource | /datasources | | | Exception --- | | Before Session Factory Configuration. !!! | log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment). | log4j:WARN Please initialize the log4j system properly. | org.hibernate.HibernateException: Could not find datasource | at org.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:56) | at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:124) | at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:56) | at org.hibernate.cfg.SettingsFactory.createConnectionProvider(SettingsFactory.java:414) | at