Naming ServiceネーミングサービスThe Naming Service provides access to JNDI contexts. Please note that if you are using Tomcat as your servlet engine and you get errors about sealing violations, you may need to read this document. ネーミングサービスはJNDIコンテキストへのアクセスを提供します。 サーブレットエンジンとしてTomcatを使用しており、Jarファイル内のクラスの競合エラーが起きた場合、このドキュメントを読む必要があることを覚えておいてください。 Configuration# ------------------------------------------------------------------- # # S E R V I C E S # # ------------------------------------------------------------------- # Classes for Turbine Services should be defined here. # Format: services.[name].classname=[implementing class] # # To specify properties of a service use the following syntax: # service.[name].[property]=[value] # Turbineのサービスのためのクラス群はここに定義します。 # フォーマット: services.[name].classname=[implementing class] # # サービスのプロパティを設定するには、以下の書式を使用します: # service.[name].[property]=[value] services.NamingService.classname=org.apache.fulcrum.naming.TurbineNamingService . . . Usage
try
{
// Set up the naming provider. This may not always be necessary,
// depending on how your Java system is configured.
// ネーミングプロバイダのセットアップ。これは常に必要なのではなく、
// 使用しているJavaシステムがどのように設定されたかに依存する。
System.setProperty("java.naming.factory.initial",
"org.jnp.interfaces.NamingContextFactory");
System.setProperty("java.naming.provider.url",
"localhost:1099");
// Get a naming context
// ネーミングコンテキストを取得する
InitialContext jndiContext = new InitialContext();
// Get a reference to the Interest Bean
// 対象となるBeanの参照を取得する
Object ref = jndiContext.lookup("interest/Interest");
// Get a reference from this to the Bean's Home interface
// BeanのHomeインターフェース参照を取得する
InterestHome home = (InterestHome)
PortableRemoteObject.narrow (ref, InterestHome.class);
// Create an Interest object from the Home interface
// Homeインターフェースから対象のオブジェクトを作成する
m_interest = home.create();
}
catch(Exception e)
{
out.println("<LI>Context failed: " + e);
}
|