0

Websphere 8.5.5 にデプロイされたリモート インターフェイスがあり、これをスプリング ブート アプリケーションで検索したいと考えています。RMI私も使用した共通のインターフェースとしてスプリングブートで同様のインターフェースを作成しましSimpleRemoteStatelessSessionProxyFactoryBeanたが、返されたプロキシはあり、ポインターをnullスローしていましたnullproxy.invokeMethod()

@Configuration
public class Config {

    private static final String INITIAL_CONTEXT_FACTORY = "com.ibm.websphere.naming.WsnInitialContextFactory";
    private static final String PROVIDER_URL = "corbaname:iiop:localhost:2809/NameServiceServerRoot";

    @Primary
    @Bean
    public static AdminService adminService() {

        Properties jndiProps = new Properties();
        Properties properties = new Properties();
        properties.put(Context.INITIAL_CONTEXT_FACTORY, INITIAL_CONTEXT_FACTORY);
        properties.put(Context.PROVIDER_URL, PROVIDER_URL);

        SimpleRemoteStatelessSessionProxyFactoryBean factory = new SimpleRemoteStatelessSessionProxyFactoryBean();
        factory.setJndiEnvironment(jndiProps);
        factory.setJndiName("java:global/[AppName]/[ModuleName]/ejb/[BeanName]![RemoteInterface]");
        factory.setBusinessInterface(AdminService.class);
        factory.setResourceRef(true);
        AdminService proxy = (AdminService) factory.getObject();
        try {
            proxy.invokeMethod();
        }catch(RemoteException e) {
            e.printStackTrace();
        }

        return proxy;       
    }
}

今、このエラーをスローしています:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'AdminService' defined in class path resource [...Config.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [...AdminService]: Factory method 'adminEJBService' threw exception; nested exception is javax.naming.NameNotFoundException: Name [global/[AppName]/[ModuleName]/ejb/[BeanName]![RemoteInterface] is not bound in this Context. Unable to find [global].
4

1 に答える 1

0

[]のすべてを実際の名前に置き換える必要があるため[AppName]、 ではなくなどです。不明な場合は、WebSphere 8.5.5 サーバーのファイルでメッセージ をMyApp検索することにより、正確なルックアップ文字列を特定できます。たとえば、実際のメッセージは次のようになります。SystemOut.logCNTR0167I

CNTR0167I: The server is binding the javax.management.j2ee.ManagementHome interface of the Management enterprise bean in the mejb.jar module of the ManagementEJB application.  The binding location is: java:global/ManagementEJB/mejb/Management!javax.management.j2ee.ManagementHome
于 2019-10-28T17:59:48.893 に答える