Announcement Announcement Module
Collapse
No announcement yet.
Spring + weblogic. NamedQuery not found Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring + weblogic. NamedQuery not found

    We're new to about all of the technology we're working with, and we're having a hard time to get it all right. Please bear with us...

    We are developing a web application in JDeveloper 11g, using the integrated WebLogic Server and trying to configure Spring correctly. We don't have any experience with Spring, so we're just looking at examples and trying to figure it out. When running the application on the server, it seems that we get a connection to the database, but there are no Spring instances visible in the console...and when loading a jsf page, we get this error:

    Code:
    12.feb.2009 10:51:16 oracle.adf.controller.faces.lifecycle.FacesPageLifecycle addMessage
    WARNING: ADFc: Det oppstod et uventet unntak: javax.ejb.EJBException, mld=EJB Exception: : java.lang.IllegalArgumentException: NamedQuery of name: CseAnalysis.findAll not found.
    	at org.eclipse.persistence.internal.jpa.EJBQueryImpl.getDatabaseQuery(EJBQueryImpl.java:454)
    	at org.eclipse.persistence.internal.jpa.EJBQueryImpl.setAsSQLReadQuery(EJBQueryImpl.java:117)
    	at org.eclipse.persistence.internal.jpa.EJBQueryImpl.getResultList(EJBQueryImpl.java:503)
    	at no.csam.plexus.configmanager.lab.dao.LabDAOImpl.queryCseAnalysisFindAll(LabDAOImpl.java:166)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    	at java.lang.reflect.Method.invoke(Method.java:597)
    	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
    	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
    	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
    	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
    	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
    	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
    	at $Proxy110.queryCseAnalysisFindAll(Unknown Source)
    	at no.csam.plexus.configmanager.lab.service.LabEJBBean.queryCseAnalysisFindAll(LabEJBBean.java:111)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    	at java.lang.reflect.Method.invoke(Method.java:597)
    ..............
    Here are some snippets of code:

    EntityBean:

    Code:
    @Entity
    @NamedQueries({
      @NamedQuery(name = "CseAnalysis.findAll", query = "select o from CseAnalysis o")
    })
    @Table(name = "CSE_ANALYSIS")
    @IdClass(CseAnalysisPK.class)
    public class CseAnalysis implements Serializable {
    ...........
    }

    DAO:
    Code:
    @Transactional
    @Repository
    public class LabDAOImpl implements LabDAO{
        
        @PersistenceContext
        private EntityManager em;
    
        /** <code>select o from CseLabAnalysis o</code> */
        public List<CseLabAnalysis> queryCseLabAnalysisFindAll() {
            return em.createNamedQuery("CseLabAnalysis.findAll").getResultList();
        }
    ...........
    
    }

    SessionBean:
    Code:
    @Stateless(name = "LabEJB", mappedName = "LabEJBBean")
    @PersistenceContext(name="CM_Service/EntityManager",unitName="CM_Service")
    @Remote
    @Local
    public class LabEJBBean extends AbstractStatelessSessionBean implements LabEJB, LabEJBLocal {
       
        private LabDAO labDAO;
    
        public LabEJBBean(){}
    
        protected void onEjbCreate() {
          labDAO  = (LabDAO)getBeanFactory().getBean("labDAO");
        }
    
        public List<CseLabAnalysis> queryCseLabAnalysisFindAll() {
            return labDAO.queryCseLabAnalysisFindAll();
        }
    Spring config:

    Code:
      <jee:jndi-lookup id="entityManagerFactory"
                       jndi-name="java:comp/env/persistenceUnit"/>
      <bean id="transactionManager"
            class="org.springframework.transaction.jta.WebLogicJtaTransactionManager"/>
      <bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor"/>
      <bean id="LabEJB" class="no.csam.plexus.configmanager.lab.service.LabEJBBean">
        <property name="labDAO" ref="labDAO"/>
      </bean>
      <bean id="labDAO" class="no.csam.plexus.configmanager.lab.dao.LabDAOImpl"></bean>
      <tx:annotation-driven/>
    persistence.xml:
    Code:
       <persistence-unit name="CM_Service" transaction-type="JTA">
            <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
            <jta-data-source>jdbc/ODSDS</jta-data-source>
            <properties>
                <property name="eclipselink.logging.level" value="FINE"/>
                <property name="javax.persistence.jtaDataSource"
                          value="jdbc/ODSDS"/>
               <property name="eclipselink.target-server" value="WebLogic_10"/>
            </properties>
        </persistence-unit>

    Any hints or guidance will be appriciated.
    Thanks in advance
Working...
X