Sun Application Server Startup Command: /opt/SUNWappserver/bin/asadmin start-domain --domaindir /opt/SUNWappserver/domains --user admin

Friday, March 30, 2007

JNDI on Sun Application Server 8.0

1. Go to sun application server and setting something like following:
















2. create a java file: PropertiesFactory.java and save it like directory gov/hud/cpd/gmp/business/service

package gov.hud.cpd.gmp.business.service;

import java.util.Hashtable;
import java.util.Properties;

import javax.naming.Context;
import javax.naming.Name;
import javax.naming.Reference;
import javax.naming.spi.ObjectFactory;

public class PropertiesFactory implements ObjectFactory {


public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable environment) throws Exception {

Reference ref=(Reference)obj;
Properties props = new Properties();
props.setProperty("username", (String)(ref.get("username").getContent()));
props.setProperty("password", (String)(ref.get("password").getContent()));
props.setProperty("sshhost", (String)(ref.get("sshhost").getContent()));


return props;
}

}

3. make a jar file(only this file) using comment under root folder in cmd:
jar cf ftpJndi.jar *.*
(Remember to restart sun application server.)
4. copy it to [sun folder]\AppServer\domains\domain1\lib\ext as a library
or add in classpath in program as library.
  • If sun application server cannot find this factory class, It will directory return java.naming.Reference type in prop = (Reference) envCtx.lookup(dsName); below.

5. create another file in program like following:
package gov.hud.cpd.gmp.business.service;

import java.util.Properties;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

public final class JndiConnector {

public static ftpConnectionDao getContextName() throws NamingException {
ftpConnectionDao ftpConn = null;
Properties prop = null;
try {
InitialContext ctx = new InitialContext();
String dsName = "FtpConnection";
Context envCtx = (Context) ctx.lookup("java:comp/env");
prop = (Properties) envCtx.lookup(dsName);
ftpConn = new ftpConnectionDao();
ftpConn.setUsername(prop.getProperty("username"));
ftpConn.setPassword(prop.getProperty("password"));
ftpConn.setSshhost(prop.getProperty("sshhost"));

} catch (Exception e) {
e.printStackTrace();
}
return ftpConn;
}
}


and dao file:
package gov.hud.cpd.gmp.business.service;

public class ftpConnectionDao {

private String username;
private String password;
private String sshhost;
public String getSshhost() {
return sshhost;
}
public void setSshhost(String sshhost) {
this.sshhost = sshhost;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
}

6. in web.xml
<resource-ref>
<description>Ftp JNDI Reference</description>
<res-ref-name>FtpConnection</res-ref-name>
<res-type>java.util.Properties</res-type>
<res-auth>Container</res-auth>
</resource-ref>

7. in sun-web.xml
<resource-ref>
<res-ref-name>FtpConnection</res-ref-name>
<jndi-name>FtpConnection</jndi-name>
</resource-ref>

Monday, March 12, 2007

Install SharePoint 2007

1. Install .NET Framwork 3.0
2. Install SQL Server 2005 SP2
3. Make sure SMTP and index server installed on the server. You may need to restart machine.
4. Install SharePoint: refer to http://mindsharpblogs.com/bill/archive/2006/06/27/1153.aspx
NOTE: Stop before create Web Application
5. Setup Outgoing email.
Central Administration > Operations > Outgoing E-Mail Settings
[Your exchange server]
From address: [administrator's email]
To address: [administrator's email]

6. Set Incoming Email
Central Administration > Operations > Incoming E-Mail Settings
Configure Incoming E-Mail Settings
Enable sites on this server to receive e-mail?

Settings mode:


Use the SharePoint Directory Management Service to create distribution groups and contacts?

E-mail server display address: mylist @




7. Start Office SharePoint Server Search Service

Central Administration > Operations > Services on Server > Office SharePoint Server Search Service Settings
Configure Office SharePoint Server Search Service Settings on server hqspsdev

Use this server for indexing content

Use this server for serving search queries

Reduced


8. Start Windows SharePoint Services Serch Service
Central Administration > Operations >Services on Server > Windows
SharePoint Services Search Service Settings

Configure Windows SharePoint Services Search Service Settings on server hqspsdev

Database Server

Database Name


9. Start Excel Calculation Services and Document Conversion Load Balancer Service
10. Start Launcher Service Setting
Load Balancer server:


Port Number:

Tuesday, March 06, 2007

DUMP TRANSACTION LOG on SQL Server

dump transaction test with no_log
DBCC SHRINKFILE(PSIWeb_log, 20)
BACKUP LOG PSIWeb WITH TRUNCATE_ONLY
DBCC SHRINKFILE(PSIWeb_log, 1)
GO
exec sp_detach_db 'PSIWeb', 'true'
exec sp_attach_single_file_db @dbname = 'PSIWeb',
@physname = 'C:\MSSQL7\Data\PSIWeb_Data.MDF'