Results 1 to 3 of 3

Thread: LocalSessionFactoryBean & multiple EAR in WebSphere

  1. #1
    Join Date
    Aug 2004
    Posts
    21

    Default LocalSessionFactoryBean & multiple EAR in WebSphere

    Good Day,

    I have two EARs deployed to WebSphere 5.1. The one EAR has an ejb that uses the services of another ejb deployed in the second EAR.

    I get the following error


    java.lang.reflect.InvocationTargetException: org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'hibernateApplicationDAO' defined in class path resource [context-application.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyAccessExceptions Exception: PropertyAccessExceptionsException (1 errors); nested propertyAccessExceptions are: [org.springframework.beans.TypeMismatchException: Failed to convert property value of type [com.hsbc.spring.LocalSessionFactoryBean] to required type [net.sf.hibernate.SessionFactory] for property 'sessionFactory']

    PropertyAccessExceptionsException (1 errors)
    org.springframework.beans.TypeMismatchException: Failed to convert property value of type [com.hsbc.spring.LocalSessionFactoryBean] to required type [net.sf.hibernate.SessionFactory] for property 'sessionFactory'
    at org.springframework.beans.BeanWrapperImpl.doTypeCo nversionIfNecessary(BeanWrapperImpl.java:905)
    at org.springframework.beans.BeanWrapperImpl.setPrope rtyValue(BeanWrapperImpl.java:673)
    at org.springframework.beans.BeanWrapperImpl.setPrope rtyValue(BeanWrapperImpl.java:588)
    at org.springframework.beans.BeanWrapperImpl.setPrope rtyValue(BeanWrapperImpl.java:720)
    at org.springframework.beans.BeanWrapperImpl.setPrope rtyValues(BeanWrapperImpl.java:747)
    at org.springframework.beans.BeanWrapperImpl.setPrope rtyValues(BeanWrapperImpl.java:736)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.applyPropertyValues(Abs tractAutowireCapableBeanFactory.java:840)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.populateBean(AbstractAu towireCapableBeanFactory.java:662)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:270)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:205)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:204)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:136)
    at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:236)
    at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:284)
    at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:80)
    at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:65)
    at org.springframework.context.access.ContextJndiBean FactoryLocator.createBeanFactory(ContextJndiBeanFa ctoryLocator.java:40)
    at org.springframework.beans.factory.access.JndiBeanF actoryLocator.useBeanFactory(JndiBeanFactoryLocato r.java:69)
    at org.springframework.ejb.support.AbstractEnterprise Bean.loadBeanFactory(AbstractEnterpriseBean.java:1 15)
    at org.springframework.ejb.support.AbstractStatelessS essionBean.ejbCreate(AbstractStatelessSessionBean. java:63)
    at java.lang.reflect.Method.invoke(Native Method)

  2. #2
    Join Date
    Aug 2004
    Posts
    21

    Default

    Has anyone have experience packaging common application code in a EJB jar deployed as an EAR and then calling the EJB from another EAR / EJB project.

    Important is how to do this with WebSphere 5.1 + Spring 1.1.1 + Hibernate 2.1.6.

  3. #3
    Join Date
    Aug 2004
    Posts
    21

    Default

    The problem is that the two ejb applications have different classloaders. The one loads the interface and the other loads the implementation and when the one is assigned to the other then because they were loaded by two different classloaders they are treated as different classes and produce the ClassCastException.

    A possible solution is to have the common code accesible on the classloader one level above the two ear applications, say on the WAS\lib folder.


    Just a thought....

Similar Threads

  1. Replies: 8
    Last Post: Mar 19th, 2008, 11:13 AM
  2. Websphere 6 JTA question
    By pkorwar in forum Data
    Replies: 8
    Last Post: Jul 19th, 2007, 01:16 PM
  3. Replies: 1
    Last Post: Mar 9th, 2005, 03:52 PM
  4. Replies: 1
    Last Post: Feb 25th, 2005, 07:12 AM
  5. Multiple Pages
    By afida in forum Swing
    Replies: 12
    Last Post: Feb 16th, 2005, 08:42 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •