User: mulder  
  Date: 00/09/06 08:06:43

  Added:       minerva/examples ejb-jar.xml.txt index.html jboss.conf
                        jboss.jcml jboss.properties jboss.xml.txt
  Log:
  Add a complete example for Minerva.
  
  Revision  Changes    Path
  1.1                  jbossweb/minerva/examples/ejb-jar.xml.txt
  
  Index: ejb-jar.xml.txt
  ===================================================================
  <?xml version="1.0" encoding="Cp1252"?>
  
  <ejb-jar>
       <description>EMAX Researcher Desktop Server</description>
       <display-name>ERD</display-name>
       <enterprise-beans>
         <session>
         <ejb-name>MySession</ejb-name>
         <home>com.test.MySessionHome</home>
         <remote>com.test.MySession</remote>
         <ejb-class>com.test.MySessionBean</ejb-class>
         <session-type>Stateless</session-type>
         <transaction-type>Container</transaction-type>
         <env-entry>
           <env-entry-name>Variable</env-entry-name>
           <env-entry-type>java.lang.String</env-entry-type>
           <env-entry-value>stuff</env-entry-value>
         </env-entry>
         <resource-ref>
           <res-ref-name>jdbc/MySessionDB</res-ref-name>
           <res-type>javax.sql.DataSource</res-type>
           <res-auth>Container</res-auth>
         </resource-ref>
         </session>
       </enterprise-beans>
       <assembly-descriptor>
         <container-transaction>
         <description>Requisition Transaction Properties</description>
         <method>
           <ejb-name>MySession</ejb-name>
           <method-name>*</method-name>
         </method>
         <trans-attribute>Required</trans-attribute>
         </container-transaction>
       </assembly-descriptor>
     </ejb-jar>
  
  
  
  1.1                  jbossweb/minerva/examples/index.html
  
  Index: index.html
  ===================================================================
  <HTML>
    <HEAD>
      <TITLE>Minerva &amp; jBoss Complete Example</TITLE>
    </HEAD>
    <BODY>
      <H1>Minerva &amp; jBoss Complete Example</H1>
      <P>Here's an example of a jBoss and EJB configuration using Minerva.  It
        uses an Oracle database, though certain names and passwords have been
        changed to protect the innocent.</P>
      <P><B>jBoss Configuration Files</B></P>
      <P>These files configure the entire jBoss server.  Though this example uses
        only one pool, you can add more pools (for the same or other databases
        and DBMSs) simply by repeating the blocks in jboss.conf and jboss.jcml
        and changing the pool name and configuration.  One bean may use multiple
        pools, though CMP beans can only have the container use one pool per bean
        for the work it does.</P>
      <UL>
        <LI><A HREF="jboss.conf">jboss.conf</A> - the minerva MBean is buried
                in there toward the end.</LI>
        <LI><A HREF="jboss.jcml">jboss.jcml</A> - remember, you don't need to
          add <I>all</I> these configuration parameters, just the ones you
          want to override.  The server will update this file with all the
          parameters and their default values once you start it successfully.</LI>
        <LI><A HREF="jboss.properties">jboss.properties</A> - you only need to
          change the "jdbc.drivers=" line here</LI>
      </UL>
  
      <P><B>EJB Configuration Files</B></P>
      <P>These files go in the JAR with your EJB code.
      <UL>
        <LI><A HREF="ejb-jar.xml.txt">ejb-jar.xml</A> - this is common to all EJB
                1.1 servers.</LI>
        <LI><A HREF="jboss.xml.txt">jboss.xml</A> - this is specific to jBoss.
      </UL>
  
      <P><B>EJB Implementation</B></P>
      <P>The code to access the pool uses the "res-ref-name" specified in the
        ejb-jar.xml file.  In this example, it was "jdbc/MySessionDB", and of
        course you need the usual "java:comp/env", so the resulting code looks
        like:</P>
  <PRE>
  try {
        InitialContext ctx = new InitialContext();
        DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/MySessionDB");
        Connection con = ds.getConnection();
        PreparedStatement ps = con.prepareStatement(sql);
        ...
  } catch(NamingException e) {
        ...
  } catch(SQLException e) {
        ...
  }
  </PRE>
  
        <P><B>Troubleshooting</B></P>
        <P>The most common problem right now is that the Minerva pools are
          sometimes loaded after the auto-deployer, so your beans try to deploy
          before the pools exist.  In that case, they tend to get naming
          exceptions and fail to deploy.  Look for an output line like:<BR>
          <CODE>[XADataSource] XA Connection pool foo bound to xa.foo</CODE><BR>
          and that is when the pool has started.</P>
         <P>If this is the case for you, there's little you can do.  Sometimes if
           you try again it will work, since it seems to be dependent in some way
           on your configuration which may change slightly over time.  This should
           be fixed by the JMX update which will be forthcoming very soon.</P>
         <P>If you're a real hacker (<I>warning!</I>) and desperate to get this to
           work right now, you can find the last property set on
           the pool in jboss.jcml, locate the setter for that property in
           org.jboss.jdbc.XADataSourceLoader.java, and move the line for
           <CODE>initializePool();</CODE> from <CODE>startService</CODE> to
           the end of that setter and recompile.  Don't say I didn't warn you.</P>
    </BODY>
  </HTML>
  
  
  
  1.1                  jbossweb/minerva/examples/jboss.conf
  
  Index: jboss.conf
  ===================================================================
  <MLET CODE = "org.jboss.logging.Logger" ARCHIVE="jboss.jar" CODEBASE="../lib/ext/">
  </MLET>
  
  
  <MLET CODE = "org.jboss.logging.ConsoleLogging" ARCHIVE="jboss.jar" 
