wood burning stoves 2.0*
The moose likes JBoss/WildFly and the fly likes JBoss 4.0 and MSSQL Server 2000 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "JBoss 4.0 and MSSQL Server 2000" Watch "JBoss 4.0 and MSSQL Server 2000" New topic
Author

JBoss 4.0 and MSSQL Server 2000

adrian mills
Ranch Hand

Joined: Dec 09, 2004
Posts: 63
Hi does anyone know how to configure Jboss 4.0 and MSSQL 2000 server.
Please if anyone has done it can he help me out..
I am new and would like to know all the steps involved in it.
Please inform me.
Thanks a lot
Adrian
Vicente Castrillo
Greenhorn

Joined: Feb 17, 2005
Posts: 4
Hi Adrian. In this link you have a very good explanation. I follow it to configure my app. http://www.oreillynet.com/cs/user/view/cs_msg/33739

I hope it will help u.
adrian mills
Ranch Hand

Joined: Dec 09, 2004
Posts: 63
Hi Vicente ,
Thanks for u r reply.I am trying to do according to the article and am getting the following error while deploying the bean.
Do you have any idea??

15:35:20,750 WARN [EJBDeployer] Verify failed; continuing
java.lang.StringIndexOutOfBoundsException: String index out of range: 0
at java.lang.String.charAt(String.java:444)
at org.jboss.mx.loading.RepositoryClassLoader.loadClassLocally(RepositoryClassLoader.java:167)
at org.jboss.mx.loading.UnifiedLoaderRepository3.loadClassFromClassLoader(UnifiedLoaderRepository3.java:265)
at org.jboss.mx.loading.LoadMgr3.beginLoadTask(LoadMgr3.java:270)
at org.jboss.mx.loading.RepositoryClassLoader.loadClassImpl(RepositoryClassLoader.java:463)
at org.jboss.mx.loading.RepositoryClassLoader.loadClass(RepositoryClassLoader.java:374)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at org.jboss.verifier.strategy.AbstractVerifier.hasPrimaryKeyReturnType(AbstractVerifier.java:750)
at org.jboss.verifier.strategy.EJBVerifier20.verifyBMPEntityBean(EJBVerifier20.java:2266)
at org.jboss.verifier.strategy.EJBVerifier20.checkBmpOrCmp2Entity(EJBVerifier20.java:171)
at org.jboss.verifier.strategy.EJBVerifier20.checkEntity(EJBVerifier20.java:137)
at org.jboss.verifier.BeanVerifier.verify(BeanVerifier.java:157)
at org.jboss.ejb.EJBDeployer.create(EJBDeployer.java:537)
at org.jboss.deployment.MainDeployer.create(MainDeployer.java:889)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:745)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:709)
at sun.reflect.GeneratedMethodAccessor30.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:119)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:131)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:242)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
at $Proxy8.deploy(Unknown Source)
at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:305)
at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:481)
at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java
at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:277)
at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:271)
at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:221)
at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:242)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:891)
at $Proxy0.start(Unknown Source)
at org.jboss.system.ServiceController.start(ServiceController.java:416)
at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:242)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
at $Proxy4.start(Unknown Source)
at org.jboss.deployment.SARDeployer.start(SARDeployer.java:261)
at org.jboss.deployment.MainDeployer.start(MainDeployer.java:935)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:746)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:709)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:693)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:119)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:131)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:242)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:642)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)
at $Proxy5.deploy(Unknown Source)
at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:396)
at org.jboss.system.server.ServerImpl.start(ServerImpl.java:293)
at org.jboss.Main.boot(Main.java:151)
at org.jboss.Main$1.run(Main.java:405)
at java.lang.Thread.run(Thread.java:534)
15:35:21,015 ERROR [MainDeployer] could not create deployment: file:/C:/jboss-4.0.0/server/default/deploy/Login.jar/
org.jboss.deployment.DeploymentException: Verification of Enterprise Beans failed, see above for error messages.
at org.jboss.ejb.EJBDeployer.create(EJBDeployer.java:553)
at org.jboss.deployment.MainDeployer.create(MainDeployer.java:889)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:745)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:709)
at sun.reflect.GeneratedMethodAccessor30.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)



HERE ARE MY jboss.xml,jaws.xml,ejb-jar.xml

JBOSS.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 3.0//EN" "http://www.jboss.org/j2ee/dtd/jboss_3_0.dtd">
<jboss>
<secure>false</secure>
<container-configurations/>
<resource-managers>
<resource-manager res-class="org.jboss.ejb.deployment.JDBCResource">
<res-name>MSSQLDS</res-name>
<res-jndi-name>java:/MSSQLDS</res-jndi-name>
</resource-manager>
</resource-managers>
<enterprise-beans>
<session>
<ejb-name>Login</ejb-name>
<jndi-name>Login</jndi-name>
</session>

