Hi Guys I'm having some issues with my datasource in Karaf 4.3.6 (recent upgrade) I'm hoping someone could shed some light on what I'm doing wrong here.
Before the upgrade
Karaf had the below services (org.osgi.service.jdbc.DataSourceFactory):
[org.osgi.service.jdbc.DataSourceFactory]
-----------------------------------------
osgi.jdbc.driver.class = com.microsoft.sqlserver.jdbc.SQLServerDriver
osgi.jdbc.driver.name = com.microsoft.sqlserver.mssql-jdbc-native
osgi.jdbc.driver.version = 6.2.2.jre8
service.bundleid = 46
service.id = 219
service.scope = singleton
Provided by :
Microsoft JDBC Driver for SQL Server (46)
[org.osgi.service.jdbc.DataSourceFactory]
-----------------------------------------
osgi.jdbc.driver.class = com.microsoft.sqlserver.jdbc.SQLServerDriver
osgi.jdbc.driver.name = Microsoft JDBC Driver for SQL Server
osgi.jdbc.driver.version = 7.4
service.bundleid = 47
service.id = 223
service.scope = singleton
Provided by :
Microsoft JDBC Driver for SQL Server (47)
[org.osgi.service.jdbc.DataSourceFactory]
-----------------------------------------
osgi.jdbc.driver.class = com.microsoft.sqlserver.jdbc.SQLServerDriver
osgi.jdbc.driver.name = mssql
service.bundleid = 157
service.id = 252
service.scope = singleton
Provided by :
OPS4J Pax JDBC MSSQL Driver Adapter (157)
Used by:
example-project(173)
OPS4J Pax JDBC Config (38)
My project blueprint contained the below:
<bean id="sqlComponent" class="org.apache.camel.component.sql.SqlComponent">
<property name="dataSource" ref="exampleSQLServerDataSource"/>
</bean>
<service id="c1SQLDataSource" interface="javax.sql.DataSource" ref="exampleSQLServerDataSource">
<service-properties>
<entry key="osgi.jndi.service.name" value="exSQLDataSource"/>
</service-properties>
</service>
<bean id="exampleSQLServerDataSource" factory-ref="sqlServerDataSourceFactory" factory-method="createDataSource">
<argument>
<props>
<prop key="databaseName">${ex.db.dbname}</prop>
<prop key="user">${ex.db.user}</prop>
<prop key="password">${ex.db.password}</prop>
<prop key="portNumber">${ex.db.port}</prop>
<prop key="serverName">${ex.db.host}</prop>
</props>
</argument>
</bean>
<reference id="sqlServerDataSourceFactory" interface="org.osgi.service.jdbc.DataSourceFactory" filter="(objectClass=org.osgi.service.jdbc.DataSourceFactory)(osgi.jdbc.driver.name=mssql)"/>
With this configuration my project worked fine on install / i could use the camel-sql component with my datasource.
After the upgrade
Changes to karaf depensancys meant that the mssql factory was no longer available (even when starting the feature for pax-jdbc-mssql)
Karaf had the below services (org.osgi.service.jdbc.DataSourceFactory):
[org.osgi.service.jdbc.DataSourceFactory]
-----------------------------------------
osgi.jdbc.driver.class = com.microsoft.sqlserver.jdbc.SQLServerDriver
osgi.jdbc.driver.name = com.microsoft.sqlserver.mssql-jdbc-native
osgi.jdbc.driver.version = 6.2.2.jre8
service.bundleid = 54
service.id = 214
service.scope = singleton
Provided by :
Microsoft JDBC Driver for SQL Server (54)
[org.osgi.service.jdbc.DataSourceFactory]
-----------------------------------------
osgi.jdbc.driver.class = com.microsoft.sqlserver.jdbc.SQLServerDriver
osgi.jdbc.driver.name = Microsoft JDBC Driver for SQL Server
osgi.jdbc.driver.version = 9.2
service.bundleid = 55
service.id = 371
service.scope = singleton
Provided by :
Microsoft JDBC Driver for SQL Server (55)
[org.osgi.service.jdbc.DataSourceFactory]
-----------------------------------------
osgi.jdbc.driver.class = com.microsoft.sqlserver.jdbc.SQLServerDriver
osgi.jdbc.driver.name = Microsoft JDBC Driver for SQL Server
osgi.jdbc.driver.version = 9.4
service.bundleid = 282
service.id = 370
service.scope = singleton
Provided by :
Microsoft JDBC Driver for SQL Server (282)
My project blueprint containes the below:
I modified my blueprint.xml to use one of the other connections available in jdbc:ds-factories but i am seeing the below error complaining of missing requirements on install
<bean id="sqlComponent" class="org.apache.camel.component.sql.SqlComponent">
<property name="dataSource" ref="exampleSQLServerDataSource"/>
</bean>
<service id="c1SQLDataSource" interface="javax.sql.DataSource" ref="exampleSQLServerDataSource">
<service-properties>
<entry key="osgi.jndi.service.name" value="exSQLDataSource"/>
</service-properties>
</service>
<bean id="exampleSQLServerDataSource" factory-ref="sqlServerDataSourceFactory" factory-method="createDataSource">
<argument>
<props>
<prop key="databaseName">${ex.db.dbname}</prop>
<prop key="user">${ex.db.user}</prop>
<prop key="password">${ex.db.password}</prop>
<prop key="portNumber">${ex.db.port}</prop>
<prop key="serverName">${ex.db.host}</prop>
</props>
</argument>
</bean>
<reference id="sqlServerDataSourceFactory" interface="org.osgi.service.jdbc.DataSourceFactory" filter="(osgi.jdbc.driver.class=com.microsoft.sqlserver.jdbc.SQLServerDriver)(osgi.jdbc.driver.name=Microsoft JDBC Driver for SQL Server)(osgi.jdbc.driver.version=9.4)"/>
Seeing this error on install
karaf#root()> feature:install example-project
org.apache.felix.resolver.reason.ReasonException: Unable to resolve root: missing requirement [root] osgi.identity; osgi.identity=example-project; type=karaf.feature; version="[0.1.4.SNAPSHOT,0.1.4.SNAPSHOT]"; filter:="(&(osgi.identity=example-project)(type=karaf.feature)(version>=0.1.4.SNAPSHOT)(version<=0.1.4.SNAPSHOT))" [caused by: Unable to resolve example-project/0.1.4.SNAPSHOT: missing requirement [example-project/0.1.4.SNAPSHOT] osgi.identity; osgi.identity=com.example.example.project; type=osgi.bundle; version="[0.1.4.SNAPSHOT,0.1.4.SNAPSHOT]"; resolution:=mandatory [caused by: Unable to resolve com.example.example.project/0.1.4.SNAPSHOT: missing requirement [com.example.example.project/0.1.4.SNAPSHOT] osgi.service; effective:=active; filter:="(&(objectClass=org.osgi.service.jdbc.DataSourceFactory)(osgi.jdbc.driver.class=com.microsoft.sqlserver.jdbc.SQLServerDriver)(osgi.jdbc.driver.name=Microsoft JDBC Driver for SQL Server)(osgi.jdbc.driver.version=9.4))"]]
at org.apache.felix.resolver.Candidates$MissingRequirementError.toException(Candidates.java:1341)
at org.apache.felix.resolver.ResolverImpl.doResolve(ResolverImpl.java:433)
at org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:420)
at org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:374)
at org.apache.karaf.features.internal.region.SubsystemResolver.resolve(SubsystemResolver.java:257)
at org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:399)
at org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1069)
at org.apache.karaf.features.internal.service.FeaturesServiceImpl.lambda$doProvisionInThread$13(FeaturesServiceImpl.java:1004)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.felix.resolver.reason.ReasonException: Unable to resolve example-project/0.1.4.SNAPSHOT: missing requirement [example-project/0.1.4.SNAPSHOT] osgi.identity; osgi.identity=com.example.example.project; type=osgi.bundle; version="[0.1.4.SNAPSHOT,0.1.4.SNAPSHOT]"; resolution:=mandatory [caused by: Unable to resolve com.example.example.project/0.1.4.SNAPSHOT: missing requirement [com.example.example.project/0.1.4.SNAPSHOT] osgi.service; effective:=active; filter:="(&(objectClass=org.osgi.service.jdbc.DataSourceFactory)(osgi.jdbc.driver.class=com.microsoft.sqlserver.jdbc.SQLServerDriver)(osgi.jdbc.driver.name=Microsoft JDBC Driver for SQL Server)(osgi.jdbc.driver.version=9.4))"]
at org.apache.felix.resolver.Candidates$MissingRequirementError.toException(Candidates.java:1341)
... 12 more
Caused by: org.apache.felix.resolver.reason.ReasonException: Unable to resolve com.example.example.project/0.1.4.SNAPSHOT: missing requirement [com.example.example.project/0.1.4.SNAPSHOT] osgi.service; effective:=active; filter:="(&(objectClass=org.osgi.service.jdbc.DataSourceFactory)(osgi.jdbc.driver.class=com.microsoft.sqlserver.jdbc.SQLServerDriver)(osgi.jdbc.driver.name=Microsoft JDBC Driver for SQL Server)(osgi.jdbc.driver.version=9.4))"
at org.apache.felix.resolver.Candidates$MissingRequirementError.toException(Candidates.java:1341)
... 13 more
Error executing command: Unable to resolve root: missing requirement [root] osgi.identity; osgi.identity=example-project; type=karaf.feature; version="[0.1.4.SNAPSHOT,0.1.4.SNAPSHOT]"; filter:="(&(osgi.identity=example-project)(type=karaf.feature)(version>=0.1.4.SNAPSHOT)(version<=0.1.4.SNAPSHOT))" [caused by: Unable to resolve example-project/0.1.4.SNAPSHOT: missing requirement [example-project/0.1.4.SNAPSHOT] osgi.identity; osgi.identity=com.example.example.project; type=osgi.bundle; version="[0.1.4.SNAPSHOT,0.1.4.SNAPSHOT]"; resolution:=mandatory [caused by: Unable to resolve com.example.example.project/0.1.4.SNAPSHOT: missing requirement [com.example.example.project/0.1.4.SNAPSHOT] osgi.service; effective:=active; filter:="(&(objectClass=org.osgi.service.jdbc.DataSourceFactory)(osgi.jdbc.driver.class=com.microsoft.sqlserver.jdbc.SQLServerDriver)(osgi.jdbc.driver.name=Microsoft JDBC Driver for SQL Server)(osgi.jdbc.driver.version=9.4))"]]
POM
The maven-bundle-plugin definition from my pom.xml file
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Import-Package>
javax.jms;version="[2.0,3)",
org.xmlsoap.schemas.soap.envelope,
com.example.example.services.amqp.*,
*
</Import-Package>
</instructions>
</configuration>
</plugin>
If I am reading the error message correctly, your Karaf is for some reason missing SQLServerDataSourceFactory service that should be provided by sqlserver activator when the bundle starts.
If you're upgrading from Apache Karaf version 4.2.x to 4.3.6 it could be that the version of the mssql-jdbc/9.4.0.jre8 bundle which the pax-jdbc-mssql feature installs could be incompatible with Java 11.
Apache Karaf 4.3.x supports JDK 11+ where as 4.2.x is for JDK 8, 9 and 10. There's handy table on Apache karafs downloads page that shows which version supports what. Mail about JDK 8 support with 4.3.x
Since the feature pax-jdbc-mssql only contains mssql-jdbc bundle and pax-jdbc-spec feature you could try to install them separately using jre11 version of mssql-jdbc bundle.
Example:
feature:install pax-jdbc-spec
bundle:install mvn:com.microsoft.sqlserver/mssql-jdbc/9.4.1.jre11
Since the version 9.4.1 has some vulnerabilities you could also try to upgrade to the newer 10.2.0.jre11 version if possible.
Related
I have a system with JBoss EAP 6.3, and using MSSQL. I have the 'sqljdbc41.jar' set up and the datasource connection pool is configured in standalone.xml:
<datasource jndi-name="java:jboss/datasources/Foo" pool-name="Foo" enabled="true" use-ccm="false" connectable="true" statistics-enabled="true">
<connection-url>jdbc:sqlserver://<hostname>:1433;DatabaseName=<DB-Name></connection-url>
<driver-class>com.microsoft.sqlserver.jdbc.SQLServerDriver</driver-class>
<driver>sqlserver</driver>
<pool>
<min-pool-size>1</min-pool-size>
<max-pool-size>100</max-pool-size>
<prefill>true</prefill>
<use-strict-min>false</use-strict-min>
<flush-strategy>IdleConnections</flush-strategy>
<allow-multiple-users>true</allow-multiple-users>
</pool>
<security>
<user-name>user1</user-name>
<password>user1</password>
</security>
<timeout>
<blocking-timeout-millis>5000</blocking-timeout-millis>
<idle-timeout-minutes>4</idle-timeout-minutes>
</timeout>
<statement>
<share-prepared-statements>false</share-prepared-statements>
</statement>
</datasource>
The db queries are all running fine, but we are missing metrics around connection pool in our jboss console. Have tried to play around with the configuration but not sure if that's the right path. I haven't set up any specific jmx beans, maybe that's the issue?
Have you enabled the DataSource statistics? In EAP 6.3 and later, DataSource statistics must be explicitly enabled. They are disabled by default to minimize performance impact
my Quartz batchjob application is throwing the below error:
org.hibernate.engine.jndi.JndiException: Unable to lookup JNDI name [java:comp/websphere/ExtendedJTATransaction
below is my configuration:
<bean id="sessionFactoryTxt"
class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<property name="dataSource"><ref bean="jndiDatasourceTxt" /></property>
<property name="mappingLocations">
<list>
<value>classpath:com/nec/asia/epid/config/hibernate/*.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">${hibernate.dialect}</prop>
<prop key="hibernate.jdbc.batch_size">${hibernate.jdbc.batch_size}</prop>
<prop key="hibernate.cache.use_second_level_cache">${hibernate.cache.use_second_level_cache}</prop>
<prop key="hibernate.bytecode.use_reflection_optimizer">${hibernate.bytecode.use_reflection_optimizer}</prop>
<prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
<prop key="hibernate.format_sql">${hibernate.format_sql}</prop>
<prop key="hibernate.use_sql_comments">${hibernate.use_sql_comments}</prop>
<prop key="hibernate.connection.isolation">3</prop>
<prop key="hibernate.current_session_context_class">jta</prop>
<prop key="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</prop>
<prop key="hibernate.transaction.manager_lookup_class">com.atomikos.icatch.jta.hibernate3.TransactionManagerLookup</prop>
<prop key="hibernate.cache.provider_class">org.hibernate.cache.OSCacheProvider</prop>
<prop key="hibernate.validator.apply_to_ddl">false</prop>
<prop key="hibernate.validator.autoregister_listeners">false</prop>
</props>
</property>
<property name="jtaTransactionManager" ref="transactionManager"></property>
The above error is happening only when I use WebSphere (XA DataSource), there is no problem when using Jboss.
Below is my dev. environment:
1. WebSphere + SQL Server (XA DataSource) -> The problem above is happening
2. WebSphere + Oracle (XA DataSource) -> The problem above is happening
3. JBoss + SQL Server (XA DataSource) -> My quartz app is working without any error
4. JBoss + Oracle (XA DataSource) -> My quartz app is working without any error
NOTE:
The problem happens only when using WebSphere (There is no problem when using JBoss), Please help!!!
Below is the complete stacktrace:
at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:112)
at org.quartz.core.JobRunShell.run(JobRunShell.java:223)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549)
Caused by:
com.nec.asia.epid.common.dataAccess.exception.DaoException: org.hibernate.engine.jndi.JndiException: Unable to lookup JNDI name [java:comp/websphere/ExtendedJTATransaction]
at com.nec.asia.epid.comp.repo.biometric.dataAccess.impl.RepoBiometricFrTempDaoHibernateImpl.load(RepoBiometricFrTempDaoHibernateImpl.java:32)
at com.nec.asia.epid.comp.repo.biometric.dataAccess.impl.RepoBiometricFrTempDaoHibernateImpl.load(RepoBiometricFrTempDaoHibernateImpl.java:13)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:45)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:599)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:98)
at org.springframework.transaction.interceptor.TransactionAspectSupport$1.doInTransaction(TransactionAspectSupport.java:285)
at org.springframework.transaction.jta.WebSphereUowTransactionManager$UOWActionAdapter.run(WebSphereUowTransactionManager.java:347)
at com.ibm.ws.uow.UOWManagerImpl.runUnderCurrentUOW(UOWManagerImpl.java:1341)
at com.ibm.ws.uow.UOWManagerImpl.runUnderUOW(UOWManagerImpl.java:634)
at org.springframework.transaction.jta.WebSphereUowTransactionManager.execute(WebSphereUowTransactionManager.java:290)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:279)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
at $Proxy510.load(Unknown Source)
at com.nec.asia.epid.comp.repo.biometric.service.impl.RepoBiometricFrTempServiceImpl.load(RepoBiometricFrTempServiceImpl.java:37)
... 42 more
Caused by:
org.hibernate.engine.jndi.JndiException: Unable to lookup JNDI name [java:comp/websphere/ExtendedJTATransaction]
at org.hibernate.engine.jndi.internal.JndiServiceImpl.locate(JndiServiceImpl.java:117)
at org.hibernate.engine.transaction.jta.platform.internal.WebSphereExtendedJtaPlatform$TransactionManagerAdapter$TransactionAdapter.(WebSphereExtendedJtaPlatform.java:155)
at org.hibernate.engine.transaction.jta.platform.internal.WebSphereExtendedJtaPlatform$TransactionManagerAdapter$TransactionAdapter.(WebSphereExtendedJtaPlatform.java:151)
at org.hibernate.engine.transaction.jta.platform.internal.WebSphereExtendedJtaPlatform$TransactionManagerAdapter.getTransaction(WebSphereExtendedJtaPlatform.java:123)
at org.hibernate.engine.transaction.jta.platform.internal.WebSphereExtendedJtaPlatform$TransactionManagerAdapter.getStatus(WebSphereExtendedJtaPlatform.java:118)
at org.hibernate.engine.transaction.internal.jta.JtaStatusHelper.getStatus(JtaStatusHelper.java:76)
at org.hibernate.engine.transaction.internal.jta.JtaStatusHelper.isActive(JtaStatusHelper.java:118)
at org.hibernate.engine.transaction.internal.jta.JtaTransaction.getJoinStatus(JtaTransaction.java:276)
at org.hibernate.engine.transaction.internal.TransactionCoordinatorImpl.attemptToRegisterJtaSync(TransactionCoordinatorImpl.java:231)
at org.hibernate.engine.transaction.internal.TransactionCoordinatorImpl.pulse(TransactionCoordinatorImpl.java:289)
at org.hibernate.internal.SessionImpl.pulseTransactionCoordinator(SessionImpl.java:2162)
at org.hibernate.internal.SessionImpl.checkTransactionSynchStatus(SessionImpl.java:2156)
at org.hibernate.internal.SessionImpl.createCriteria(SessionImpl.java:1606)
at com.nec.asia.epid.comp.repo.biometric.dataAccess.impl.RepoBiometricFrTempDaoHibernateImpl.load(RepoBiometricFrTempDaoHibernateImpl.java:29)
... 62 more
Caused by:
javax.naming.ConfigurationException: A JNDI operation on a "java:" name cannot be completed because the server runtime is not able to associate the operation's thread with any J2EE application component. This condition can occur when the JNDI client using the "java:" name is not executed on the thread of a server application request. Make sure that a J2EE application does not execute JNDI operations on "java:" names within static code blocks or in threads created by that J2EE application. Such code does not necessarily run on the thread of a server application request and therefore is not supported by JNDI operations on "java:" names. [Root exception is javax.naming.NameNotFoundException: Name comp/websphere not found in context "java:".]
at com.ibm.ws.naming.java.javaURLContextImpl.throwConfigurationExceptionWithDefaultJavaNS(javaURLContextImpl.java:428)
at com.ibm.ws.naming.java.javaURLContextImpl.lookup(javaURLContextImpl.java:399)
at com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:221)
at javax.naming.InitialContext.lookup(Unknown Source)
at org.hibernate.engine.jndi.internal.JndiServiceImpl.locate(JndiServiceImpl.java:114)
... 75 more
Caused by:
javax.naming.NameNotFoundException: Name comp/websphere not found in context "java:".
at com.ibm.ws.naming.ipbase.NameSpace.getParentCtxInternal(NameSpace.java:1837)
at com.ibm.ws.naming.ipbase.NameSpace.lookupInternal(NameSpace.java:1166)
at com.ibm.ws.naming.ipbase.NameSpace.lookup(NameSpace.java:1095)
at com.ibm.ws.naming.urlbase.UrlContextImpl.lookup(UrlContextImpl.java:1235)
at com.ibm.ws.naming.java.javaURLContextImpl.lookup(javaURLContextImpl.java:395)
... 78 more
I am new to JBoss EAP and using 6.4 version . Earlier I have been using Tomcat 7.39. I like to shift from tomcat to JBOSS EAP 6.4. From some posts in stack overflow and JBOSS EAP , I some how configure MS SQL 2008 in JBOSS EAP but it is not working .
Standalone.xml File
<subsystem xmlns="urn:jboss:domain:datasources:1.2">
<datasources>
<datasource jndi-name="java:jboss/datasources/TMS" pool-name="TMS" enabled="true" use-java-context="true">
<connection-url>jdbc:sqlserver://localhost:1433;databaseName=TMS;integratedSecurity=false;</connection-url>
<driver>sqlserver</driver>
<security>
<user-name>sa</user-name>
<password>1234</password>
</security>
</datasource>
<drivers>
<driver name="sqlserver" module="com.microsoft.sqlserver">
<xa-datasource-class>com.microsoft.sqlserver.jdbc.SQLServerXADataSource</xa-datasource-class>
</driver>
</drivers>
</datasources>
</subsystem>
Earlier as I do not have any pool-name , I have deleted this attribute from datasource tag. Now I have just kept the pool name as database name though I do not have any pool name yet. Should I have to create pool-name and how could I do that ?
I Created (com\microsoft\sqlserver\main) this folder structure in *EAP_HOME\modules* and Then there I kept sqljdbc4.jar and module.xml. I am using windows 7, 32 bit machine. Below is the code snippet of module.xml:-
<module xmlns="urn:jboss:module:1.1" name="com.microsoft.sqlserver">
<resources>
<resource-root path="sqljdbc4.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
And I am getting this error ERROR com.microsoft.sqlserver.jdbc.SQLServerDriver from [Module "deployment.TSM_UI.war:main" from Service Module Loader]
I am thinking that it might be due to my pool name.Any suggestion. Thanks in Advance
The Error-Message doesn't look complete. I guess it is "ERROR ClassNotFoundEcxeption: Could not load class com.microsoft.sqlserver.jdbc.SQLServerDriver from [Module "deployment.TSM_UI.war:main" from Service Module Loader]" ?
Then you try to load the driver directly from within your deployment, but you should use a JNDI-lookup to get the connection from the datasource you created.
Search your deployment (TSM_UI.war) whether you have any references to com.microsoft.sqlserver.jdbc.SQLServerDriver within your deployment and remove it.
I looked over the Internet but I couldn't find any easy tutorials or docs explaining the problem.
I want to connect my JBoss 7.1.1 Final to Oracle Database. I am using Oracle Database 11g Express Edition on 64bit Windows.
The question is what should I do to connect my jboss to Oracle DB?
Check this answer jboss 7 oracle datasource configuration
In short, you have to declare a jboss module for your oracle driver.
Then, you create your datasource in standalone-xxx.xml and add the reference to the driver.
Finally, you can use this datasource in any persistence.xml by using the jndi-name declared in the datasource.
All of this is explained in the url provided.
Good luck!
You can create JNDI in Jboss 7.1.1 as below and configure mybatis to use this JNDI. make sure you have oracle driver in Modules at com.oracle.ojdbc localtion.
<subsystem xmlns="urn:jboss:domain:datasources:1.0">
<datasources>
<datasource jta="true" jndi-name="java:/jdbc/test" pool-name="test" enabled="true" use-java-context="true" use-ccm="true">
<connection-url>jdbc:oracle:thin:#localhost:1521:testDB</connection-url>
<driver>oracle</driver>
<pool>
<min-pool-size>2</min-pool-size>
<max-pool-size>100</max-pool-size>
<prefill>false</prefill>
</pool>
<security>
<user-name>username</user-name>
<password>password</password>
</security>
<validation>
<validate-on-match>false</validate-on-match>
<background-validation>false</background-validation>
</validation>
</datasource>
<drivers>
<driver name="oracle" module="com.oracle.ojdbc">
<driver-class>oracle.jdbc.OracleDriver</driver-class>
<xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
</driver>
</drivers>
</datasources>
</subsystem>
I am attempting to set up multiple datasources in my standalone.xml file. I have a connection to DB2 up and working fine. I am having trouble getting the SQL Server connection to work.
From standalone.xml:
<datasource jndi-name="java:/jdbc/syteline" pool-name="SYTELINEMSSDS" enabled="true" use-java-context="true" spy="true">
<connection-url>jdbc:sqlserver://SLSQL:1433;databaseName=npsl_pilot_app;</connection-url>
<driver-class>com.microsoft.sqlserver.jdbc.SQLServerDriver</driver-class>
<driver>sqljdbc4.jar</driver>
<pool>
<min-pool-size>5</min-pool-size>
<max-pool-size>10</max-pool-size>
<prefill>true</prefill>
<use-strict-min>false</use-strict-min>
</pool>
<security>
<user-name>myUser</user-name>
<password>myPass</password>
</security>
<timeout>
<idle-timeout-minutes>15</idle-timeout-minutes>
</timeout>
</datasource>
I have the sqljdbc4.jar deployed in my standalone\deployments directory and it is deploying. I have tested the connection URL and credentials by copy/pasting it into my application and creating a JDBC connection within my code. That connection works properly. Setting the connection up as a datasource in standalone.xml gives me the following:
15:20:00,326 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-15) JBAS010400: Bound data source [java:/jdbc/syteline]
15:20:00,684 WARN [org.jboss.jca.core.connectionmanager.pool.strategy.OnePool] (JCA PoolFiller) IJ000610: Unable to fill pool: javax.resource.ResourceException: Could not create connection
at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:277)
at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:235)
at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.createConnectionEventListener(SemaphoreArrayListManagedConnectionPool.java:758) [ironjacamar-core-impl-1.0.7.Final.jar:1.0.7.Final]
at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.fillToMin(SemaphoreArrayListManagedConnectionPool.java:703) [ironjacamar-core-impl-1.0.7.Final.jar:1.0.7.Final]
at org.jboss.jca.core.connectionmanager.pool.mcp.PoolFiller.run(PoolFiller.java:97) [ironjacamar-core-impl-1.0.7.Final.jar:1.0.7.Final]
at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_23]
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user 'dna'. ClientConnectionId:4e4e0e7f-3e23-4a13-9c49-37e33aeb4613
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:216)
at com.microsoft.sqlserver.jdbc.TDSTokenHandler.onEOF(tdsparser.java:254)
at com.microsoft.sqlserver.jdbc.TDSParser.parse(tdsparser.java:84)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.sendLogon(SQLServerConnection.java:2908)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.logon(SQLServerConnection.java:2234)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.access$000(SQLServerConnection.java:41)
at com.microsoft.sqlserver.jdbc.SQLServerConnection$LogonCommand.doExecute(SQLServerConnection.java:2220)
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:5696)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1715)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:1326)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:991)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:827)
at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:1012)
at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:249)
... 5 more
15:20:01,385 WARN [org.jboss.as.server.deployment] (MSC service thread 1-14) Class Path entry jcifs.jar in "/C:/jbossdir/jboss7/standalone/deployments/speed2.war/WEB-INF/lib/jtds-1.2.5.jar" does not point to a valid jar for a Class-Path reference.
I have not been able to figure out the Login Failed message.
Is the JBoss server on the same computer as the test application that can connect properly?
Just as a followup, I gave up on the Microsoft driver and used JTDS instead. Works fine.