smf/jboss.xml
<?xml version='1.0'?>
<!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
<service_bundle type='manifest' name='jboss:jboss'>
<service
name='application/jboss'
type='service'
version='1'>
<create_default_instance enabled='false' />
<single_instance />
<dependency name='fs'
grouping='require_all'
restart_on='none'
type='service'>
<service_fmri value='svc:/system/filesystem/local' />
</dependency>
<dependency name='net'
grouping='require_all'
restart_on='none'
type='service'>
<service_fmri value='svc:/network/loopback' />
</dependency>
<exec_method
type='method'
name='start'
exec='/lib/svc/method/svc-jboss start'
timeout_seconds='-1'>
</exec_method>
<exec_method
type='method'
name='stop'
exec='/lib/svc/method/svc-jboss stop'
timeout_seconds='60'>
</exec_method>
<exec_method
type='method'
name='restart'
exec='/lib/svc/method/svc-jboss restart'
timeout_seconds='60'>
</exec_method>
</service>
</service_bundle>
smf/svc-jboss
#!/sbin/sh
# nginx
. /lib/svc/share/smf_include.sh
#PIDFILE=/var/run/nginx.pid
prog1=/vn/system/jboss/bin/start.sh
prog2=/vn/system/jboss/bin/shutdown.sh
#conf=/etc/vn/nginx/conf/nginx.conf
#lockdir=/var/lock/nginx
#tmpdir=/tmp/vn/nginx
echo "Start script..."
case "$1" in
start)
/vn/system/jboss/bin/run.sh -c all -b `hostname` >/dev/null 2> /dev/null &
exit 0
;;
stop)
${prog2} -S -s `hostname` &
#pkill java
exit 0
;;
restart)
stop
sleep 35
#pkill java
start
exit 0
;;
*)
echo "Usage: `basename $0` {start | stop | restart }"
exit 64
;;
esac
mysql-ds.xml
<?xml version="1.0" encoding="UTF-8"?>
<!-- $Id: mysql-ds.xml 71535 2008-04-01 07:05:03Z adrian@jboss.org $ -->
<!-- Datasource config for MySQL using 3.0.9 available from:
http://www.mysql.com/downloads/api-jdbc-stable.html
-->
<datasources>
<local-tx-datasource>
<jndi-name>jdbc/jccrmPool</jndi-name>
<connection-url>jdbc:mysql:loadbalance://mysqld0:3306,mysqld1:3306,mysqld2:3306,mysqld3:3306/jccrm?failOverReadOnly=false&loadBalanceStrategy=bestResponseTime&autoReconnectForPools=true&connectTimeout=1000&useUnicode=true&characterEncoding=UTF-8&noAccessToProcedureBodies=true</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<user-name>root</user-name>
<password></password>
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>
<!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
<metadata>
<type-mapping>mySQL</type-mapping>
</metadata>
</local-tx-datasource>
<local-tx-datasource>
<jndi-name>jdbc/testPool</jndi-name>
<connection-url>jdbc:mysql:loadbalance://mysqld0:3306,mysqld1:3306,mysqld2:3306,mysqld3:3306/?failOverReadOnly=false&loadBalanceStrategy=bestResponseTime&autoReconnectForPools=true&connectTimeout=1000&useUnicode=true&characterEncoding=UTF-8&noAccessToProcedureBodies=true</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<user-name>root</user-name>
<password></password>
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>
<!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
<metadata>
<type-mapping>mySQL</type-mapping>
</metadata>
</local-tx-datasource>
</datasources>
Проверка JDBC
index.jsp
<%@page contentType="text/html"
import="java.util.*,javax.naming.*,javax.sql.DataSource,java.sql.*"
%>
<%
DataSource ds = null;
Connection con = null;
PreparedStatement pr = null;
InitialContext ic;
try {
ic = new InitialContext();
ds = (DataSource)ic.lookup( "java:jdbc/testPool" );
con = ds.getConnection();
pr = con.prepareStatement("SELECT id,k,c,pad FROM sbtest.sbtest limit 1");
//pr = con.prepareStatement("SELECT User FROM mysql.user limit 5");
ResultSet rs = pr.executeQuery();
while (rs.next()) {
out.println("<br> " +rs.getString("id") + " | " + rs.getString("k") + " | " + rs.getString("c") + " | " + rs.getString("pad"));
//out.println("<br> " +rs.getString("User") );
}
rs.close();
pr.close();
}catch(Exception e){
out.println("Exception thrown " +e);
}finally{
if(con != null){
con.close();
}
}
%>
mkwar
#!/bin/sh
rm jdbc.war
zip jdbc.zip index.jsp
mv jdbc.zip jdbc.war
cp jdbc.war /pub/zones/java-back1/root/etc/vn/jboss/server/all/farm/
Jboss & Solaris тюнинг
- http://www.mastertheboss.com/jboss-application-server/113-jboss-performance-tuning-1.html
- http://www.mastertheboss.com/jboss-howto/47-jboss-jmx/92-jboss-monitor-snapshot.html
- http://www.mastertheboss.com/jboss-howto/47-jboss-jmx/91-jboss-monitor.html
- http://www.sun.com/bigadmin/features/articles/jboss_sf_t2000.jsp
- http://swik.net/solaris+tuning
- http://www.neovalia.es/imagenes/ficheros/redhat/Application_Stack.pdf
- http://www.sean.de/Solaris/soltune.html
- http://www.exa.unicen.edu.ar/catedras/tecmod/JBoss-AllDocsSubscription/JBossTuning.pdf
- http://www.virtualireland.ru/archive/index.php/t-3967.html
- http://www.junlu.com/msg/160182.html
- http://pornoshara.tv/download.php?tid=37642 - JBoss and OpenMQ integration