CODEBASE="../lib/ext/">
     <ARG TYPE="java.lang.String" VALUE="Information,Debug,Warning,Error">
     <ARG TYPE="java.lang.String" VALUE="[{2}] {4}">
  </MLET>
  
  <MLET CODE = "org.jboss.util.ClassPathExtension" ARCHIVE="jboss.jar" 
CODEBASE="../lib/ext/">
     <ARG TYPE="java.lang.String" VALUE="../../log/">
  </MLET>
  
  <MLET CODE = "org.jboss.util.ClassPathExtension" ARCHIVE="jboss.jar" 
CODEBASE="../lib/ext/">
     <ARG TYPE="java.lang.String" VALUE="../../tmp/">
  </MLET>
  
  <MLET CODE = "org.jboss.util.ClassPathExtension" ARCHIVE="jboss.jar" 
CODEBASE="../lib/ext/">
     <ARG TYPE="java.lang.String" VALUE="../../db/">
  </MLET>
  
  <MLET CODE = "org.jboss.util.Info" ARCHIVE="jboss.jar" CODEBASE="../lib/ext/">
  </MLET>
  
  <MLET CODE = "org.jboss.util.ClassPathExtension" ARCHIVE="jboss.jar" 
CODEBASE="../lib/ext/">
     <ARG TYPE="java.lang.String" VALUE="./">
  </MLET>
  
  <MLET CODE = "org.jboss.jdbc.JdbcProvider" ARCHIVE="jboss.jar,idb.jar,hsql.jar" 
CODEBASE="../lib/ext/">
  </MLET>
  
  <MLET CODE = "org.jboss.web.WebService" ARCHIVE="jboss.jar,dynaserver.jar" 
CODEBASE="../lib/ext/">
  </MLET>
  
  <MLET CODE = "org.jboss.naming.NamingService" ARCHIVE="jnpserver.jar" 
CODEBASE="../lib/ext/">
  </MLET>
  
  <MLET CODE = "org.jboss.tm.TransactionManagerService" 
ARCHIVE="jboss.jar,jta-spec1_0_1.jar" CODEBASE="../lib/ext/">
  </MLET>
  
  <MLET CODE = "org.jboss.security.SimpleRealmMappingService" ARCHIVE="jboss.jar" 
CODEBASE="../lib/ext/">
  </MLET>
  
  <MLET CODE = "org.jboss.security.EJBSecurityManagerService" ARCHIVE="jboss.jar" 
CODEBASE="../lib/ext/">
  </MLET>
  
  <MLET CODE="org.jboss.jdbc.XADataSourceLoader" ARCHIVE="jboss.jar" 
CODEBASE="../lib/ext/">
      <ARG TYPE="java.lang.String" VALUE="OracleDB">
      <ARG TYPE="java.lang.String" VALUE="org.jboss.minerva.xa.XADataSourceImpl">
  </MLET>
  
  <MLET CODE = "org.jboss.ejb.ContainerFactory" 
ARCHIVE="jboss.jar,ejb.jar,jnp-client.jar,ejxeditor.jar,ejxjboss.jar" 
CODEBASE="../lib/ext/">
  </MLET>
  
  <MLET CODE = "org.jboss.ejb.AutoDeployer" ARCHIVE="jboss.jar">
    <ARG TYPE="java.lang.String" VALUE="../deploy/">
  </MLET>
  
  <MLET CODE = "org.jboss.jmx.server.JMXAdaptorService" ARCHIVE="jboss.jar" 
CODEBASE="../lib/ext/">
  </MLET>
  
  <MLET CODE = "com.sun.jdmk.comm.HtmlAdaptorServer" ARCHIVE="jmxtools.jar" 
CODEBASE="../lib/ext/" NAME="Adaptor:name=html">
  </MLET>
  
  <MLET CODE = "org.jboss.configuration.ConfigurationService" 
ARCHIVE="jboss.jar,xml.jar" CODEBASE="../lib/ext/">
  </MLET>
  
  <!-- 
    --  Uncomment this to add Tomcat support.  Be sure to set your 'TOMCAT_HOME' 
    -- environment variable before starting JBoss.
    -- MLET CODE = "org.jboss.tomcat.TomcatService" ARCHIVE="jboss.jar" 
