Welcome to www.pasala.net/
Home · Topics · Downloads · Your Account · Forums · Top 10


· Home
· Forums
· Gallery
· Stories Archive
· Submit News
· Topics
· Your Account

  Java Setting socket timeout while using ejb (SocketTimeoutException: Read timed out)

prasanth writes "When using ejbs if a call to ejb takes more than 60 secs then the client will throw an exception saying read timed out on the socket. So solve the problem we need to increase the socket timeout configuration in ejb3 deployer in JBoss. The following file has to be updated: /usr/local/jboss4.0.5.GA/server/default/deploy/ejb3.deployer/META-INF/jboss-service.xml Comment the following section:

<mbean code="org.jboss.remoting.transport.Connector"
<attribute name="InvokerLocator">socket://${jboss.bind.address}:3873</attribute>
<attribute name="Configuration">
<handler subsystem="AOP">org.jboss.aspects.remoting.AOPRemotingInvocationHandler</handler>
</mbean> Add the following section: <mbean code="org.jboss.remoting.transport.Connector"
<attribute name="Configuration">
<invoker transport="socket">
<attribute name="numAcceptThreads">1</attribute>
<attribute name="maxPoolSize">300</attribute>
<attribute name="clientMaxPoolSize" isParam="true">50</attribute>
<attribute name="socketTimeout" isParam="true">600000</attribute>
<attribute name="serverBindAddress">${jboss.bind.address}</attribute>
<attribute name="serverBindPort">3873</attribute>
<attribute name="backlog">200</attribute>
<handler subsystem="AOP">org.jboss.aspects.remoting.AOPRemotingInvocationHandler</handler>

IMPORTANT: You need to restart jboss for these changes to take effect.
  Posted by adminon Tuesday, April 14 @ 16:40:10 CDT (1259 reads)
(comments? | Score: 0)

  Java Transaction Timeout (JBoss 5.0.1)

Error Message: java.lang.IllegalStateException: [com.arjuna.ats.internal.jta.transaction.arjunacore.inactive] [com.arjuna.ats.internal.jta.transaction.arjunacore.inactive] The transaction is not active! Your transaction is taking longer than the default time out (300 secs). If you want to change the transaction time out in JBoss 5.0.1.GA modify
the file transaction-jboss-beans.xml( located in /server/default/deploy)
If you are not using the default configuration then make the change in the configuration you are using (all/standard/....) <?xml version="1.0" encoding="UTF-8"?>
<deployment xmlns="urn:jboss:bean-deployer:2.0"><bean name="TransactionManager" class="com.arjuna.ats.jbossatx.jta.TransactionManagerService"><annotation>@org.jboss.aop.microcontainer.aspects.jmx.JMX(name="jboss:service=TransactionManager", exposedInterface=com.arjuna.ats.jbossatx.jta.TransactionManagerServiceMBean.class, registerDirectly=true)</annotation> <property name="transactionTimeout">1800</property>
<property name="objectStoreDir">${jboss.server.data.dir}/tx-object-store</property>
<property name="mbeanServer"><inject bean="JMXKernel" property="mbeanServer"/></property>
  Posted by adminon Tuesday, April 14 @ 16:38:09 CDT (1237 reads)
(comments? | Score: 0)

  Java Struts2 vertical checkboxes/radio buttons

prasanth writes "When you are using the Struts2 simple theme the radio buttons and checkboxes (when using checkboxlist) are displayed in one row. If you want to display them vertically then you have three options i)create your own theme
ii)extend a theme iii)wrap an existing theme.

Extending the simple theme is the better than the other two options. To do this follow the below steps
  1. Create the following folder structure  WEB-INF/classes/template
  2. Now create a folder under template folder. The name of the folder will be your theme name. Lets say it is "mytheme", then you will have the following folder WEB-INF/classes/template/mytheme.
  3. Create a file called theme.properties
  4. Add the following line to theme.properties file   parent=simple
  5. Copy radiomap.ftl & checkboxlist.ftl from struts2-core jar file. These should be located at /template/simple folder in the jar
  6. Open checkboxlist.ftl file and add
    tag as shown below, just before s.iterator close tag
  7.  <label for="${parameters.name?html}-${itemCount}" class="checkboxLabel">${itemValue?html}</label>
  8. Open radiomap.ftl file and add
    tag as shown below, just before s.iterator close tag
             <label for="${parameters.id?html}${itemKeyStr?html}"><#rt/>    ${itemValue}<#t/> </label>

  Posted by adminon Monday, December 22 @ 10:41:32 CST (6950 reads)
(comments? | Score: 5)

  Java Transaction Timeout (JBoss 4.x)

prasanth writes "Exception in EJB call:
Caused by: org.hibernate.exception.GenericJDBCException: Cannot open connection
Caused by: org.jboss.util.NestedSQLException: Transaction is not active: tx=TransactionImpl:

Default transaction timeout in jboss-service.xml is set to 300sec (5 minutes). If your EJB has a transaction that takes more than 5 minutes the EJB call will fail.  You can modify jboss-service.xml (I guess you need to restart) or better go to jmx console and select "service=TransactionManager" increase the TransactionTimeout and apply changes.

Its good to modify jboss-service.xml file also so that when you restart some time later the value doesn't go back to the default.

<mbean code="org.jboss.tm.TransactionManagerService"
<attribute name="TransactionTimeout">1800</attribute>
<!-- set to false to disable transaction demarcation over IIOP -->
<attribute name="GlobalIdsEnabled">true</attribute>
<depends optional-attribute-name="XidFactory">jboss:service=XidFactory</depends> <!-- Transaction Integrity Checking -->
<!-- Force a rollback if another thread is associated with the transaction at commit -->
<!--depends optional-attribute-name="TransactionIntegrityFactory"
<mbean code="org.jboss.tm.integrity.FailIncompleteTransaction"
  Posted by adminon Monday, December 22 @ 10:31:29 CST (1292 reads)
