假如我的连接池的名称为mypool,数据源的名称为mysource

解决方案 »

  1.   

    安装配置Jboss完全篇(作者:中国软件 qingrun) 1、Jboss的配置安装 1.1、Jboss的下载 
    Jboss的下载地址为:http://www.jboss.org/。目前的最新版本是:Jboss2.2.1。建议你下载Jboss2.2.1和tomcat3.2.1集成的下载包,这样避免了单个下载后两者之间配置的问题。下载地址是:http://prdownloads.sourceforge.net/jboss/JBoss-2.2.1_Tomcat-3.2.1.zip 下载完成后,解压到一个目录,这个目录名为E:\program files\jb_tom(这个目录名是笔者自定的)。下面有如下子目录: E:\program files\jb_tom\jboss和E:\jb_tom\tomcat 注意:这里的目录稍微做了改动,建议你将TOMCAT_HOME加到CLASSPATH中,否则E:\program files\jb_tom\jboss里的run_with_tomcat.bat这个文件要做相应改动才能正常运行。 1.2、配置运行 
    在启动Jboss前应该先安装好JDK,建议安装JDK1.3以上的版本(目前最新的正式版本是JDK1.3.1),然后将系统的Classpath设置好。Jboss不要任何配置和修改,当然,最好将TOMCAT_HOME加到Classpath中,这样,E:\program files\jb_tom\jboss里的run_with_tomcat.bat这个文件前的TOMCAT_HOME就可以去掉了。 运行E:\program files\jb_tom\jboss里的run_with_tomcat.bat这个文件,这样,Tomcat端口在8080,Jboss为8083,运行http://localhost:8080/将出现tomcat首页,运行http://localhost:8083/将出现无错误的空白页。 2、 测试EJB 
    2.1、启动JBOSS: 
    方法么,这里就不多作描述了,因为前面已经写过了^&^。 2.2、下载并配置EJB例程 
    到http://www.wodejia.net/softdownload/java/interestejb.zip下载interestejb.zip,这就是我们用于测试的EJB例程。将压缩包解开,出现如下目录: interest/com interest/docs …… 将该目录下所有文件全部copy到jboss安装目录下的examples目录下,如果没有examples目录,就自己建立一个,结构如下: E:\ program files\jb_tom \jboss\examples\interest... 将文件E:\program files\jb_tom\jboss\examples\interest\interest.jar复制到:E:\program files\jb_tom\jboss\deploy下。 在Classpath中加入如下文件:e:\program files\jb_tom\tomcat\lib\servlet.jar;e:\program files\jb_tom\jboss\client\jboss-client.jar;e:\program files\jb_tom\jboss\client\jnp-client.jar;e:\program files\jb_tom\jboss\lib\ext\ejb.jar;e:\program files\jb_tom\jboss\examples\interest\interest-client.jar 为了测试Client通过servlet调用EJB,必须将: E:\program files\jb_tom\jboss\examples\interest下EJB.class和EJB.java复制到: E:\program files\jb_tom\tomcat\webapps\ROOT\WEB-INF\classes目录下 将目录E:\jb_tom\jboss\examples\interest\com以及此下的所有文件都复制到E:\program files\jb_tom\tomcat\webapps\ROOT\WEB-INF\classes下。 重新启动JBOSS_TOMCAT。 2.3、command下client测试运行: 
    command下,进入目录E:\ program files\jb_tom\jboss\examples\interest java InterestClient 将出现: Got context Got reference Interest on 1000 units, at 10% per period, compounded over 2 periods is: 210.00000000000023 Jboss窗口将出现: [Interest] Someone called `calculateCompoundInterest!` 2.4、web下client通过Servlet测试运行: 
    http://localhost:8080/servlet/EJB 将出现: Interest on 1000 units, at 10% per period, compounded over 2 periods is: 210.00000000000023 Jboss窗口将出现: [Interest] Someone called `calculateCompoundInterest!` 到此已经成功了。 注意:这里将JBoss-2.2.1_Tomcat-3.2.1.zip解压后复制到E:\program files\jb_tom目录下。 
      

  2.   

    楼上的是n年前的文档了,要配数据源就看jboss的QuickStart,sf上有下载
      

  3.   

    jboss的配置每个版本都有一些差别,比如3.0.0跟3.2.1,因此最好是去看帮助文档,以及它自带的xml文件的例子,那些书一般都跟不上变化的。
    另,ejb的数据源一般是在deploy下的mssql_wl-service.xml文件
        <mbean code="org.jboss.resource.connectionmanager.LocalTxConnectionManager" name="jboss.jca:service=LocalTxCM,name=MssqlWlDS2">
        <depends optional-attribute-name="ManagedConnectionFactoryName">
          <!--embedded mbean-->
          <mbean code="org.jboss.resource.connectionmanager.RARDeployment" name="jboss.jca:service=LocalTxDS,name=MssqlWlDS2">
            <attribute name="JndiName">SystemDataSource</attribute>
            <attribute name="ManagedConnectionFactoryProperties">
              <properties>
                    <config-property name="ConnectionURL" type="java.lang.String">jdbc:microsoft:sqlserver://localhost:1433;User=sa;Password= ;SelectMethod=cursor;DatabaseName=system</config-property>
                     <config-property name="DriverClass" type="java.lang.String">com.microsoft.jdbc.sqlserver.SQLServerDriver</config-property>
                <!--set these only if you want only default logins, not through JAAS -->
                      <config-property name="UserName" type="java.lang.String">sa</config-property>
                       <config-property name="Password" type="java.lang.String"></config-property>
              </properties>
            </attribute>
    <!--Below here are advanced properties -->
            <!--hack-->
            <depends optional-attribute-name="OldRarDeployment">jboss.jca:service=RARDeployment,name=JBoss LocalTransaction JDBC Wrapper</depends>
          </mbean>
        </depends>
        <depends optional-attribute-name="ManagedConnectionPool">
          <!--embedded mbean-->
          <mbean code="org.jboss.resource.connectionmanager.JBossManagedConnectionPool" name="jboss.jca:service=LocalTxPool,name=MssqlWlDS2">
            <attribute name="MinSize">0</attribute>
            <attribute name="MaxSize">20</attribute>
            <attribute name="BlockingTimeoutMillis">5000</attribute>
            <attribute name="IdleTimeoutMinutes">15</attribute>
            <attribute name="Criteria">ByContainer</attribute>
          </mbean>
        </depends>
        <depends optional-attribute-name="CachedConnectionManager">jboss.jca:service=CachedConnectionManager</depends>
        <depends optional-attribute-name="JaasSecurityManagerService">jboss.security:name=JaasSecurityManager</depends>
        <attribute name="TransactionManager">java:/TransactionManager</attribute>
        <!--make the rar deploy! hack till better deployment-->
        <depends>jboss.jca:service=RARDeployer</depends>
      </mbean>
    这是3.0.0的一个配置,3.2.1跟他有一点点区别,具体在哪里记不清了,自己照着它自带的例子找吧,不是很大,好像就一两个单词,至于每段的具体含义,我相信你应该看的明白。