CODEBASE="../lib/ext/">
    -- /MLET>
    -->
  
  <!-- 
    -- Uncomment this to add SpyderMQ support.  Be sure to set your 'SPYDERMQ_HOME' 
    -- environment variable before starting JBoss.  You'll also need to copy the 
    -- spyderMQ.properties file from your SpyderMQ installation to you JBoss 
    -- installation conf dir.
    -- MLET CODE = "org.jboss.spydermq.SpyderMQService" ARCHIVE="jboss.jar" 
CODEBASE="../lib/ext/">
    -- /MLET>
    -->
  
  
  
  1.1                  jbossweb/minerva/examples/jboss.jcml
  
  Index: jboss.jcml
  ===================================================================
  <server>
       <mbean name="Adaptor:name=html">
         <attribute name="MaxActiveClientCount">10</attribute>
         <attribute name="Parser" />
         <attribute name="Port">8082</attribute>
       </mbean>
       <mbean name="DefaultDomain:service=MLet">
         <attribute name="LibraryDirectory">C:\home\jboss\dist\bin</attribute>
       </mbean>
       <mbean name="DefaultDomain:service=Logging,type=Console">
         <attribute name="Format">[{2}] {4}</attribute>
       </mbean>
       <mbean name="DefaultDomain:service=Webserver">
         <attribute name="Port">8083</attribute>
       </mbean>
       <mbean name="EJB:service=ContainerFactory">
         <attribute name="VerifyDeployments">true</attribute>
       </mbean>
       <mbean name="DefaultDomain:service=XADataSource,name=OracleDB">
         <attribute name="Properties"></attribute>
         <attribute 
name="URL">jdbc:oracle:thin:@oracleserver.domain.com:1521:instance</attribute>
         <attribute name="GCMinIdleTime">1200000</attribute>
         <attribute name="MaxSize">10</attribute>
         <attribute name="Password">password</attribute>
         <attribute name="ShrinkPercent">0.33</attribute>
         <attribute name="GCEnabled">false</attribute>
         <attribute name="TimestampUsed">false</attribute>
         <attribute name="Blocking">false</attribute>
         <attribute name="GCInterval">120000</attribute>
         <attribute name="JDBCUser">username</attribute>
         <attribute name="MinSize">0</attribute>
         <attribute name="ShrinkMinIdleTime">600000</attribute>
         <attribute name="ShrinkingEnabled">false</attribute>
         <attribute name="LoggingEnabled">true</attribute>
       </mbean>
     </server>
  
  
  1.1                  jbossweb/minerva/examples/jboss.properties
  
  Index: jboss.properties
  ===================================================================
  # System properties
  # These will be loaded and set by jBoss   
  java.rmi.server.useLocalHostName=true
  java.rmi.server.hostname=jbossserver.domain.com
  #java.rmi.server.codebase=http://localhost:8080/
     
  jdbc.drivers=oracle.jdbc.driver.OracleDriver
  
  
  
  1.1                  jbossweb/minerva/examples/jboss.xml.txt
  
  Index: jboss.xml.txt
  ===================================================================
  <?xml version="1.0" encoding="Cp1252"?>
  
  <jboss>
       <secure>true</secure>
       <container-configurations>
         <container-configuration 
configuration-class="org.jboss.ejb.deployment.StatelessSessionContainerConfiguration">
         <container-name>Default Stateless SessionBean</container-name>
         <call-logging>false</call-logging>
         
<container-invoker>org.jboss.ejb.plugins.jrmp13.server.JRMPContainerInvoker</container-invoker>
         
<instance-pool>org.jboss.ejb.plugins.StatelessSessionInstancePool</instance-pool>
         <instance-cache></instance-cache>
         <persistence-manager></persistence-manager>
         <transaction-manager>org.jboss.tm.TxManager</transaction-manager>
         <container-invoker-conf>
           <Optimized>false</Optimized>
         </container-invoker-conf>
         <container-pool-conf>
           <MaximumSize>100</MaximumSize>
           <MinimumSize>10</MinimumSize>
         </container-pool-conf>
         </container-configuration>
       </container-configurations>
       <resource-managers>
         <resource-manager res-class="org.jboss.ejb.deployment.JDBCResource">
         <res-name>OracleDBResource</res-name>
         <res-jndi-name>xa.OracleDB</res-jndi-name>
         </resource-manager>
       </resource-managers>
       <enterprise-beans>
         <session>
         <ejb-name>MySession</ejb-name>
         <jndi-name>MySessionJNDIName</jndi-name>
         <configuration-name>Default Stateless SessionBean</configuration-name>
         <resource-ref>
           <res-ref-name>jdbc/MySessionDB</res-ref-name>
           <resource-name>OracleDBResource</resource-name>
         </resource-ref>
         </session>
       </enterprise-beans>
     </jboss>
  
  
  

Reply via email to