Monday, May 05, 2008
JBoss Have a war dependant on ear
Sometimes you need a war to be deployed only after a certain ear has been deployed for example if you need the war and the ear to have the same context.
use the <depends> tag in jboss-web.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jboss-web PUBLIC "-//JBoss//DTD Web Application 2.3//EN" "http://www.jboss.org/j2ee/dtd/jboss-web_3_2.dtd">
<jboss-web>
<context-root>/yourcontext</context-root>
<depends>jboss.j2ee:service=EARDeployment,url='yourear.ear'</depends>
</jboss-web>
use the
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jboss-web PUBLIC "-//JBoss//DTD Web Application 2.3//EN" "http://www.jboss.org/j2ee/dtd/jboss-web_3_2.dtd">
<jboss-web>
<context-root>/yourcontext</context-root>
<depends>jboss.j2ee:service=EARDeployment,url='yourear.ear'</depends>
</jboss-web>
Tuesday, June 12, 2007
Tuesday, May 15, 2007
JBoss SYSLOG
<appender name="SYSLOG" class="org.apache.log4j.net.SyslogAppender">
<errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
<param name="syslogHost" value="10.10.2.32"/>
<param name="Facility" value="LOCAL7"/>
<param name="FacilityPrinting" value="true"/>
<layout class="org.apache.log4j.PatternLayout">
<!-- The default pattern: Date Priority [Category] Message\n -->
<param name="ConversionPattern" value="%m%n"/>
<!-- The full pattern: Date MS Priority [Category] (Thread:NDC) Message\n
<param name="ConversionPattern" value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
-->
</layout>
</appender>
Also add:
<root>
<appender-ref ref="CONSOLE"/>
<appender-ref ref="FILE"/>
<appender-ref ref="AUDITFILE"/>
<appender-ref ref="SYSLOG"/>
</root>
--------------------------------
Enabling UDP in syslog(linux):
In /etc/sysconfig/syslog(change is in red):
# Options to syslogd
# -m 0 disables 'MARK' messages.
# -r enables logging from remote machines
# -x disables DNS lookups on messages recieved with -r
# See syslogd(8) for more details
SYSLOGD_OPTIONS="-r -m 0"
# Options to klogd
# -2 prints all kernel oops messages twice; once for klogd to decode, and
# once for processing with 'ksymoops'
# -x disables all klogd processing of oops messages entirely
# See klogd(8) for more details
KLOGD_OPTIONS="-2"
And restart the SYSLOG daemon
<errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
<param name="syslogHost" value="10.10.2.32"/>
<param name="Facility" value="LOCAL7"/>
<param name="FacilityPrinting" value="true"/>
<layout class="org.apache.log4j.PatternLayout">
<!-- The default pattern: Date Priority [Category] Message\n -->
<param name="ConversionPattern" value="%m%n"/>
<!-- The full pattern: Date MS Priority [Category] (Thread:NDC) Message\n
<param name="ConversionPattern" value="%d %-5r %-5p [%c] (%t:%x) %m%n"/>
-->
</layout>
</appender>
Also add:
<root>
<appender-ref ref="CONSOLE"/>
<appender-ref ref="FILE"/>
<appender-ref ref="AUDITFILE"/>
<appender-ref ref="SYSLOG"/>
</root>
--------------------------------
Enabling UDP in syslog(linux):
In /etc/sysconfig/syslog(change is in red):
# Options to syslogd
# -m 0 disables 'MARK' messages.
# -r enables logging from remote machines
# -x disables DNS lookups on messages recieved with -r
# See syslogd(8) for more details
SYSLOGD_OPTIONS="-r -m 0"
# Options to klogd
# -2 prints all kernel oops messages twice; once for klogd to decode, and
# once for processing with 'ksymoops'
# -x disables all klogd processing of oops messages entirely
# See klogd(8) for more details
KLOGD_OPTIONS="-2"
And restart the SYSLOG daemon
You will have to restart syslog on the server for the changes to take effect. The server will now start to listen on UDP port 514, which you can verify using either one of the following netstat command variations.
[root@bigboy tmp]# netstat -a | grep syslog
udp 0 0 *:syslog *:*
[root@bigboy tmp]# netstat -an | grep 514
udp 0 0 0.0.0.0:514 0.0.0.0:*
[root@bigboy tmp]#
Sunday, May 13, 2007
CMP Pool size
<container-configuration>
<container-name>Standard CMP 2.x EntityBean</container-name>
<call-logging>false</call-logging>
<invoker-proxy-binding-name>entity-rmi-invoker</invoker-proxy-binding-name>
<sync-on-commit-only>false</sync-on-commit-only>
<insert-after-ejb-post-create>false</insert-after-ejb-post-create>
<call-ejb-store-on-clean>true</call-ejb-store-on-clean>
<container-interceptors>
<interceptor>org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor</interceptor>
<interceptor>org.jboss.ejb.plugins.LogInterceptor</interceptor>
<interceptor>org.jboss.ejb.plugins.SecurityInterceptor</interceptor>
<interceptor>org.jboss.ejb.plugins.TxInterceptorCMT</interceptor>
<interceptor>org.jboss.ejb.plugins.CallValidationInterceptor</interceptor>
<interceptor metricsEnabled="true">org.jboss.ejb.plugins.MetricsInterceptor<
/interceptor>
<interceptor>org.jboss.ejb.plugins.EntityCreationInterceptor</interceptor>
<interceptor>org.jboss.ejb.plugins.EntityLockInterceptor</interceptor>
<interceptor>org.jboss.ejb.plugins.EntityInstanceInterceptor</interceptor>
<interceptor>org.jboss.ejb.plugins.EntityReentranceInterceptor</interceptor>
<interceptor>org.jboss.resource.connectionmanager.CachedConnectionInterceptor<
/interceptor>
<interceptor>org.jboss.ejb.plugins.EntitySynchronizationInterceptor</interceptor>
<interceptor>org.jboss.ejb.plugins.cmp.jdbc.JDBCRelationInterceptor</interceptor>
</container-interceptors>
<instance-pool>org.jboss.ejb.plugins.EntityInstancePool</instance-pool>
<instance-cache>org.jboss.ejb.plugins.InvalidableEntityInstanceCache</instance-cache>
<persistence-manager>org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager</persistence-manager>
<locking-policy>org.jboss.ejb.plugins.lock.QueuedPessimisticEJBLock</locking-policy>
<container-cache-conf>
<span style="font-weight:bold;"><cache-policy>org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy</cache-policy>
<cache-policy-conf>
<min-capacity>50</min-capacity>
<max-capacity>1000000</max-capacity>
<overager-period>300</overager-period>
<max-bean-age>600</max-bean-age>
<resizer-period>400</resizer-period>
<max-cache-miss-period>60</max-cache-miss-period>
<min-cache-miss-period>1</min-cache-miss-period>
<cache-load-factor>0.75</cache-load-factor>
</cache-policy-conf>
</container-cache-conf>
<container-pool-conf>
<MaximumSize>100</MaximumSize></span>
</container-pool-conf>
<commit-option>B</commit-option>
</container-configuration>
<container-name>Standard CMP 2.x EntityBean</container-name>
<call-logging>false</call-logging>
<invoker-proxy-binding-name>entity-rmi-invoker</invoker-proxy-binding-name>
<sync-on-commit-only>false</sync-on-commit-only>
<insert-after-ejb-post-create>false</insert-after-ejb-post-create>
<call-ejb-store-on-clean>true</call-ejb-store-on-clean>
<container-interceptors>
<interceptor>org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor</interceptor>
<interceptor>org.jboss.ejb.plugins.LogInterceptor</interceptor>
<interceptor>org.jboss.ejb.plugins.SecurityInterceptor</interceptor>
<interceptor>org.jboss.ejb.plugins.TxInterceptorCMT</interceptor>
<interceptor>org.jboss.ejb.plugins.CallValidationInterceptor</interceptor>
<interceptor metricsEnabled="true">org.jboss.ejb.plugins.MetricsInterceptor<
/interceptor>
<interceptor>org.jboss.ejb.plugins.EntityCreationInterceptor</interceptor>
<interceptor>org.jboss.ejb.plugins.EntityLockInterceptor</interceptor>
<interceptor>org.jboss.ejb.plugins.EntityInstanceInterceptor</interceptor>
<interceptor>org.jboss.ejb.plugins.EntityReentranceInterceptor</interceptor>
<interceptor>org.jboss.resource.connectionmanager.CachedConnectionInterceptor<
/interceptor>
<interceptor>org.jboss.ejb.plugins.EntitySynchronizationInterceptor</interceptor>
<interceptor>org.jboss.ejb.plugins.cmp.jdbc.JDBCRelationInterceptor</interceptor>
</container-interceptors>
<instance-pool>org.jboss.ejb.plugins.EntityInstancePool</instance-pool>
<instance-cache>org.jboss.ejb.plugins.InvalidableEntityInstanceCache</instance-cache>
<persistence-manager>org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager</persistence-manager>
<locking-policy>org.jboss.ejb.plugins.lock.QueuedPessimisticEJBLock</locking-policy>
<container-cache-conf>
<span style="font-weight:bold;"><cache-policy>org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy</cache-policy>
<cache-policy-conf>
<min-capacity>50</min-capacity>
<max-capacity>1000000</max-capacity>
<overager-period>300</overager-period>
<max-bean-age>600</max-bean-age>
<resizer-period>400</resizer-period>
<max-cache-miss-period>60</max-cache-miss-period>
<min-cache-miss-period>1</min-cache-miss-period>
<cache-load-factor>0.75</cache-load-factor>
</cache-policy-conf>
</container-cache-conf>
<container-pool-conf>
<MaximumSize>100</MaximumSize></span>
</container-pool-conf>
<commit-option>B</commit-option>
</container-configuration>
Tuesday, April 04, 2006
add username password to jmx console
* Update /tools/jboss-3.2.5/server/default_OR_all/deploy/jmx-console.war/WEB-INF/jboss-web.xml
uncomment this: <security-domain>java:/jaas/jmx-console</security-domain>
* Update /tools/jboss-3.2.5/server/default_OR_all/deploy/jmx-console.war/WEB-INF/web.xml
uncomment this:
* The username password to jmx console is admin/admin
(if you want to alter it use /tools/jboss-3.2.5/server/default/deploy_OR_all/jmx-console.war\WEB-INF/classes/jmx-console-users.properties)
uncomment this: <security-domain>java:/jaas/jmx-console</security-domain>
* Update /tools/jboss-3.2.5/server/default_OR_all/deploy/jmx-console.war/WEB-INF/web.xml
uncomment this:
<security-constraint>
<web-resource-collection>
<web-resource-name>HtmlAdaptor</web-resource-name>
<description>An example security config that only allows users with the
role JBossAdmin to access the HTML JMX console web application
</description>
<url-pattern>/*</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>JBossAdmin</role-name>
</auth-constraint>
</security-constraint>
* The username password to jmx console is admin/admin
(if you want to alter it use /tools/jboss-3.2.5/server/default/deploy_OR_all/jmx-console.war\WEB-INF/classes/jmx-console-users.properties)
Sunday, March 12, 2006
Setting default connection pool idle timeout for mysql
in mysql-ds.xml
Add the following to your datasource:
<idle-timeout-minutes>10</idle-timeout-minutes>
In this example we have decreased the timeout from 15 minutes to 10 minutes (jboss default is 15 minutes)
The method by which i have understood that thats whats needs to be done is by looking at: hsqldb-ds.xml
Add the following to your datasource:
<idle-timeout-minutes>10</idle-timeout-minutes>
In this example we have decreased the timeout from 15 minutes to 10 minutes (jboss default is 15 minutes)
The method by which i have understood that thats whats needs to be done is by looking at: hsqldb-ds.xml
Tuesday, March 07, 2006
JBoss connection pool and fail over database
JBoss uses a connection pool to connect to databases. If you however have your database behind a fail over machine then note that the fail over machine that provides you with the link to the real database might have a timeout on the connection, in my case the fail over machine - the alteon had a timeout of 10 minutes while jboss had a timeout of 15 minutes for its connections this means that some of the connections got disconnected by the alteon, the solution to that problem was to decrease the timeout of the connections in jboss connection pool to be smaller than the timeout of the connection pool of the alteon
Monday, March 06, 2006
Cache invalidation in cluster
If you want your EJB's to invlidate their cache cross cluster you must add the following to each entity bean:
<cache-invalidation>True</cache-invalidation>click here for more details
Tuesday, February 28, 2006
View CMP generated SQL's
Add the following to your log4j.xml
<category name="org.jboss.ejb.plugins.cmp">
<priority value="DEBUG" />
</category>
<category name="org.jboss.ejb.plugins.cmp">
<priority value="DEBUG" />
</category>
Tuesday, February 21, 2006
Turning on tomcat's access log in jboss
Edit the file:
jboss-4.0.3\server\default\deploy\jbossweb-tomcat55.sar\server.xml
Uncomment the following section:
The log file would be created:
jboss-4.0.3\server\all\log\localhost_access_log.2006-02-21.log
jboss-4.0.3\server\default\deploy\jbossweb-tomcat55.sar\server.xml
Uncomment the following section:
<!-- Access logger -->
<valve classname="org.apache.catalina.valves.FastCommonAccessLogValve" prefix="localhost_access_log." suffix=".log" pattern="common" directory="${jboss.server.home.dir}/log" resolvehosts="false">
</valve>
The log file would be created:
jboss-4.0.3\server\all\log\localhost_access_log.2006-02-21.log
Starting up 2 jboss nodes on windows with HASingleton
One can start up 2 jboss nodes on the same machine, if you have any problems startin up your nodes then define them explicitly in tcp mode rather than udp mode (HASingleton prooved to be working much better in tcp mode):
Setting up tcp mode instead of udp mode is very easy:
a. in cluster-service.xml
b. bind_addr="localhost"
c. start_port="7800" on first node and 7801 on the other node
d. initial_hosts="localhost[7800],localhost[7801]" on one node and on the other initial_hosts="localhost[7801],localhost[7800]"
Setting up tcp mode instead of udp mode is very easy:
a. in cluster-service.xml
b. bind_addr="localhost"
c. start_port="7800" on first node and 7801 on the other node
d. initial_hosts="localhost[7800],localhost[7801]" on one node and on the other initial_hosts="localhost[7801],localhost[7800]"
Saturday, August 14, 2004
JBoss - Commit Option A and Clustering
Commit Option A - I own the database. If you want your entities to be cache invalidated cross nodes in a cluster, you must update it in jboss.xml see
http://www.onjava.com/pub/a/onjava/2003/05/28/jboss_optimization.html?page=2
http://www.onjava.com/pub/a/onjava/2003/05/28/jboss_optimization.html?page=2
Tuesday, August 10, 2004
Monday, August 09, 2004
Saturday, August 07, 2004
Finding a jar for an import that cannot be resolved
You find yourself with the compilation error The import xxx.yyy.zzz.ABC cannot be resolved where is the jar that contains that class?
A simple way to find it out
use a search utility, search for a text within a *.jar that contains the text xxx/yyy/zzz/ABC you will find your jar ! :)
A simple way to find it out
use a search utility, search for a text within a *.jar that contains the text xxx/yyy/zzz/ABC you will find your jar ! :)
Subscribe to:
Posts (Atom)