2010-05-21 5 views
1

Я создал простой тест EJB3 проект, код прост:Помощи с EJB 3, WebLogic и весной

@Stateless 
@Remote({ ISumaSimple.class }) 
public class SumaSimpleBean implements ISumaSimple { 

    /** 
    * Default constructor. 
    */ 
    public SumaSimpleBean() { 
     // TODO Auto-generated constructor stub 
    } 

    @Override 
    public int sumar(int a, int b) { 
     // TODO Auto-generated method stub 
     return a + b; 
    } 

} 

public interface ISumaSimple {  
    public int sumar(int a, int b); 
} 

Хорошо, мой клиент является самостоятельным пружинным ПРИМЕНЕНИЕМ какой конфигурации:

<bean id="sumaSimpleServicio" 
    class="org.springframework.jndi.JndiObjectFactoryBean"> 
    <property name="jndiEnvironment"> 
     <props> 
      <prop key="java.naming.factory.initial"> 
       org.apache.openejb.client.RemoteInitialContextFactory 
      </prop> 
      <prop key="java.naming.provider.url"> 
       ejbd://localhost:4201 
      </prop> 
     </props> 
    </property> 
    <property name="jndiName" value="SumaSimpleBeanRemote" /> 
</bean> 

<bean id="clienteService" class="qtx.cliente.simple.ClienteService"> 
    <property name="sumaSimpleServicio" ref="sumaSimpleServicio"></property> 
</bean> 

Все работало гладко, но потом я попытался установить с помощью WebLogic 10.3, только изменяя эти значения:

weblogic.jndi.WLInitialContextFactory

t3: // локальный: 7010

В WebLogic JNDI дерево мой EJB находится под: SimpleEJB3SimpleEJB_jarSumaSimple3_ISumaSimple

Конечно, я добавил wlclient.jar к моей весны клиента классам.

Развертывание прошло отлично, но я думаю, что у меня что-то не хватает в weblogic case, но не знаю. Мой пружинный клиент выбрасывает это исключение:

Caused by: org.springframework.beans.TypeMismatchException: Failed to convert property value of type [qtx.ejb.simple._SumaSimple3_gwze0z_ISumaSimpleIntf_Stub] to required type [qtx.servicio.simple.ISumaSimple] for property 'sumaSimpleServicio'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [qtx.ejb.simple._SumaSimple3_gwze0z_ISumaSimpleIntf_Stub] to required type [qtx.servicio.simple.ISumaSimple] for property 'sumaSimpleServicio': no matching editors or conversion strategy found 
    at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:391) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1288) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1249) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010) 
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472) 
    ... 14 more 
Caused by: java.lang.IllegalArgumentException: Cannot convert value of type [qtx.ejb.simple._SumaSimple3_gwze0z_ISumaSimpleIntf_Stub] to required type [qtx.servicio.simple.ISumaSimple] for property 'sumaSimpleServicio': no matching editors or conversion strategy found 
    at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:219) 
    at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:138) 
    at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:386) 
    ... 18 more 

Любая помощь будет принята с благодарностью.

ответ

2

Jndi name отличается в OpenEJB и Weblogic, должен использовать разные правильные имена jndi на сервере, на котором размещены ejbs.

Смежные вопросы