주의할 점은 "file://" 이후에 redeploy 대상의 application 명이 와야 합니다.

1) deploy

/home/jchoi/jboss-4.2.3GA/bin>./twiddle.sh -s jnp://127.0.0.1:1099 -u admin -p admin invoke "jboss.system:service=MainDeployer" deploy "file:///home/jchoi/domains/testdomain/deploy/echo.war"

2) redeploy

/home/jchoi/jboss-4.2.3GA/bin>./twiddle.sh -s jnp://127.0.0.1:1099 -u admin -p admin invoke "jboss.system:service=MainDeployer" redeploy "file:///home/jchoi/domains/testdomain/deploy/echo.war"

3) undeploy

/home/jchoi/jboss-4.2.3GA/bin>./twiddle.sh -s jnp://127.0.0.1:1099 -u admin -p admin invoke "jboss.system:service=MainDeployer" undeploy "file:///home/jchoi/domains/testdomain/deploy/echo.war"

크리에이티브 커먼즈 라이센스
Creative Commons License
2009/01/22 14:38 2009/01/22 14:38

import java.sql.Connection;
import javax.naming.InitialContext;
import javax.sql.DataSource;

public class OracleConnectionUtil
{
 public static Connection getOracleConnection(String jndi)
  try{
   InitialContext ctx = new InitialContext();
   DataSource datasource = (DataSource) ctx.lookup(jndi);
   Connection connection = datasource.getConnection();
   //cast this to JBoss specific WrappedConnection
   org.jboss.resource.adapter.jdbc.WrappedConnection wrappedConnection =  (org.jboss.resource.adapter.jdbc.WrappedConnection) connection;
   //get the underlying connection (T4CConnection)
   Connection underlyingConnection = wrappedConnection.getUnderlyingConnection();

   //cast to T4CConnection if some specific API on this object is to be used
   oracle.jdbc.OracleConnection t4cConnection = (oracle.jdbc.OracleConnection) underlyingConnection;
   out.println("Oracle Connection : " + t4cConnection);
   return t4cConnection;
  }catch(Exception e) {
   System.out.println("Exception while getting oracle connection :::: " + e.getMessage());
  }
  return null;
 }

 public static void close(Connection conn) {
  try{
   if( conn != null ) conn.close();
  }catch(Exception e) {
   // Ignore when the connection closing
  }
 }
}

// 오라클에서 얻어온 connection을 close할 경우 casting된 connection은 실제 connection이므로
// close시 실제 연결이 끊어지게 되는 현상이 발생합니다.

// 아래의 같이 DataSource의 proxy connection을 close해야만 WAS의 connection pool로 반환하게 됩니다.  

   Connection conn = DataSource.getConnection();
   Connection oracleConn = conn.getUnderlyingConnection();
  
   //Do JDBC stuff heere

   //CLOSE THE HANDLE, NOT THE UNDERLYING CONNECTION!!!!
   conn.close();
 
   conn = DataSource.getConnection();
   oracleConn = conn.getUnderlyingConnection();


 

크리에이티브 커먼즈 라이센스
Creative Commons License
2009/01/19 10:00 2009/01/19 10:00

아래의 코드를 복사하셔서 web application context에 vm.jsp로 저장하신 후 확인하시면 됩니다.

<%@ page contentType="text/html; charset=euc-kr" %>
<%@ page import="java.net.InetAddress" %>
<%@ page import="java.text.*" %>
<%@ page import="java.util.*" %>

<%
  if (request.getParameter("gc") != null) {
    System.gc();
    System.runFinalization();
  }
 Properties p = System.getProperties();
%>

<HTML>
<HEAD>
<META content="text/html; charset=euc-kr" http-equiv=Content-Type>
<!--META http-equiv="Refresh" content="10;url=<%= request.getRequestURI() %>"-->
<link href="style.css" rel=stylesheet type="text/css">
</HEAD>

<body leftmargin=15 topmargin=10>
<center><p>

<table width="600" cellpadding="7" cellspacing="0" border="1" bordercolordark="WHITE" bordercolorlight="BLACK">
<tr><td>
■ HOST : <%= InetAddress.getLocalHost().getHostName() %>
(<%= InetAddress.getLocalHost().getHostAddress() %>)&nbsp;&nbsp;
<% SimpleDateFormat formatter = new SimpleDateFormat("yyyy.MM.dd 'at' HH:mm:ss z", Locale.CHINA); %>
■ Current Time : <%= formatter.format(new Date()) %>
</td></tr>

<tr><td align=center>

<%
   Runtime rt = Runtime.getRuntime();
   long free = rt.freeMemory();
   long total = rt.totalMemory();
   long usedRatio = (total - free) * 100 / total;
   long unusedRatio = free * 100 / total;
%>

<table width=100% bgcolor="lightgrey" border=1 cellpadding=6 cellspacing=0>
<tr>
<td align="center" colspan="2">Total Java Virual Machine Memory (<b><%= total/1024 %> KB</b>)</td>
</tr>
<tr bgcolor=#E3E3E3>
<td align="center">Used Memory (<b><%= (total - free)/1024 %> KB</b>)</td>
<td align="center">Available Memory (<b><%= free/1024 %> KB</b>)</td>
</tr>
<tr bgcolor=#E8EEEC>
<td><hr color="#CC3366" align=left size=10 width="<%= usedRatio %>%" noshade>
(<%= usedRatio %> %)</td>
<td><hr color="#0066FF" align=left size=10 width="<%= unusedRatio %>%" noshade>
(<%= unusedRatio %> %)</td>
</tr>
</table>

<p>
<a href="<%= request.getRequestURI() %>?gc=">
<img src="trash.gif" valign=middle border=0>&nbsp;Execution GC</a>
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;
<a href="<%= request.getRequestURI() %>">
<img src="refresh.gif" valign=middle border=0>&nbsp;Reload</a>

</td></tr>
</table>

</center>
</BODY>
</HTML>

크리에이티브 커먼즈 라이센스
Creative Commons License
2009/01/19 09:58 2009/01/19 09:58

사용자 삽입 이미지
JBoss 관련 글은 아래의 site에 작성합니다.
Refer to : http://jboss.tistory.com/5

크리에이티브 커먼즈 라이센스
Creative Commons License
2009/01/07 11:54 2009/01/07 11:54