<session>
<ejb-name>Signup</ejb-name>
<jndi-name>SignupEJB</jndi-name>
</session>

<entity>
<ejb-name>User</ejb-name>
<jndi-name>UserEJB</jndi-name>
</entity>

</enterprise-beans>
</jboss>


JAWS.xml

<?xml version="1.0"?>
<!DOCTYPE jaws PUBLIC "-//JBoss//DTD JAWS 3.0//EN" "http://www.jboss.org/j2ee/dtd/jaws_3_0.dtd">

<jaws>

<datasource>java:/MSSQLDS</datasource>
<type-mapping>MS SQLServer2000</type-mapping>
</jaws>


ejb-jar.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
<ejb-jar>
<enterprise-beans>
<session>
<ejb-name>Login</ejb-name>
<home>first.LoginHome</home>
<remote>first.Login</remote>
<ejb-class>first.LoginEJB</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>

<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>Login</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>


<session>
<ejb-name>Signup</ejb-name>
<home>first.SignupHome</home>
<remote>first.Signup</remote>
<ejb-class>first.SignupEJB</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>


<entity>
<ejb-name>User</ejb-name>
<home>first.UserHome</home>
<remote>first.User</remote>
<ejb-class>first.UserEJB</ejb-class>
<prim-key-class></prim-key-class>
<reentrant>False</reentrant>
<persistence-type>Bean</persistence-type>
</entity>

<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>Signup</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>User</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>

</assembly-descriptor>

</enterprise-beans>
</ejb-jar>
Hashim siddiqui
Greenhorn

Joined: Mar 15, 2004
Posts: 17
�MS SQL Server Database Configuration for JBoss 4.0
1

To configure JBoss 4.0 with MS SQL Server database, MS SQL Server driver classes are required in the Classpath.Copy MS SQL Server JDBC driver class jar files mssqlserver.jar, msbase.jar, msutil.jar to the server/default/lib dir.
2
To configure with non-xa MS SQL Server datasource copy /docs/examples/jca/mssql-ds.xml to /server/default/deploy dir.
To configure with MS SQL Server XA datasource copy /docs/examples/jca/mssql-xa-ds.xml to /server/default/deploy dir.
3
Modify mssql-ds.xml configuration file.
Driver Class and Connection URL settings for MS SQL Server JDBC Drivers
1.Driver Class: com.microsoft.jdbc.sqlserver.SQLServerDriver
2.Connection URL:jdbc:microsoft:sqlserver://localhost:1433;
3.DatabaseName=MyDatabase

To configure with XA JDBC driver for MS SQL Server modify the mssql-xa-ds.xml configuration file.
Driver Class: com.microsoft.jdbcx.sqlserver.SQLServerDataSource



4
The standardjaws.xml file is configured with Hypersonic database by default.
To configure JBoss server with MS SQL Server database modify /server/default/conf/standardjaws.xml configuration file.
Set <datasource> and <type-mapping> elements.
<jaws>
<datasource>java:/MSSQLDS</datasource
<type-mapping>MS SQLSERVER2000</type-mapping>
</jaws>

5
The standardjbosscmp-jdbc.xml configuration file is configured with Hypersonic database.
To configure JBoss server with MS SQL Server modify /server/default/conf/standardjbosscmp-jdbc.xml configuration file.
Set the <datasource> and <datasource-mapping> elements.
<jbosscmp-jdbc>
<defaults>
<datasource>java:/MSSQLDS</datasource>
<datasource-mapping>MS SQLSERVER2000</datasource-mapping>
</defaults>
</jbosscmp-jdbc>



6
Modify login-config.xml configuration file with MS SQL Server database settings.
Add the following <application-policy/> element to login-config.xml.
<application-policy name = "MSSQLDbRealm">
<authentication>
<login-module code = "org.jboss.resource.security.ConfiguredIdentityLoginModule" flag = "required"> <module-option name = "principal">sa</module-option>
<module-option name = "userName">sa</module-option>
<module-option name = "password"></module-option>
<module-option name ="managedConnectionFactoryName">
jboss.jca:service=LocalTxCM,name=MSSQLDS
</module-option>
</login-module>
</authentication>
</application-policy>

By modifying the
1.mssql-ds.xml
2.standardjaws.xml
3.standardjbosscmp-jdbc.xml
4.and login-config.xml
the JBoss 4.0 server is configured to be used with a MS SQL Server database.