(comments? | Score: 5)

  Java context-param for all web applications in the server

prasanth writes "Add context-param with the required name and value to conf/web.xml file which is inside of deploy/jbossweb folder. The jbossweb folder name changes from version to version.
jbossweb = jboss-web.deployer (jboss4.2.2)
jbossweb = jbossweb-tomcat55.sar(jboss4.0.5)

for jboss5 it is completely different folder it is in deployers/jbossweb.deployer
  Posted by adminon Tuesday, July 22 @ 17:32:11 CDT (612 reads)
(comments? | Score: 0)

  Java JBoss Forwarding request to another web application

prasanth writes "Say you are in app1 web application and you want to forward a request to a page in a different web application, you can accomplish it by the below code.
1. Get servlet context of the second web application
ServletContext context = getServletContext.getContext(/app2);
The above line of code returns servlet context for the app2 web appliaction
2. Get a request dispatcher for the page to which you wish to forward the request
RequestDispatcher rd = context.getRequestDispatcher("/jsp1.jsp");
3. Forward the request
rd.forward(request, response);

Note: The above code does not work if app1 & app2 are on different virtual hosts
Meaning you should be able to access app1 and app2 in the below manner from your browser
www.yourdomain.com/app1 & www.yourdomain.com/app2.

If you have set up separate virtual hosts for these two applications and accessing the sites in the below manner
www.app1.yourdomain.com & www.app2.yourdomain.com you will not be able to forward request from one application to another.
The context returned by getServletContext.getContext(/app2) will be null.

If you are using jboss-web.xml file then the virtual-host element in both the applications should be same
For app1:

For app2:
  Posted by adminon Wednesday, April 25 @ 10:14:29 CDT (1416 reads)
(comments? | Score: 0)

  Java Jars need for external client to access EJB3 on JBoss

prasanth writes "The following jar files are needed for an external client trying to fetch an EJB from JBoss server.

JBoss Server Version: 4.0.3SP1"
  Posted by adminon Friday, September 01 @ 15:11:33 CDT (928 reads)
(comments? | Score: 0)

  Java Tomcat/JBoss jdk1.5 for JSP

prasanth writes "Problem
Tomcat 5.5 fails to compile JSP files containing jdk 1.5 features.

To enable 1.5 features in your JSP files (like generics and autoboxing for example) you need to modify the web.xml file in jbossweb-tomcat55.sar/conf/. Look for compilerSourceVM and uncomment this section and make sure the param-value is 1.5"
  Posted by adminon Friday, September 01 @ 00:00:00 CDT (1340 reads)
(comments? | Score: 0)

  Java JBoss JNDI for external application

prasanth writes "If you want to configure a DataSource in JBoss JNDI so that external applications can lookup this DataSource make sure you are not binding it to java context.

Have the following tag inside <local-tx-datasource>

  Posted by adminon Thursday, May 04 @ 10:25:02 CDT (834 reads)
(comments? | Score: 0)

  Database ERROR: Invalid UTF-8 byte sequence detected - Database with Large Objects

prasanth writes "When you are trying to restore a dump from 7.4 in to 8.1 if you have invalid UTF-8 characters pg_restore will fail.

To remove the invalid characters you can use
iconv -c -f UTF-8 -t UTF-8 -o newDump.sql actualDumpFile.sql

But you have to do pg_dump with out -F option.

If you have large objects then a dump created this way will not contain the large objects stored in the database. But by adding -F option to pg_dump would create problem for iconv & pg_restore.

So follow the below steps
1. do pg_dump with out -F option
2. iconv -c -f UTF-8 -t UTF-8 -o newDump.sql actualDumpFile.sql
3. use psql to restore the database from newDump.sql
4. get a pg_dump with -Fc option
5. pg_restore --data-only --tabel=pg_largeobject -d

This should get your database back with out the invalid characters and with all your large objects."
  Posted by adminon Tuesday, April 25 @ 18:16:22 CDT (1247 reads)
(comments? | Score: 0)




Don't have an account yet? You can create one. As a registered user you have some advantages like theme manager, comments configuration and post comments with your name.

Old Articles

Sunday, October 30
· Fatal error: Unknown(): The script tried to execute a method or access a propert
Friday, August 05
· Crystal Reports ActiveX Designer (0x80043AC6) Access denied.
Thursday, June 16
· CREATE TABLE permissions for restricted users. - PostgreSQL
Friday, January 21
· Installing PostgreSQL from RPM
Monday, December 27
· Drop unnamed constraints from database - Postgresql
Monday, December 20
· Ant fails to start
Saturday, June 26
· glutDestroyWindow causes Segmentation Fault
Thursday, June 17
· Enforcing NOT NULL on foreign keys - PostgreSQL 7.4
· Checking for continuity of data
· moveToCurrentRow() fails
· Form Validation in Java - requesting focus for JTextField
· List of foreign keys in a database - PostgreSQL 7.4
Thursday, March 18
· bad interpreter. No such file or directory
Friday, February 06
· Cryptix Open PGP
Thursday, October 23
· Crystal Reports with JAVA
· VC++ application using Crystal Reports
Wednesday, October 22
· Data-aware Swing Components
Saturday, October 04
· Windows98 Missing files
Saturday, July 26
· Adding floating point support for openwatcom programs using graph.lib

All logos and trademarks in this site are property of their respective owner. The comments are property of their posters, all the rest � 2010 by Prasanth

PHP-Nuke Copyright © 2005 by Francisco Burzi. This is free software, and you may redistribute it under the GPL. PHP-Nuke comes with absolutely no warranty, for details, see the license.
Page Generation: 0.18 Seconds