WinFuture-Forum.de: Jboss Und Conectionpool Problem - WinFuture-Forum.de

Zum Inhalt wechseln

Nachrichten zum Thema: Entwicklung
Seite 1 von 1

Jboss Und Conectionpool Problem


#1 Mitglied ist offline   skelle 

  • Gruppe: aktive Mitglieder
  • Beiträge: 793
  • Beigetreten: 15. Juli 04
  • Reputation: 0

geschrieben 28. Oktober 2009 - 21:55

Hallo,
ich habe folgende xml um meine mysql db als datasource zur verfügung zu stellen:
<datasources>
	<local-tx-datasource>
		<!-- This connection pool will be bound into JNDI with the name
			 "java:/MySQLDB" -->

		<jndi-name>localhostDB</jndi-name>
		<connection-url>jdbc:mysql://localhost:3306/web_portal</connection-url>
		<driver-class>com.mysql.jdbc.Driver</driver-class>
		<user-name>jboss</user-name>
		<password>123</password>

		<min-pool-size>5</min-pool-size>

		<!-- Don't set this any higher than max_connections on your
		 MySQL server, usually this should be a 10 or a few 10's
		 of connections, not hundreds or thousands -->

		<max-pool-size>20</max-pool-size>

		<!-- Don't allow connections to hang out idle too long,
		 never longer than what wait_timeout is set to on the
		 server...A few minutes is usually okay here,
		 it depends on your application
		 and how much spikey load it will see -->

		<idle-timeout-minutes>5</idle-timeout-minutes>

		<!-- If you're using Connector/J 3.1.8 or newer, you can use
			 our implementation of these to increase the robustness
			 of the connection pool. -->

		<exception-sorter-class-name>
  com.mysql.jdbc.integration.jboss.ExtendedMysq
lExceptionSorter
		</exception-sorter-class-name>
		<valid-connection-checker-class-name>
  com.mysql.jdbc.integration.jboss.MysqlValidCo
nnectionChecker
		</valid-connection-checker-class-name>

	</local-tx-datasource>
</datasources>


wenn ich allerdings per
dataSource = null;
		InitialContext initCtx = new InitialContext();
		Context ctx = (Context) initCtx.lookup("java:comp/env");
		dataSource = (DataSource) ctx.lookup("java:/localhostDB");


versuche eine connection zu bekommen bekomme ich eine Exception
" javax.naming.NameNotFoundException: localhostDB not bound"

im serverlog sehe ich allerdings:
" INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=local
hostDB' to JNDI name 'java:localhostDB'
"

habe ich was übersehen?

greetz skelle
0

Anzeige



#2 Mitglied ist offline   Witi 

  • Gruppe: aktive Mitglieder
  • Beiträge: 5.942
  • Beigetreten: 13. Dezember 04
  • Reputation: 43
  • Geschlecht:Männlich
  • Wohnort:Kingsvillage
  • Interessen:Frickeln

geschrieben 28. Oktober 2009 - 22:15

Hast du vorher ein bind ausgeführt, wie hier beschrieben?
http://java.sun.com/javase/6/docs/technote...ce.html#1000023
0

#3 Mitglied ist offline   skelle 

  • Gruppe: aktive Mitglieder
  • Beiträge: 793
  • Beigetreten: 15. Juli 04
  • Reputation: 0

geschrieben 28. Oktober 2009 - 23:32

Also der Fehler wieso er nicht zur Datenbank verbindet ist behoben ...
ich hätte den lookup einfach auf den initalContext machen müssen.
Wenn ich jetzt allerdings eine Connection von der DataSource anfordere bekomme ich einen neuen Fehler.
 ERROR [STDERR] org.jboss.util.NestedSQLException: Unable to get managed connection for localhostDB; - nested throwabl  e: (javax.resource.ResourceException: Unable to get managed connection for localhostDB)
22:23:42,791 ERROR [STDERR]	 at org.jboss.resource.adapter.jdbc.WrapperDataSource.
getConnection(WrapperDataSource.java:95)
22:23:42,791 ERROR [STDERR]	 at beans.Database.getConnection(Database.java:25)
22:23:42,791 ERROR [STDERR]	 at servlets.Login.doPost(Login.java:51)


ich konnte allerdings noch nicht rausfinden was das genau bedeutet

greetz
0

Thema verteilen:


Seite 1 von 1

1 Besucher lesen dieses Thema
Mitglieder: 0, Gäste: 1, unsichtbare Mitglieder: 0