Login Failed for User 'BanManProSQL', Not Associated with a trusted SQL Server Connection.
Is using SQL 2000, you might get the following error:
Microsoft OLE DB Provider for SQL Server error '80004005'
Login failed for user 'BanManProSQL'. Reason: Not associated with a trusted SQL Server connection.
/dbconnect.asp, line 19
This error occurs because by default SQL 2000 does not support SQL Server authentication and supports only Windows authentication. To overcome this limitation:
1.Enter SQL Enterprise Manager.
2.Find your server name in the tree on the left.
3.Right mouse click on the server name and select properties.
4.Click the Security folder. You should now see the screen below with "Windows Only" set as the default authentication.

5.Check SQL Server and Windows as the Authentication.

6.Click OK.
7.Click Yes to restart SQL.


Siddiqui,<br />Smart Solutions,<br />SCJP,SCJD,SCMAD
adrian mills
Ranch Hand

Joined: Dec 09, 2004
Posts: 63
Hi,
I am getting a table not found exception but on the database I have already created the table.

Here is my ejb-jar.xml
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise
JavaBeans 1.1//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">


<ejb-jar>
<enterprise-beans>
<entity>
<display-name>Create User Entity Bean</display-name>
<ejb-name>User</ejb-name>

<home>com.cygnet.beans.User.UserHome</home>
<remote>com.cygnet.beans.User.User</remote>
<ejb-class>com.cygnet.beans.User.UserBean</ejb-class>
<persistence-type>Bean</persistence-type>
<primkey-field>userid</primkey-field>
<prim-key-class>java.lang.Integer</prim-key-class>
<reentrant>False</reentrant>
<resource-ref>
<res-ref-name>jdbc/jbossdb</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</entity>
</enterprise-beans>
<assembly-descriptor>
<security-role>
<description> For creating a user
</description>
<role-name>everyone</role-name>
</security-role>

<method-permission>
<role-name>everyone</role-name>
<method>
<ejb-name>User</ejb-name>
<method-name>*</method-name>
</method>
</method-permission>
</assembly-descriptor>

</ejb-jar>

Here is my jboss.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 3.0//EN" "http://www.jboss.org/j2ee/dtd/jboss_3_0.dtd">
<jboss>


<reference-descriptor>
<resource-description>
<res-ref-name>jdbc/jbossdb</res-ref-name>
<jndi-name>java:/MSSQLDS</jndi-name>
</resource-description>
</reference-descriptor>

<enterprise-beans>
<entity>
<ejb-name>User</ejb-name>
<jndi-name>User</jndi-name>
</entity>
</enterprise-beans>
</jboss>

Here is my jaws.xml
<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE jbosscmp-jdbc PUBLIC
"-//JBoss//DTD JBOSSCMP-JDBC 3.0//EN"
"http://www.jboss.org/j2ee/dtd/jbosscmp-jdbc_3_0.dtd">

<!-- ===================================================================== -->
<!-- -->
<!-- Standard Jaws Configuration -->
<!-- -->
<!-- ===================================================================== -->

<!-- $Id: standardjaws.xml,v 1.30 2002/06/27 19:26:28 dsundstrom Exp $ -->


<jaws>
<datasource>java:/jbossdb</datasource>
<type-mapping>MS SQLSERVER2000</type-mapping>
<entity>
<ejb-name>User</ejb-name>
<table-name>users</table-name>
</entity>
</jaws>


Can anyone tell what the problem could be.
It gets the connection and gives the following error :--
17:13:16,281 INFO [STDOUT] SQLException in ejbCreatejava.sql.SQLException: Table not found: USERS in statement [Insert into users (userid,firstname,lastname,username,password) values(?,?,?,?,?) ]
17:13:16,343 INFO [CachedConnectionManager] Closing a connection for you. Please close them yourself: org.jboss.resource.adapter.jdbc.WrappedConnection@b125bd
java.lang.Exception: STACKTRACE
at org.jboss.resource.connectionmanager.CachedConnectionManager.registerConnection(CachedConnectionManager.java:319)
at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:477)
at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:838)
at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:102)
at com.cygnet.beans.User.UserBean.getConnection(UserBean.java:200)
at com.cygnet.beans.User.UserBean.ejbCreate(UserBean.java:165)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.ejb.plugins.BMPPersistenceManager.createEntity(BMPPersistenceManager.java:190)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.createEntity(CachedConnectionInterceptor.java:266)
at org.jboss.ejb.EntityContainer.createHome(EntityContainer.java:766)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JBoss 4.0 and MSSQL Server 2000