SessionFactory problem

Hi everyone. Here is my situation :<br />b I have a class named UserHome generated by HibernateTool which contain briefly this :<br /><br />package rdev.data;<br /><br />// Generated 21 oct. 2008 18:08:40 by Hibernate Tools 3.2.1.GA<br />import ...<br /><br />/**<br /> * Home object for domain model class User.<br /> * @see rdev.data.User<br /> * @author Hibernate Tools<br /> */<br />public class UserHome {<br />]private static final Log log = LogFactory.getLog(UserHome.class);<br /><br />]private final SessionFactory sessionFactory = getSessionFactory();<br /><br />]protected SessionFactory getSessionFactory() {<br />]]try {<br />]]]return (SessionFactory) new InitialContext()<br />]]]]].lookup("SessionFactory");<br />]]} catch (Exception e) {<br />]]]log.error("Could not locate SessionFactory in JNDI", e);<br />]]]throw new IllegalStateException(<br />]]]]]"Could not locate SessionFactory in JNDI");<br />]]}<br />]}<br /><br />]public void persist(User transientInstance) {}<br /><br />]public void attachDirty(User instance) {}<br /><br />]public void attachClean(User instance) {}<br /><br />]public void delete(User persistentInstance) {}<br /><br />]public User merge(User detachedInstance) {}<br /><br />]public User findById(java.lang.Integer id) {}<br /><br />]public List findByExample(User instance) {}<br /><br />}<br /><br />b I have created a custom class which inherit from this USerHome class :<br /><br />package rdev.dao;<br /><br />import ...<br /><br />public class UserDAO extends UserHome{<br />]public List<User> findAll()<br />]{<br />]]Session session = HibernateUtil.getSessionFactory().getCurrentSession();<br />]]session.beginTransaction();<br />]]List<User> l = userHome.findByExample(new User());<br />]]return l;<br />]}<br />]<br />]public List<User> getOnlineUser()<br />]{<br />]]Session session = HibernateUtil.getSessionFactory().getCurrentSession();<br />]]session.beginTransaction();<br />]]User u = new User();<br />]]u.setStatus(1);<br />]]List<User> l = userHome.findByExample(u);<br />]]return l;<br />]}<br />]<br />]public String sayKikoo()<br />]{<br />]]return "Kikoo !";<br />]}<br /><br />}<br /><br />b I have configured a remote service in the remoting-config.xml using this last class :<br /><br /><service id="remoting-service" <br />]class="flex.messaging.services.RemotingService"><br />]<adapters><br />]]<adapter-definition id="java-object" class="flex.messaging.services.remoting.adapters.JavaAdapter" default="true"/><br />]</adapters><br /><br />]<default-channels><br />]]<channel ref="my-amf"/><br />]</default-channels><br />]<br />]<destination id="user"><br />]]<properties><br />]]]<source>rdev.dao.UserDAO</source><br />]]]<scope>application</scope><br />]]</properties><br />]</destination><br /><br /></service><br /><br />b The problem that I get, is when i'm starting Tomcat and is reaching the destination "user" in loading process I get this error :<br /><br />[BlazeDS] MessageBroker with id '__default__' is starting.<br />[BlazeDS] MessageBroker id: __default__ classLoader is: the MessageBroker's class loader and the context class loader (classLoader hashCode: 11688861 (parent hashCode: 17517359 (parent system))<br />[BlazeDS] Service with id 'authentication-service' is starting.<br />[BlazeDS] Service with id 'authentication-service' is ready (startup time: '0' ms)<br />[BlazeDS] Service with id 'remoting-service' is starting.<br />21 oct. 2008 22:15:03 rdev.data.UserHome getSessionFactory<br />GRAVE: Could not locate SessionFactory in JNDI<br />javax.naming.NameNotFoundException: Le Nom SessionFactory n'est pas lié à ce Contexte<br />   at org.apache.naming.NamingContext.lookup(NamingContext.java:770)<br />   at org.apache.naming.NamingContext.lookup(NamingContext.java:153)<br />   at org.apache.naming.SelectorContext.lookup(SelectorContext.java:137)<br />....<br /><br />"Le Nom SessionFactory n'est pas lié à ce Contexte" could be translated in :<br />"The SessionFactory Name is not linked to this Context"<br /><br />I have inherited UserDAO from UserHome because I believed it's the cleanest way to use the generated method from Hibernate.<br />If i removed it, the start process works fine but I'll need to instanciate a new UserHome everytime i would want to do a database operation.<br />How could I avoid instanciate it everytime and get my Tomcat starting properly ? I hope i'm clear enough. <br />Regards.

Hi. I think you need to change the class generated by hibernate to not initialize the sessionFactory variable when the class gets instanciated.
private final SessionFactory sessionFactory = getSessionFactory();
I don't think there is a way to get the behavior you want without changing the code.
-Alex

Similar Messages

  • SelectOneChoice problem with SessionFactory.detach

    Hello,
    I have this problem , i have mapped two table (A, B) with one to one mapping eg.
    The descriptor A maps the fields like
    Table A,
    id_a ----- direct mapping
    name --- direct mapping
    tableB ...one to one mapping
    The descriptor B maps the fields like
    Table B
    id_b -- direct mapping
    name direct mapping
    tableACollection --- one to many mapping
    then I expose the metods in a SessionBean
    FindAllTableA
    FindAllTableB
    In the findAllTableA i use SessionFactory.detach becouse i have to bild a edit form for Table A
    The problem is, i have built a page form with ADF for Table A with input field for id_a and name, and select one choice for tableB mapping, when i run the page the selectonechoice field doesn't display the value (The list is ok .. it ' is based on FindAllTableB). If i dont use SessionFactory.detach the selectonechoice works fine...but i can't update the table.
    Anyone can Help me?
    Thank you.

    Hi,
    try without the leading slash
    skin/images/detach.png
    Frank

  • Hibernate - Spring - problem with mapping (many-to-many)

    Hello,
    I want to map the following situation. I have a table called EDUCATION and a table called SCHOOLS. Between those tables I have an associative table called EDUCATION_SCHOOLS. The (usefull) fields:
    EDUCATION:
    id (long) - PK
    name (varchar)
    versionNr (long)
    SCHOOLS:
    id (long) - PK
    name (varchar)
    versionNr (long)
    EDUCATION_SCHOOLS:
    id (long) - PK
    education_id (long) (FK to EDUCATION.id)
    school_id (long) (FK to SCHOOLS.id)
    name (varchar)
    versionNr (long)
    Their is a Unique Constraint between EDUCATION_SCHOOLS.education_id and EDUCATION_SCHOOLS.school_id.
    What I want to be able to do:
    EDUCATION: select, update, insert
    SCHOOLS: select, update, insert
    EDUCATION_SCHOOLS: select, update (only the non-FK fields), insert
    I never want to delete anything in those tables. (and it's never ever going to be an option either)
    Hibernate version:
    Hibernate-Version: 3.0.5
    Mapping documents:
    Education:
    <hibernate-mapping>
         <class name="##.Education" table="EDUCATION">
              <id name="id" column="ID" type="java.lang.Long">
                   <generator class="sequence">
                        <param name="sequence">EDUCATION_SEQ</param>
                   </generator>
              </id>
              <version name="versionNr" column="VERSIONNR" type="long"/>
              <property name="name" column="NAME" type="string" />
            <set name="SCHOOLS" table="EDUCATION_SCHOOLS">
                <key column="EDUCATION_ID" />
                <many-to-many class="##.Schools" column="SCHOOL_ID" lazy="false" />
            </set>
    </hibernate-mapping>
    Schools:
    <hibernate-mapping>
         <class name="##.Schools" table="SCHOOLS">
              <id name="id" column="ID" type="java.lang.Long">
                   <generator class="sequence">
                        <param name="sequence">SCHOOLS_SEQ</param>
                   </generator>
              </id>
              <version name="versionNr" column="VERSIONNR" type="long"/>
              <property name="name" column="NAAM_NAME" type="string" />
            <set name="educations" table="EDUCATION_SCHOOLS" inverse="true" cascade="none">
                <key column="SCHOOL_ID" />
                <many-to-many class="##.Schools" column="SCHOOL_ID" lazy="proxy"/>
            </set>
    </hibernate-mapping>
    Education_schools:
    <hibernate-mapping>
    <class name="##.EducationSchools" table="EDUCATION_SCHOOLS">
               <id name="id" column="ID" type="java.lang.Long" unsaved-value="0">
                   <generator class="sequence">
                        <param name="sequence">SEQ_EDUCATION_SCHOOLS</param>
                   </generator>
              </id>
              <version name="versionNr" column="VERSIONNR" type="long" />
              <many-to-one name="education" class="##.Education" cascade="none" lazy="proxy"
                           column="EDUCATION_ID" not-null="true"/>
            <many-to-one name="schools" class="##.Schools" cascade="none" lazy="proxy"
                        column="SCHOOL_ID" not-null="true"/>  
    </hibernate-mapping>   
    Name and version of the database you are using:
    Oracle XE 10g
    I am able to:
    EDUCATION: select, insert, update
    SCHOOLS: select, insert, update
    EDUCATION_SCHOOLS: select
    Problems:
    EDUCATION_SCHOOLS: when I try to insert, I sometimes get unique constraint violations. (when I should get them, thus I'm trying to insert something that already exists .. but how do I stop Hibernate from Inserting?)
    EDUCATION_SCHOOLS: when I try to update, sometimes it works, but often I get:
    23:03:55,484 [http-8081-1] ERROR be.vlaanderen.lne.vea.epb.ui.struts.EpbExceptionHandler - org.springframework.orm.hibernate3.HibernateOptimisticLockingFailureException: Object of class [##.EducationSchools] with identifier [null]: optimistic locking failed; nested exception is org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [##.EducationSchools#<null>]
    ex.getMessage() Object of class [##.EducationSchools] with identifier [null]: optimistic locking failed; nested exception is org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [##.EducationSchools#<null>]
    org.springframework.orm.hibernate3.HibernateOptimisticLockingFailureException: Object of class [##.EducationSchools] with identifier [null]: optimistic locking failed; nested exception is org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [##.EducationSchools#<null>]
    Caused by: org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect):As you can see from the stacktrace I use Spring for the transactionManager: org.springframework.orm.hibernate3.HibernateTransactionManager in which I use e sessionFactory: org.springframework.orm.hibernate3.LocalSessionFactoryBean
    In my DAO, I try to save with the regular this.getHibernateTemplate().saveOrUpdate that has always worked for me.
    Another problem I have:
    when i update "name" in EDUCATION, the records with that ID are delete from EDUCATION_SCHOOLS ...
    As I am experiencing 3 different problems, I'm pretty sure something is wrong in the mapping files .. however I fail to find out what .. Any input would be greatly appreciated.
    (I translated some class/table-names, that's what the ## cause)
    Edited by: Bart_Blommaerts on Jul 29, 2008 11:53 PM

    Thank you for your input.
    When I try what you suggest, I still get the same error:
    16:39:30,406 [http-8081-1] ERROR ###.EpbExceptionHandler - org.springframework.orm.hibernate3.HibernateOptimisticLockingFailureException: Object of class [###.EducationSchools] with identifier [2]: optimistic locking failed; nested exception is org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [###.EducationSchools#2]
    ex.getMessage() Object of class [###.EducationSchools] with identifier [2]: optimistic locking failed; nested exception is org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [###.EducationSchools#2]
    org.springframework.orm.hibernate3.HibernateOptimisticLockingFailureException: Object of class [###.EducationSchools] with identifier [2]: optimistic locking failed; nested exception is org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [###.EducationSchools#2]
    Caused by: org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [###.EducationSchools#2]If you had to map the database tables, I'm trying to map, how would you do it?

  • Problem with Hibernate Connection and MySQL

    I have the following setup:
    J2EE web-application, Java Servlets, Jsp, Hibernate for DB persistence, MySQL 4 (InnoDB tables)
    I have not specified any connection pool parameters (c3p0) in my hibernate.cfg.xml, as the default settings should suffice for my purposes.
    I use the SessionFactory object as follows.
    In my database access class, I have a static declaration that initialises the new SessionFactory.
    Then, I use Session session = sessionFactory.getSession(); and session.close(); to do my DB access.
    Likewise, when storing data into the DB, I use a Transaction object, and use transaction.commit(); at the end of database access.
    The problem is:
    When I store data into the database, the changes do not occur on the website. In other words, the data gets stored into the tables (I check that via phpMyAdmin) but when accessing it, it only gets the old data. This is a serious problem as I am developing a website with attached CMS that will be used to update the pages.
    The OTHER problem is:
    Instead of having a static initialisation of the SessionFactory object, I created a new one every time I needed to access the database. Although I had a sessionFactory.close(); statement at the end of the database acccess, I got an exception:
    "java.sql.SQLException: User db_user already has more than 'max_user_connections' active connections"
    At the very moment I don't have access to my code.
    If somebody has a suggestion or a solution to the problem, please reply.
    Also, I will supply any code that is necessary to identify the problem.
    Anders

    Thanks for the tip, but how do you mean to update the object?
    Here is the code that stores the data into the database:
    'sessionFactory' is a static SessionFactory object.
         public static int saveOrUpdate ( Object object ) {
              int flag = 0; // 0 is true
              LOG.info("CMSLogic >>> saveOrUpdate() - object: " + object );
              Session session = null;
              Transaction transaction = null;
              try {
                   session = sessionFactory.openSession();
                   transaction = session.beginTransaction();
                   LOG.info("CMSLogic >>> saveOrUpdate() - object to save or update: " + object );
                   session.saveOrUpdate(object);
                   // Flush the session
                   if ( session!= null )
                        session.flush();
                   transaction.commit();
              } catch ( Exception e ) {
                   e.printStackTrace ();
                   transaction.rollback();
                   flag = 1;
              } finally {
                   try{
                        if (session != null) {
                             session.close();
                   } catch (Exception e) {
                        LOG.error("CMSLogic >>> saveOrUpdate() - threw exception: " + e);
              return flag;
         }Further, here is the code that fetches the data from the DB:
         public static Item getItemByURL ( String url ) {
              // Verify the URL
              if ( url.charAt(0) == '/' ) url = url.substring (1);
              String [] urlArr = url.split( "/" );
              LOG.info("BusinessLogic >>> getItemByURL() - split url: urlArr.length: " + urlArr.length );
              for ( int i = 0; i < urlArr.length; i++ )
                   System.out.println ( urlArr[i] + ", " );
              if ( urlArr == null ) return null;
              if ( urlArr.length == 0 ) return null;
              if ( urlArr.length > 4 ) return null; // If the path depth is more than 3 levels, abort
              // Fetch data from DB
              List<Item> items = null;
              Session session = null;
              Query query = null;
              try {
                   session = sessionFactory.openSession();
                   if ( urlArr.length == 1 ) {
                        query = session.createQuery(
                             "FROM Item WHERE section.sectionKey LIKE 'root' " +
                             "AND filename LIKE '" + urlArr[0] + "'" );
                   else if ( urlArr.length == 2 ) {
                        query = session.createQuery(
                             "FROM Item WHERE section.sectionKey LIKE '" + urlArr[0] + "' " +
                             "AND filename LIKE '" + urlArr[1] + "'" );
                   else if ( urlArr.length == 3 ) {
                        query = session.createQuery(
                             "FROM Item WHERE section.sectionKey LIKE '" + urlArr[1] + "' " +
                             "AND section.parentSection.sectionKey LIKE '" + urlArr[0] + "' " +
                             "AND filename LIKE '" + urlArr[2] + "'" );
                   else { // if ( urlArr.length == 4 ) {
                        query = session.createQuery(
                             "FROM Item WHERE section.sectionKey LIKE '" + urlArr[2] + "' " +
                             "AND section.parentSection.sectionKey LIKE '" + urlArr[1] + "' " +
                             "AND section.parentSection.parentSection.sectionKey LIKE '" + urlArr[0] + "' " +
                             "AND filename LIKE '" + urlArr[3] + "'" );
                   items = query.list();
                   LOG.info("BusinessLogic >>> getItemByURL() - items = query.list(): " + items );
                   // Load the related revisions, too
                   if ( !items.isEmpty() ) {
                        Hibernate.initialize ( items.get(0).getRevisions() );
                        LOG.info("BusinessLogic >>> getItemByURL() - initialised revisions for item." );
                        Hibernate.initialize ( items.get(0).getRevisions().get(0).getTemplate() );
                        LOG.info("BusinessLogic >>> getItemByURL() - initialised template for first revision." );
                   // Flush the session
                   if ( session!= null )
                        session.flush();
              } catch ( Exception e ) {
                   e.printStackTrace ();
                   LOG.error("BusinessLogic >>> getItemByURL() - threw exception: " + e );
              } finally {
                   session.close();
                   //sessionFactory.close(); // !!!???
              // Return query results
              if ( items == null ) return null;
              else if ( items.isEmpty() == true ) return null;
              else {
                   LOG.info("BusinessLogic >>> getItemByURL() - items.get(0).getRevisions().size(): " + items.get(0).getRevisions().size() );
                   LOG.info("BusinessLogic >>> getItemByURL() - items.get(0).getRevisions().get(0): " + items.get(0).getRevisions().get(0) );
                   return items.get(0);
         }Any constructive suggestions and helpful comments are more than welcome.
    I have been struggling with this problem for a while now.
    Anders

  • Weblogic 10.3.5.0 problem with hibernate criteria

    Hi,
    I have problim with using Hibernate Criteria on Weblogic server. Everithing works fine on Tomcat.
    On weblogic I can execute this on Weblogic :
    Query query = sessionFactory.getCurrentSession().createSQLQuery("select sysdate from dual");//To get string date
    String result = query.uniqueResult().toString();
    ,but I have problem with executing criteria which work on tomcat:
         Criteria crit=sessionFactory.getCurrentSession().createCriteria(MyclassWithHibernate.class);
         crit.setFirstResult(0);
         crit.setMaxResults(1);
         return (MyclassWithHibernate) crit.uniqueResult();
    On weblogic, same criteria return me null and I get this exception:
    java.lang.NullPointerException
         at test.Rasa.getValueTest(Rasa.java:68)
         at test.Rasa$$FastClassByCGLIB$$b6e6c0b9.invoke(<generated>)
         at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:191)
         at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:692)
         at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
         at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
         at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
         at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:625)
         at test.Rasa$$EnhancerByCGLIB$$e20363db.getValueTest(<generated>)
         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 flex.messaging.services.remoting.adapters.JavaAdapter.invoke(JavaAdapter.java:418)
         at flex.messaging.services.RemotingService.serviceMessage(RemotingService.java:183)
         at flex.messaging.MessageBroker.routeMessageToService(MessageBroker.java:1400)
         at flex.messaging.endpoints.AbstractEndpoint.serviceMessage(AbstractEndpoint.java:1005)
         at flex.messaging.endpoints.AbstractEndpoint$$FastClassByCGLIB$$1a3ef066.invoke(<generated>)
         at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:191)
         at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:692)
         at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
         at org.springframework.flex.core.MessageInterceptionAdvice.invoke(MessageInterceptionAdvice.java:66)
         at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
         at org.springframework.aop.framework.adapter.ThrowsAdviceInterceptor.invoke(ThrowsAdviceInterceptor.java:124)
         at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
         at org.springframework.aop.framework.Cglib2AopProxy$FixedChainStaticTargetInterceptor.intercept(Cglib2AopProxy.java:576)
         at flex.messaging.endpoints.AMFEndpoint$$EnhancerByCGLIB$$64941f01.serviceMessage(<generated>)
         at flex.messaging.endpoints.amf.MessageBrokerFilter.invoke(MessageBrokerFilter.java:103)
         at flex.messaging.endpoints.amf.LegacyFilter.invoke(LegacyFilter.java:158)
         at flex.messaging.endpoints.amf.SessionFilter.invoke(SessionFilter.java:44)
         at flex.messaging.endpoints.amf.BatchProcessFilter.invoke(BatchProcessFilter.java:67)
         at flex.messaging.endpoints.amf.SerializationFilter.invoke(SerializationFilter.java:166)
         at flex.messaging.endpoints.BaseHTTPEndpoint.service(BaseHTTPEndpoint.java:291)
         at flex.messaging.endpoints.AMFEndpoint$$EnhancerByCGLIB$$64941f01.service(<generated>)
         at org.springframework.flex.servlet.MessageBrokerHandlerAdapter.handle(MessageBrokerHandlerAdapter.java:101)
         at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:771)
         at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716)
         at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
         at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
         at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
         at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
         at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:111)
         at java.security.AccessController.doPrivileged(Native Method)
         at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
         at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:413)
         at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:94)
         at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:161)
         at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:136)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
         at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
         at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
         at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
    Enwironment is :
    WebLogic Server 10.3.5.0
    Hibernate 3.x
    Spring 3.x
    I am using this configuration i application context:
    <bean id="dataSource" class="oracle.jdbc.pool.OracleDataSource" destroy-method="close">
    <property name="connectionCachingEnabled" value="true" />
    <property name="URL" value="jdbc:oracle:thin:@address:port:db" />
         <property name="user" value="myuser"></property>
         <property name="password" value="mypass"></property>
    <property name="connectionCacheProperties">
    <props merge="default">
    <prop key="MinLimit">3</prop>
    <prop key="MaxLimit">20</prop>
    </props>
    </property>
    </bean>
    <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
    <property name="dataSource" ref ="dataSource"/>
              <property name="packagesToScan" value="test*" />
    <property name="configurationClass" value="org.hibernate.cfg.AnnotationConfiguration"/>
              <property name="hibernateProperties">
                        <props>
                        <prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop>
    <prop key="hibernate.show_sql">true</prop>
                        <prop key="hibernate.format_sql">true</prop>
                        <prop key="hibernate.use_sql_comments">true</prop>
                        <prop key="hibernate.generate_statistics">true</prop>
    </props>
              </property>
    </bean>
    Thanks for any help.

    Which code snippet is throwing the nullpointerexception?
    Does Spring create the SessionFactory?
    Maybe it is related but when running Hibernate on WebLogic you have to take care of a classloading issue with the antlr libary,
    more information can be found here: http://middlewaremagic.com/weblogic/?p=5861

  • Who can solve my problem? My problem in below.

    Who can solve my problem? My problem in below.

    hi,my problem now is :
    exception
    org.apache.jasper.JasperException
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:372)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    root cause
    java.lang.NullPointerException
         net.sf.hibernate.examples.quickstart.HibernateUtil.currentSession(HibernateUtil.java:24)
         org.apache.jsp.testCat_jsp._jspService(testCat_jsp.java:65)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    package net.sf.hibernate.examples.quickstart;
    import org.apache.commons.logging.Log;
    import org.apache.commons.logging.LogFactory;
    import net.sf.hibernate.*;
    import net.sf.hibernate.cfg.*;
    public class HibernateUtil {
    private static Log log = LogFactory.getLog(HibernateUtil.class);
    private static SessionFactory sessionFactory ;
    static {
    try {
    // Create the SessionFactory
    sessionFactory = new Configuration().configure().buildSessionFactory();
    catch (Throwable ex) {
    log.error("Initial SessionFactory creation failed.", ex);
    System.out.println(ex.toString());
    public static final ThreadLocal session = new ThreadLocal();
    public static Session currentSession() throws HibernateException {
    Session s = (Session) session.get();
    // Open a new Session, if this Thread has none yet
    if (s == null) {
    s = sessionFactory.openSession();
    session.set(s);
    return s;
    public static void closeSession() throws HibernateException {
    Session s = (Session) session.get();
    session.set(null);
    if (s != null)
    s.close();
    }

  • Mapping Problem using hibernate and annotations

    Hi,
    i am German student and new to hibernate. I established a mn conetction between to entities using hbm.xml mapping files. now I try to create the same connection applying annotations. unfortunately it does not work and I do not now why. First my error message followed by my classes and xml's:
    Initial SessionFactory creation failed.org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: domain.Termin.person in domain.Person.termine
    Exception in thread "main" java.lang.ExceptionInInitializerError
    at services.HibernateUtil.sessionFactory(HibernateUtil.java:39)
    at services.HibernateUtil.getSessionFactory(HibernateUtil.java:20)
    at test.Test.main(Test.java:20)
    Caused by: org.hibernate.AnnotationException: mappedBy reference an unknown target entity property: domain.Termin.person in domain.Person.termine
    at org.hibernate.cfg.annotations.CollectionBinder.bindStarToManySecondPass(CollectionBinder.java:552)
    at org.hibernate.cfg.annotations.CollectionBinder$1.secondPass(CollectionBinder.java:517)
    at org.hibernate.cfg.CollectionSecondPass.doSecondPass(CollectionSecondPass.java:43)
    at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1130)
    at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:316)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1286)
    at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:915)
    at services.HibernateUtil.sessionFactory(HibernateUtil.java:36)
    ... 2 more
    package domain;
    import java.util.LinkedList;
    import java.util.List;
    import domain.Termin;
    import javax.persistence.Entity;
    import javax.persistence.GeneratedValue;
    import javax.persistence.GenerationType;
    import javax.persistence.Id;
    import javax.persistence.ManyToMany;
    import javax.persistence.Table;
    @Entity
    @Table(name = "PERSON")
    public class Person {
       private long id;
       private String vorname;
       private String nachname;
       private List<Termin> termine=new LinkedList<Termin>();
       public Person() {
       @Id @GeneratedValue(strategy=GenerationType.AUTO)
       public long getId() {
          return id;
       public void setId(long id) {
          this.id = id;
       public String getNachname() {
          return nachname;
       public void setNachname(String nachname) {
          this.nachname = nachname;
       public String getVorname() {
          return vorname;
       public void setVorname(String vorname) {
          this.vorname = vorname;
       public void addTermin(Termin termin){
          termine.add(termin);
       @ManyToMany(mappedBy="person")
       public List<Termin> getTermine() {
          return termine;
       public void setTermine(List<Termin> termine) {
          this.termine = termine;
    package domain;
    import java.util.ArrayList;
    import java.util.List;
    import javax.persistence.Entity;
    import javax.persistence.GeneratedValue;
    import javax.persistence.GenerationType;
    import javax.persistence.Id;
    import javax.persistence.ManyToMany;
    import javax.persistence.Table;
    @Entity
    @Table(name = "TERMIN")
    public class Termin {
       private long id;
       private String titel;
       private Person eigentuemer;
       private List<Person> teilnehmer= new ArrayList<Person>();
       public void addTeilnehmer(Person person){
          teilnehmer.add(person);
       @ManyToMany
       public List<Person> getTeilnehmer() {
          return teilnehmer;
       public void setTeilnehmer(List<Person> teilnehmer) {
          this.teilnehmer = teilnehmer;
       public Termin() {
       @Id @GeneratedValue(strategy=GenerationType.AUTO)
       public long getId() {
          return id;
       public void setId(long id) {
          this.id = id;
       public String getTitel() {
          return titel;
       public void setTitel(String titel) {
          this.titel = titel;
       public Person getEigentuemer() {
          return eigentuemer;
       public void setEigentuemer(Person eigentuemer) {
          this.eigentuemer = eigentuemer;
    package test;
    import org.hibernate.Session;
    import org.hibernate.SessionFactory;
    import org.hibernate.Transaction;
    import org.hibernate.cfg.Configuration;
    import org.hibernate.tool.hbm2ddl.SchemaExport;
    import services.HibernateUtil;
    import domain.Person;
    import domain.Termin;
    public class Test {
       public static void main(String[] args) {
          Session session = null;
          HibernateUtil.setRecreateDB(true);
          session = HibernateUtil.getSessionFactory().getCurrentSession();
          /*      Person person1 =new Person();
          person1.setNachname("P1");
          Transaction transaction = session.beginTransaction();
          session.save(person1);
          transaction.commit();
          Person person2 =new Person();
          person2.setNachname("P2");
          session = HibernateUtil.getSessionFactory().getCurrentSession();
          transaction = session.beginTransaction();
          session.save(person2);
          transaction.commit();
          Termin termin1 =new Termin();
          termin1.setTitel("T1");
          termin1.setEigentuemer(person1);
          termin1.addTeilnehmer(person1);
          termin1.addTeilnehmer(person2);
          session = HibernateUtil.getSessionFactory().getCurrentSession();
          transaction = session.beginTransaction();
          session.save(termin1);
          transaction.commit();
       Termin termin2 =new Termin();
          termin2.setTitel("t2");
          termin2.setEigentuemer(person1);
          termin2.addTeilnehmer(person1);
          termin2.addTeilnehmer(person2);
          transaction = session.beginTransaction();
          session.save(termin2);
          transaction.commit();
          session.close();
    package services;
    import org.hibernate.SessionFactory;
    import org.hibernate.cfg.AnnotationConfiguration;
    import domain.Person;
    import domain.Termin;
    public class HibernateUtil {
       private static boolean recreateDB = false;
       public static void setRecreateDB(boolean recreateDB) {
          HibernateUtil.recreateDB = recreateDB;
       public static SessionFactory getSessionFactory() {
          if (sessionFactory == null) {
             sessionFactory = sessionFactory("hibernate.cfg.xml");
          return sessionFactory;
       private static SessionFactory sessionFactory = null;
       private static SessionFactory sessionFactory(String configurationFileName) {
          try {
             AnnotationConfiguration annotationConfiguration =
                new AnnotationConfiguration()
                .addAnnotatedClass(Person.class)
                .addAnnotatedClass(Termin.class);
             if (recreateDB) annotationConfiguration.setProperty("hibernate.hbm2ddl.auto", "create");
             annotationConfiguration.configure();
             return annotationConfiguration.buildSessionFactory();
          } catch (Throwable ex){
             System.err.println("Initial SessionFactory creation failed." + ex);
             throw new ExceptionInInitializerError(ex);
    <?xml version="1.0" encoding="utf-8"?>
    <!DOCTYPE hibernate-configuration
        PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
        "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
    <hibernate-configuration>
        <session-factory >
          <property name="hibernate.connection.driver_class">org.gjt.mm.mysql.Driver</property>
            <property name="hibernate.connection.password">application</property>
            <property name="hibernate.connection.url">jdbc:mysql://localhost/test</property>
            <property name="hibernate.connection.username">application</property>
            <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
           <property name="current_session_context_class">thread</property>
          <property name="hibernate.show_sql">true</property>
        </session-factory>
    </hibernate-configuration>

    The error message is pretty much telling you the problem:
    mappedBy reference an unknown target entity property: domain.Termin.person in domain.Person.termine
    This tells you that there's a mappedBy setting on the Person class's termine property annotation, and that the property it's referring to (the person property of the Termin class) doesn't exist.
    @ManyToMany(mappedBy="person")
    public List<Termin> getTermine() {
       return termine;
    }If we have a look at the Termin class, indeed it has the following properties:
    id
    teilnehmer
    titel
    eigentuemerAnd no person property. Remember, a property is defined by the existence of a get/set pair for the name. It's unrelated to the types returned by them and the private variables implementing them.
    mappedBy has the equivalent effect to the inverse property in a hbm.xml mapping file - it defines which entity's property will cause the foreign key value to be updated (persisting the relationship to the database). From the context of your code, I'm guessing you really want the annotation to read:
    @ManyToMany(mappedBy="teilnehmer")

  • Problem in placing hibernate.cfg.xml

    Hi,
      I have written one ejb project with hibernate in my net weaver.Now i have a problem in placing hibernate.cfg.xml.so tell me where to place it .Give some examples related to that and some related links.

    Hi,
    you can place it into the root of the EJB project as your EJBs probably access Hibernate as persistence layer. In this case make sure that you pass the string "hibernate.cfg.xml" within the method invocation when retrieving a SessionFactory as follows:
    try
    Configuration cfg = new Configuration();
    sessionFactory = cfg.configure 
         ("hibernate.cfg.xml").buildSessionFactory();
    catch (Throwable ex)
    Otherwise the Configuration file may not be found by the application class loader due to different path syntax.
    For further information you can refer to this https://www.sdn.sap.com/irj/sdn/developerareas/java?rid=/webcontent/uuid/e081a4b6-0801-0010-7fa4-c3c7a0454815#hibernate [original link is broken] [original link is broken], although the hibernate.cfg.xml file is placed in the Web-Project in this example.
    Hope this helps,
    Best regards,
    Robin

  • Hibernate Problem...

    Hi people...
    I have implemented an application which it parses an rss online and then it saves it into oracle DB through Hibernate. I am facind a problem which i cannot explain. In the first time the user is entering the rss url to a jsp then the rss is parsed the wanted values are saved into the DB and then displayed back through a jsp again. With not ending the application and going back to re-enter a new url the application throughs an exception before commiting the transaction at the Hibernate part.
    The code to the hibernate has as follows...
          try
            System.out.println("in the beggining");
            session = sf.openSession();
            trans = session.beginTransaction();
              System.out.println("in the middle");
            Rss rcv = new Rss();
            Item riv = new Item();
             riv.setRss(rcv);
            System.out.println("be4 saving");
                session.save(rcv);
              System.out.println("saved rcv");
                session.save(riv);
              System.out.println("saved riv");
              System.out.println("The trans is :    "+trans.wasCommitted());
              session.update(riv);
                trans.commit();
              System.out.println("after commit");
              System.out.println("THE SESSION: "+session.isOpen());
            session.close();
            System.out.println("THE SESSION: "+session.isOpen());
          catch(Exception exc)
            try{if(trans != null) trans.rollback();}catch(HibernateException h){System.out.println("MMMPPPOOOXXXAAA   "+ h);}
            exc.printStackTrace();
          }I debug and i came to the above conclution, failing at commit. I cant explain why because it works in the beggining. I also find out that if i dont redirect for displaying the results i can re-enter values into the DB without the exception occuring. The exception is the following...
    net.sf.hibernate.HibernateException: identifier of an instance of com.persistence.Item altered from 2190 to 2191
         at net.sf.hibernate.impl.SessionImpl.checkId(SessionImpl.java:2631)
         at net.sf.hibernate.impl.SessionImpl.flushEntity(SessionImpl.java:2454)
         at net.sf.hibernate.impl.SessionImpl.flushEntities(SessionImpl.java:2447)
         at net.sf.hibernate.impl.SessionImpl.flushEverything(SessionImpl.java:2249)
         at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2228)
         at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:61)
         at com.HibernateFactory.saveValues(HibernateFactory.java:104)
         at com.persistence.Item.setMakeCon(Item.java:85)
         at com.RssParser.endElement(RssParser.java:147)
         at oracle.xml.parser.v2.NonValidatingParser.parseElement(NonValidatingParser.java:1310)
         at oracle.xml.parser.v2.ValidatingParser.parseRootElement(ValidatingParser.java:144)
         at oracle.xml.parser.v2.NonValidatingParser.parseDocument(NonValidatingParser.java:295)
         at oracle.xml.parser.v2.XMLParser.parse(XMLParser.java:201)
         at oracle.xml.jaxp.JXSAXParser.parse(JXSAXParser.java:292)
         at javax.xml.parsers.SAXParser.parse(SAXParser.java:255)
         at com.RssParser.connect(RssParser.java:227)
         at com.ConfigServlet.doPost(ConfigServlet.java:51)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:719)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:376)
         at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:870)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:451)
         at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:218)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:119)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
         at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
         at java.lang.Thread.run(Thread.java:595)and the code for the JSP page which displays the results is:
    <%@ page contentType="text/html; charset=utf-8" language="java"
           import="com.persistence.*,net.sf.hibernate.*, com.*, java.util.*" %>
          <%
    Session ses = null;
    Transaction myTransaction = null;
    SessionFactory sf = HibernateFactory.getSessionFactory();
    System.out.println("THE SESSION: "+sf.toString());
    ses = sf.openSession();
    try
          //getSessionFactory();
          System.out.println("THE SESSION: "+ses.isOpen());
          myTransaction = ses.beginTransaction();
          Criteria query =
               ses.createCriteria(Rss.class);
          myTransaction.commit();
    } catch (Exception e) {
          //error = e.getMessage(); e.printStackTrace();
          System.out.println("THIS FAIL:    "+ e);
          try{ myTransaction.rollback(); }
          catch (Exception e2) {;}
    %>
    <HTML>
    <HEAD>
    <TITLE>List Teams</TITLE>
    </HEAD>
    <BODY>
    <%
    //Query q =HibernateFactory.session.createQuery("Select Rss from Rss as Rss");
    Query q =ses.createQuery("Select Rss from Rss as Rss");
    try{
    //ses.close();
            for (Iterator it = q.iterate(); it.hasNext();) {
                        Rss rsv = (Rss) it.next(); %>
        <table border="1">
            <tr>
                <td> <strong> Channel Title </strong></td>
                <td> <strong> Channel URL </strong></td>
                <td> <strong> Main Link </strong></td>
                <td> <strong> Last Date Built </strong></td>
                <td> <strong> Item Title </strong></td>
                <td> <strong> Item Link </strong></td>
                <td> <strong> Item Description </strong></td>
            </tr> 
            <tr>   
                <td> <%=rsv.getChannelTitle()%> </td>
                <td> <%= rsv.getChannelUrl()%> </td>
                <td> <%= rsv.getMainLink()%> </td>
                <td> <%= rsv.getLastDate()%> </td> 
                 <%       Iterator t = rsv.getItem().iterator();
                        while (t.hasNext()) {
                            Item riv =(Item)t.next();
                        %>
                <td> <%= riv.getTitle() %> </td>
                <td> <%= riv.getItemLink()%> </td>
                <td> <%= riv.getItemDescription() %></td>
             </tr>
              </table>     
              <%}
        } catch(Exception e){
               System.out.println("AOUTS: "+ e);
    finally
          try{ses.close();}
          catch (Exception e) {
          System.out.println("AOUTS: "+ e);}
    %>
    <p align="right"><a href="RssList.jsp">Add Another RSS.XML File </a> </p> 
    </BODY>
    </HTML>Do you have any ideas why this happens? I am desperate for some help.
    Thx in advance

    Ok here you go
    The Item class
    package com.persistence;
    import com.*;
    import java.util.Set;
    public class Item {
        public static String t;
        public static String link;
        public static String desc;
        public static Rss rss;
        public static long id;
        public static String num;
        public static String verify;
        public Item() {
        public String getTitle() {
            return t;
        public void setTitle(String title) {
            t = title;
            if (title != null){
           // HibernateFactory.saveValues();
        public String getItemLink() {
            //  while ( link. = null )
            // System.out.println("Getting: " + this + " value: " + link);
            return link;
        public void setItemLink(String link) {
            this.link = link;
          //  HibernateFactory.saveValues();
            // System.out.println("///////////////////////////");
            // System.out.println("this is the Rss Item Link value: "+ link);
            //  System.out.println("Setting: " + this + " value: " + link);
        public String getItemDescription() {
            return desc;
        public void setItemDescription(String desc) {
            this.desc = desc;
           // HibernateFactory.saveValues();
           // System.out.println("///////////////////////////");
            //System.out.println("this is the Rss Item Description value: "+ desc);
             public Rss getRss()
               return rss;
             public void setRss(Rss rss)
               this.rss = rss;
        public long getId() {
            return id;
        public void setId(long id) {
            this.id = id;
        public void setMakeCon(String verify){
            this.verify = verify;
            if (verify != null) {
                HibernateFactory.saveValues();
            }else if(verify == null){
                System.out.println("The VERIFY FROM item was NULL");
    package com.persistence;
    import com.*;
    import java.util.Set;
    public class Item {
        public static String t;
        public static String link;
        public static String desc;
        public static Rss rss;
        public static long id;
        public static String num;
        public static String verify;
        public Item() {
        public String getTitle() {
            return t;
        public void setTitle(String title) {
            t = title;
            if (title != null){
           // HibernateFactory.saveValues();
        public String getItemLink() {
            //  while ( link. = null )
            // System.out.println("Getting: " + this + " value: " + link);
            return link;
        public void setItemLink(String link) {
            this.link = link;
          //  HibernateFactory.saveValues();
            // System.out.println("///////////////////////////");
            // System.out.println("this is the Rss Item Link value: "+ link);
            //  System.out.println("Setting: " + this + " value: " + link);
        public String getItemDescription() {
            return desc;
        public void setItemDescription(String desc) {
            this.desc = desc;
           // HibernateFactory.saveValues();
           // System.out.println("///////////////////////////");
            //System.out.println("this is the Rss Item Description value: "+ desc);
             public Rss getRss()
               return rss;
             public void setRss(Rss rss)
               this.rss = rss;
        public long getId() {
            return id;
        public void setId(long id) {
            this.id = id;
        public void setMakeCon(String verify){
            this.verify = verify;
            if (verify != null) {
                HibernateFactory.saveValues();
            }else if(verify == null){
                System.out.println("The VERIFY FROM item was NULL");
    The Parser class
    package com;
    import com.persistence.*;
    import org.xml.sax.*;
    import org.xml.sax.helpers.DefaultHandler;
    import javax.xml.parsers.SAXParserFactory;
    import javax.xml.parsers.SAXParser;
    public class RssParser extends DefaultHandler
      boolean inTitle = false;
      boolean inChannel = false;
      boolean inChannelTitle = false;
      boolean inImage = false;
      boolean inItem = false;
      boolean inItemDescription = false;
      boolean inItemLink = false;
      boolean inChannelUrl = false;
    static StringBuffer st = new StringBuffer();
    Item rss = new Item();
    Rss mainRss = new Rss();
    HibernateFactory hf = new HibernateFactory();
      private String channeltitle = "";
      private String channelUrl = "";
        private String itemLink = "";
        public String verify = "";
      String title = "";
      public RssParser()
      public void startDocument() throws SAXException
        System.out.println("START DOCUMENT");
      public void endDocument() throws SAXException
        System.out.println("END DOCUMENT");
    public void startElement(String namespaceURI, String sName, String qName, Attributes attrs) throws SAXException
        String eName = sName; // element name
        if ("".equals(eName)) eName = qName; // not namespaceAware
        if (attrs != null)
          for (int i = 0; i < attrs.getLength(); i++)
            String aName = attrs.getLocalName(i);
            if ("".equals(aName)) aName = attrs.getQName(i);
            //System.out.print(aName +"=\""+attrs.getValue(i)+"\"");
          if (eName.equals("channel"))
          inChannel = true;
         if(eName.equals("title") && inChannel &&!inImage && !inItem )
           inChannelTitle = true; 
          if(eName.equals("url") && inChannel && inImage && !inItem )
            inChannelUrl = true;       
         if(eName.equals("image"))
           inImage=true;
          if(eName.equals("item"))
           inItem = true;
            rss.setMakeCon("");
         if(eName.equals("title") && inItem)
              inTitle = true; 
         if(eName.equals("description")&& inItem)
           inItemDescription=true;
         if(eName.equals("link")&&!inImage)
           inItemLink=true;
      public void endElement(String namespaceURI, String sName, String qName) throws SAXException
        String eName = sName; // element name
        if ("".equals(eName)) eName = qName; // not namespaceAware
           if (eName.equals("channel"))
          inChannel = false;
         if(eName.equals("title") && inChannel && !inImage && !inItem )
              inChannelTitle = false; 
                mainRss.setChannelTitle(channeltitle);
                if(channeltitle != null){
                rss.setMakeCon("OK");}
                //hf.channelTitle();
              System.out.println("///////////////////////////");
          if (eName.equals("url")&& inChannel && inImage && !inItem)
          inChannelUrl = false;
              mainRss.setChannelUrl(channelUrl);
             // System.out.println("the CHANNEL URLIS:   "+sc);
              //hf.channelUrl();
              System.out.println("///////////////////////////");
             if(eName.equals("image"))
           inImage=false;
         if(eName.equals("item"))
           inItem = false;
           channeltitle = "";
    //         rss.setMakeCon("");
         if(eName.equals("title") && inItem)
              inTitle = false; 
         if(eName.equals("description"))
           inItemDescription=false;
           System.out.println("\n");
        if(eName.equals("link")&&!inImage)
           inItemLink=false;
      public void connect() throws Exception
        String file;
        file = ConfigServlet.getAddress();
        //con.setRequestMethod("POST");
        // Use the default (non-validating) parser
        SAXParserFactory factory = SAXParserFactory.newInstance();
        //Set validation on
        factory.setValidating(true);
        // Parse the input
        SAXParser saxParser = factory.newSAXParser();
        saxParser.parse(file, this); 
      public void characters (char ch[], int start, int length)
        String sc = new String( ch, start, length ); 
        if(inChannelTitle)
          //System.out.print(sc);
          channeltitle = channeltitle + sc;
        if(inTitle)
          //System.out.println(sc);
          rss.setTitle(sc);
          //hf.title();
          //System.out.println("///////////////////////////");
        if(inItemDescription)
         // System.out.println("///////////////////////////");
         rss.setItemDescription(sc);
         //hf.itemDescription();
          if(inChannelUrl){ 
              channelUrl = channelUrl + sc;
        if(inItemLink)
            rss.setItemLink(sc);
            itemLink = sc;
            System.out.println("the item link   "+itemLink);
         //   hf.itemLink();
         // System.out.println(sc);
    }There are many things for testing in there. Code is not in its best condition. Thing might be wrong implemented, trying my best here...:)

  • Hibernate 3 + Oracle Driver 10g = problem

    Good Day.
    I'm trying to use Oracle 10g driver to work with Oracle 9i Database through Hibernate 3.0.5. And I'm getting the following exception when Hibernate tries to build its SessionFactory:
    11:09:51,831 WARN SettingsFactory:103 - Could not obtain connection metadata
    java.sql.SQLException: ORA-00604: error occurred at recursive SQL level 1
    ORA-12705: invalid or unknown NLS parameter value specified
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:305)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:272)
    at oracle.jdbc.driver.T4CTTIoauthenticate.receiveOauth(T4CTTIoauthenticate.java:648)
    at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:308)
    at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:348)
    at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:151)
    at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:563)
    at java.sql.DriverManager.getConnection(DriverManager.java:512)
    at java.sql.DriverManager.getConnection(DriverManager.java:140)
    at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:110)
    at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:72)
    at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1463)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1004)
    1. Hibernate 3.0.5 + Oracle Driver 9i works perfectly.
    2. In Windows (XP) Control Panel -> Regional and Language Options -> Advanced -> Language for non-Unicode programs
    the settings is "Russian". If switch to "English (Unated States)" - the problem dissapears.
    3. Two jars for oracle are included into the project:
    ojdbc14.jar - jar, containing OracleDriver 10g
    orai18n.jar - jar for internationalization
    Could you help me with this Exception, please.
    Best regards,
    Roman

    yorkroad wrote:
    TheAvalanche wrote:
    You need to specify your classes in the persistence.xml by adding the following after the provider-tagTrue...providing they are not already in the same deployment unit (the jar with persistence.xml in it) as they will be automagically registered with the PU.Not with Hibernate as far as I know, or it requires an additional setting in persistence.xml or something (I am not so well-versed in JPA / Hibernate)

  • Stored function call problem

    I've been trying out this feature as it was shown in adfdeveloperguide. that is, on page 3-26/27
    StoredFunctionCall functionCall = new StoredFunctionCall();
    functionCall.setProcedureName("READ_EMPLOYEE");
    functionCall.addNamedArgument("EMP_ID");
    functionCall.setResult("FUNCTION_RESULT", String);
    ReadObjectQuery query = new ReadObjectQuery();
    query.setCall(functionCall);
    query.addArgument("EMP_ID");
    Vector args = new Vector();
    args.addElement(new Integer(44));
    Employee employee = (Employee) session.executeQuery(query, args);
    in my version it is:
    StoredFunctionCall fCall = new StoredFunctionCall();
    fCall.setProcedureName("f_milos");
    fCall.addNamedArgument("x");
    fCall.setResult("FUNCTION_RESULT", String.class);
    ReadObjectQuery query = new ReadObjectQuery();
    query.setCall(fCall);
    query.addArgument("x");
    Vector args = new Vector();
    args.addElement(new Integer(2));
    String result = (String) session.executeQuery(query,args);
    where f_milos is my stored function. as for the session, I got it in this way
    Session session=new SessionFactory("META-INF/sessions.xml", "default").acquireSession();
    like it was done in my session bean.
    dunno, maybe thats the source of the problem.
    now, when I come to executeQuery, following error pops:
    javax.faces.el.EvaluationException: Exception [TOPLINK-6029] (Oracle TopLink - 10g Release 3 (10.1.3.0.0) (Build 060118)): oracle.toplink.exceptions.QueryException
    Exception Description: A reference class must be provided.
    Query: ReadObjectQuery().
    help?

    Well, previously you were calling getDBTransaction() on an explicit Application Module object, whereas now, you do:
    st = getDBTransaction().createCallableStatement("begin ? := "stmt";end;",0);which means that your code must be inside of an application module in order to work. Do you see the difference?
    I'll mention that you shouldn't generally be doing DB calls in your ViewController/UserInterface layer - DB code belongs in the model.
    John

  • Problems with the ADF Tutorial for J2EE developers.

    Hi guys.
    I have completed the ADF tutorial for 4GL developers withhout any major hickups. Now I have been doing the ADF tutorial for J2EE developers (locate here http://www.oracle.com/technology/obe/adf_tutorial_1013/index.htm).
    I ran into some problems around chapter 6 and after failing understanding the errors I loaded up the applicationscripts from the tutorial. However, I get an error from this script. I have tried to load up both end of chapter 5,6 and 7 and get the same error. So now I am at a total loss. So, I am turning to you. I have copied the entire error message below.
    Unfortunately JDeveloper translates some keywords to Norwegian and I have tried to translate them back into english. Forgive me if its not 100% accurate but i think you will understand the keyword. I've translated these four keywords:
    - Internal Exception
    - I/O-exception
    - Errorcode
    - Exception
    The error message:
    2006-08-08 09:41:53.081 ERROR J2EE EJB8006 [SRPublicFacade:public oracle.srdemo.datamodel.Users oracle.srdemo.datamodel.SRPublicFacadeBean.findUserByEmail(java.lang.String)] exception occurred during method invocation: javax.ejb.EJBException: Exception [TOPLINK-4002] (Oracle TopLink - 10g Release 3 (10.1.3.0.0) (Build 060118)): oracle.toplink.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: I/O-exception: The Network Adapter could not establish the connectionErrorcode: 17002; nested exception is: Exception [TOPLINK-4002] (Oracle TopLink - 10g Release 3 (10.1.3.0.0) (Build 060118)): oracle.toplink.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: I/O-exception: The Network Adapter could not establish the connectionErrorcode: 17002
    2006-08-08 09:41:53.111 WARNING JBO-29000: JBO-29000: Exception [TOPLINK-4002] (Oracle TopLink - 10g Release 3 (10.1.3.0.0) (Build 060118)): oracle.toplink.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: I/O-exception: The Network Adapter could not establish the connectionErrorcode: 17002; nested exception is: Exception [TOPLINK-4002] (Oracle TopLink - 10g Release 3 (10.1.3.0.0) (Build 060118)): oracle.toplink.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: I/O-exception: The Network Adapter could not establish the connectionErrorcode: 17002
    2006-08-08 09:41:53.111 WARNING JBO-29000: Exception [TOPLINK-4002] (Oracle TopLink - 10g Release 3 (10.1.3.0.0) (Build 060118)): oracle.toplink.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: I/O-exception: The Network Adapter could not establish the connectionErrorcode: 17002; nested exception is: Exception [TOPLINK-4002] (Oracle TopLink - 10g Release 3 (10.1.3.0.0) (Build 060118)): oracle.toplink.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: I/O-exception: The Network Adapter could not establish the connectionErrorcode: 17002
    2006-08-08 09:41:53.111 WARNING Exception [TOPLINK-4002] (Oracle TopLink - 10g Release 3 (10.1.3.0.0) (Build 060118)): oracle.toplink.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: I/O-exception: The Network Adapter could not establish the connectionErrorcode: 17002; nested exception is: Exception [TOPLINK-4002] (Oracle TopLink - 10g Release 3 (10.1.3.0.0) (Build 060118)): oracle.toplink.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: I/O-exception: The Network Adapter could not establish the connectionErrorcode: 17002
    2006-08-08 09:41:53.111 WARNING JBO-29000: JBO-29000: Exception [TOPLINK-4002] (Oracle TopLink - 10g Release 3 (10.1.3.0.0) (Build 060118)): oracle.toplink.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: I/O-exception: The Network Adapter could not establish the connectionErrorcode: 17002; nested exception is: Exception [TOPLINK-4002] (Oracle TopLink - 10g Release 3 (10.1.3.0.0) (Build 060118)): oracle.toplink.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: I/O-exception: The Network Adapter could not establish the connectionErrorcode: 17002
    2006-08-08 09:41:53.111 WARNING JBO-29000: Exception [TOPLINK-4002] (Oracle TopLink - 10g Release 3 (10.1.3.0.0) (Build 060118)): oracle.toplink.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: I/O-exception: The Network Adapter could not establish the connectionErrorcode: 17002; nested exception is: Exception [TOPLINK-4002] (Oracle TopLink - 10g Release 3 (10.1.3.0.0) (Build 060118)): oracle.toplink.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: I/O-exception: The Network Adapter could not establish the connectionErrorcode: 17002
    2006-08-08 09:41:53.111 WARNING Exception [TOPLINK-4002] (Oracle TopLink - 10g Release 3 (10.1.3.0.0) (Build 060118)): oracle.toplink.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: I/O-exception: The Network Adapter could not establish the connectionErrorcode: 17002; nested exception is: Exception [TOPLINK-4002] (Oracle TopLink - 10g Release 3 (10.1.3.0.0) (Build 060118)): oracle.toplink.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: I/O-exception: The Network Adapter could not establish the connectionErrorcode: 17002
    2006-08-08 09:41:53.111 WARNING JBO-29000: JBO-29000: javax.servlet.jsp.el.ELException: An error occurred while getting property "userId" from an instance of class oracle.srdemo.view.UserInfo
    2006-08-08 09:41:53.111 WARNING JBO-29000: javax.servlet.jsp.el.ELException: An error occurred while getting property "userId" from an instance of class oracle.srdemo.view.UserInfo
    Thanks for any help though.

    Hi,
    I tried to follow the tutorial using a mysql database, everything was fine till I tried to run the application I`ve got this error. Please help me, I can't resolve this problem. I test the jdbc driver and it is ok, I can use it from a simple java class but I can not use it from the web project.
    [TopLink - Información]: 2006.08.09 12:52:08.238--ServerSession(1209)--Thread(Thread[ApplicationServerThread-0,5,RequestThreadGroup])--TopLink, versión: Oracle TopLink - 10g Release 3 (10.1.3.0.0) (Build 060118)
    [TopLink - Configuración]: 2006.08.09 12:52:08.254--ServerSession(1209)--Connection(1210)--Thread(Thread[ApplicationServerThread-0,5,RequestThreadGroup])--conectando (DatabaseLogin(
         plataforma=>MySQL4Platform
         nombre de usuario=> "saep"
         URL de origen de datos=> "jdbc:mysql://localhost/saep"
    [TopLink - Grave]: 2006.08.09 12:52:09.254--ServerSession(1209)--Thread(Thread[ApplicationServerThread-0,5,RequestThreadGroup])--Pila de Excepciones Locales:
    Excepción [TOPLINK-4002] (Oracle TopLink - 10g Release 3 (10.1.3.0.0) (Build 060118)): oracle.toplink.exceptions.DatabaseException
    Excepción Interna: java.sql.SQLException: No suitable driverCódigo de Error: 0
         at oracle.toplink.exceptions.TopLinkException.<init>(TopLinkException.java:46)
         at oracle.toplink.exceptions.DatabaseException.<init>(DatabaseException.java:51)
         at oracle.toplink.exceptions.DatabaseException.sqlException(DatabaseException.java:276)
         at oracle.toplink.sessions.DefaultConnector.connect(DefaultConnector.java:64)
         at oracle.toplink.sessions.DatasourceLogin.connectToDatasource(DatasourceLogin.java:147)
         at oracle.toplink.internal.databaseaccess.DatasourceAccessor.connect(DatasourceAccessor.java:197)
         at oracle.toplink.internal.databaseaccess.DatabaseAccessor.connect(DatabaseAccessor.java:221)
         at oracle.toplink.internal.databaseaccess.DatasourceAccessor.connect(DatasourceAccessor.java:273)
         at oracle.toplink.threetier.ConnectionPool.buildConnection(ConnectionPool.java:81)
         at oracle.toplink.threetier.ConnectionPool.startUp(ConnectionPool.java:304)
         at oracle.toplink.threetier.ServerSession.connect(ServerSession.java:431)
         at oracle.toplink.publicinterface.DatabaseSession.login(DatabaseSession.java:511)
         at oracle.toplink.tools.sessionmanagement.SessionManager.getSession(SessionManager.java:317)
         at oracle.toplink.tools.sessionmanagement.SessionManager.getSession(SessionManager.java:372)
         at oracle.toplink.util.SessionFactory.getSharedSession(SessionFactory.java:103)
         at oracle.toplink.util.SessionFactory.getSharedSession(SessionFactory.java:82)
         at oracle.toplink.util.SessionFactory.acquireSession(SessionFactory.java:114)
         at com.saep.negocio.SecretariaServiciosEJBBean.findAllAlumno(SecretariaServiciosEJBBean.java:81)
         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:585)
         at com.evermind.server.ejb.interceptor.joinpoint.EJBJoinPointImpl.invoke(EJBJoinPointImpl.java:35)
         at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
         at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
         at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
         at com.evermind.server.ejb.interceptor.system.TxRequiredInterceptor.invoke(TxRequiredInterceptor.java:55)
         at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
         at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
         at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:69)
         at com.evermind.server.ejb.StatelessSessionEJBObject.OC4J_invokeMethod(StatelessSessionEJBObject.java:86)
         at SecretariaServiciosEJBLocal_StatelessSessionBeanWrapper0.findAllAlumno(SecretariaServiciosEJBLocal_StatelessSessionBeanWrapper0.java:69)
         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:585)
         at oracle.adf.model.binding.DCInvokeMethod.invokeMethod(DCInvokeMethod.java:504)
         at oracle.adf.model.binding.DCDataControl.invokeMethod(DCDataControl.java:1796)
         at oracle.adf.model.generic.DCGenericDataControl.invokeMethod(DCGenericDataControl.java:248)
         at oracle.adf.model.binding.DCInvokeMethod.callMethod(DCInvokeMethod.java:216)
         at oracle.jbo.uicli.binding.JUCtrlActionBinding.doIt(JUCtrlActionBinding.java:1287)
         at oracle.adf.model.binding.DCDataControl.invokeOperation(DCDataControl.java:1802)
         at oracle.adf.model.generic.DCGenericDataControl.invokeOperation(DCGenericDataControl.java:266)
         at oracle.adf.model.adapter.AdapterDCService.invokeOperation(AdapterDCService.java:318)
         at oracle.jbo.uicli.binding.JUCtrlActionBinding.invoke(JUCtrlActionBinding.java:625)
         at oracle.jbo.uicli.binding.JUMethodIteratorDef$JUMethodIteratorBinding.invokeMethodAction(JUMethodIteratorDef.java:160)
         at oracle.jbo.uicli.binding.JUMethodIteratorDef$JUMethodIteratorBinding.initSourceRSI(JUMethodIteratorDef.java:542)
         at oracle.adf.model.binding.DCIteratorBinding.callInitSourceRSI(DCIteratorBinding.java:1420)
         at oracle.adf.model.binding.DCIteratorBinding.getRowSetIterator(DCIteratorBinding.java:1403)
         at oracle.adf.model.binding.DCIteratorBinding.setRangeSize(DCIteratorBinding.java:2641)
         at oracle.adf.model.binding.DCBindingContainer.internalRefreshControl(DCBindingContainer.java:2484)
         at oracle.adf.model.binding.DCBindingContainer.refresh(DCBindingContainer.java:2257)
         at oracle.adf.controller.v2.lifecycle.PageLifecycleImpl.prepareModel(PageLifecycleImpl.java:104)
         at oracle.adf.controller.v2.lifecycle.Lifecycle$8.execute(Lifecycle.java:210)
         at oracle.adf.controller.v2.lifecycle.Lifecycle.executePhase(Lifecycle.java:116)
         at oracle.adf.controller.faces.lifecycle.ADFPhaseListener.mav$executePhase(ADFPhaseListener.java)
         at oracle.adf.controller.faces.lifecycle.ADFPhaseListener$4.after(ADFPhaseListener.java:331)
         at oracle.adf.controller.faces.lifecycle.ADFPhaseListener.afterPhase(ADFPhaseListener.java:97)
         at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:211)
         at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
         at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:64)
         at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._invokeDoFilter(AdfFacesFilterImpl.java:367)
         at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._doFilterImpl(AdfFacesFilterImpl.java:336)
         at oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl.doFilter(AdfFacesFilterImpl.java:196)
         at oracle.adf.view.faces.webapp.AdfFacesFilter.doFilter(AdfFacesFilter.java:87)
         at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:15)
         at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:332)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:627)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:376)
         at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:870)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:451)
         at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:218)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:119)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
         at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
         at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:230)
         at oracle.oc4j.network.ServerSocketAcceptHandler.access$800(ServerSocketAcceptHandler.java:33)
         at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:831)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:298)
         at java.lang.Thread.run(Thread.java:595)
    Caused by: java.sql.SQLException: No suitable driver
         at java.sql.DriverManager.getConnection(DriverManager.java:545)
         at java.sql.DriverManager.getConnection(DriverManager.java:140)
         at oracle.toplink.sessions.DefaultConnector.connect(DefaultConnector.java:62)
         ... 77 more
    2006-08-09 12:52:09.270 ERROR J2EE EJB8006 [SecretariaServiciosEJB:public java.util.List com.saep.negocio.SecretariaServiciosEJBBean.findAllAlumno()] exception occurred during method invocation: javax.ejb.EJBException: Excepción [TOPLINK-4002] (Oracle TopLink - 10g Release 3 (10.1.3.0.0) (Build 060118)): oracle.toplink.exceptions.DatabaseException
    Excepción Interna: java.sql.SQLException: No suitable driverCódigo de Error: 0; nested exception is: Excepción [TOPLINK-4002] (Oracle TopLink - 10g Release 3 (10.1.3.0.0) (Build 060118)): oracle.toplink.exceptions.DatabaseException
    Excepción Interna: java.sql.SQLException: No suitable driverCódigo de Error: 0
    2006-08-09 12:52:10.770 WARNING rowIterator is null
    2006-08-09 12:52:10.770 WARNING rowIterator is null

  • Problems with deploying application

    I started on trying to get the Pentaho Business Intelligence Server (latest stable release) deployed to Oracle WebLogic. The error I get in the WebLogic console right now is below. Within this weblogic console output is a reference to a problem within my application.xml file, the contents my application.xml file is also included further down in this posting.
    +<Dec 6, 2010 7:13:33 PM EST> <Error> <J2EE> <BEA-160197> <Unable to load descriptor+
    C:\Oracle\Middleware\wlserver_10.3\samples\domains \wl_server\autodeploy\pentaho.ear/META-INF/application.xml of module pentaho.ear. The error is weblogic.descriptor.DescriptorException: Unmarshaller failed at weblogic.descriptor.internal.MarshallerFactory$1.c reateDescriptor(MarshallerFactory.java:161)
    at weblogic.descriptor.BasicDescriptorManager.createD escriptor(BasicDescriptorManager.java:323)
    at weblogic.application.descriptor.AbstractDescriptor Loader2.getDescriptorBeanFromReader(AbstractDescri ptorLoader2.java:788)
    at weblogic.application.descriptor.AbstractDescriptor Loader2.createDescriptorBean(AbstractDescriptorLoa der2.java:409)
    at weblogic.application.descriptor.AbstractDescriptor Loader2.loadDescriptorBeanWithoutPlan(AbstractDesc riptorLoader2.java:759)
    at weblogic.application.descriptor.AbstractDescriptor Loader2.loadDescriptorBean(AbstractDescriptorLoade r2.java:768)
    at weblogic.application.ApplicationDescriptor.getAppl icationDescriptor(ApplicationDescriptor.java:301)
    at weblogic.application.internal.EarDeploymentFactory .findOrCreateComponentMBeans(EarDeploymentFactory. java:178)
    at weblogic.application.internal.MBeanFactoryImpl.fin dOrCreateComponentMBeans(MBeanFactoryImpl.java:48)
    at weblogic.application.internal.MBeanFactoryImpl.rec oncileMBeans(MBeanFactoryImpl.java:157)
    at weblogic.management.deploy.internal.MBeanConverter .reconcile81MBeans(MBeanConverter.java:295)
    at weblogic.deploy.internal.targetserver.operations.R edeployOperation.compatibilityProcessor(RedeployOp eration.java:182)
    at weblogic.deploy.internal.targetserver.operations.A bstractOperation.setupPrepare(AbstractOperation.ja va:295)
    at weblogic.deploy.internal.targetserver.operations.R edeployOperation.doPrepare(RedeployOperation.java: 121)
    at weblogic.deploy.internal.targetserver.operations.A bstractOperation.prepare(AbstractOperation.java:21 7)
    at weblogic.deploy.internal.targetserver.DeploymentMa nager.handleDeploymentPrepare(DeploymentManager.ja va:749)
    at weblogic.deploy.internal.targetserver.DeploymentMa nager.prepareDeploymentList(DeploymentManager.java :1216)
    at weblogic.deploy.internal.targetserver.DeploymentMa nager.handlePrepare(DeploymentManager.java:250)
    at weblogic.deploy.internal.targetserver.DeploymentSe rviceDispatcher.prepare(DeploymentServiceDispatche r.java:160)
    at weblogic.deploy.service.internal.targetserver.Depl oymentReceiverCallbackDeliverer.doPrepareCallback( DeploymentReceiverCallbackDeliverer.java:171)
    at weblogic.deploy.service.internal.targetserver.Depl oymentReceiverCallbackDeliverer.access$000(Deploym entReceiverCallbackDeliverer.java:13)
    at weblogic.deploy.service.internal.targetserver.Depl oymentReceiverCallbackDeliverer$1.run(DeploymentRe ceiverCallbackDeliverer.java:47)
    at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapte rImpl.run(SelfTuningWorkManagerImpl.java:528)
    at weblogic.work.ExecuteThread.execute(ExecuteThread. java:201)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java :173)
    Caused by: com.bea.xml.XmlException: weblogic.descriptor.BeanAlreadyExistsException: Bean already exists:
    +"weblogic.j2ee.descriptor.ModuleBeanImpl@edc8b 460(/Mod+
    +ules[weblogic.descriptor.internal.DescriptorBeanKey@ee8 d02ab])"+
    at com.bea.staxb.runtime.internal.util.ReflectionUtil s.invokeMethod(ReflectionUtils.java:54)
    at com.bea.staxb.runtime.internal.RuntimeBindingType$ BeanRuntimeProperty.setValue(RuntimeBindingType.ja va:539)
    at com.bea.staxb.runtime.internal.AttributeRuntimeBin dingType$QNameRuntimeProperty.fillCollection(Attri buteRuntimeBindingType.java:381)
    at com.bea.staxb.runtime.internal.MultiIntermediary.g etFinalValue(MultiIntermediary.java:52)
    at com.bea.staxb.runtime.internal.AttributeRuntimeBin dingType.getFinalObjectFromIntermediary(AttributeR untimeBindingType.java:140)
    at com.bea.staxb.runtime.internal.UnmarshalResult.unm arshalBindingType(UnmarshalResult.java:200)
    at com.bea.staxb.runtime.internal.UnmarshalResult.unm arshalDocument(UnmarshalResult.java:169)
    at com.bea.staxb.runtime.internal.UnmarshallerImpl.un marshal(UnmarshallerImpl.java:65)
    at weblogic.descriptor.internal.MarshallerFactory$1.c reateDescriptor(MarshallerFactory.java:150)
    +... 24 more+
    Caused by: weblogic.descriptor.BeanAlreadyExistsException: Bean already exists:
    +"weblogic.j2ee.descriptor.ModuleBeanImpl@edc8b 460(/Modules[weblogic.descriptor.internal.DescriptorBeanKey@ee8 d02ab])"+
    at weblogic.descriptor.internal.ReferenceManager.regi sterBean(ReferenceManager.java:227)
    at weblogic.j2ee.descriptor.ApplicationBeanImpl.setMo dules(ApplicationBeanImpl.java:427)
    at sun.reflect.GeneratedMethodAccessor74.invoke(Unkno wn Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.bea.staxb.runtime.internal.util.ReflectionUtil s.invokeMethod(ReflectionUtils.java:48)
    at com.bea.staxb.runtime.internal.RuntimeBindingType$ BeanRuntimeProperty.setValue(RuntimeBindingType.ja va:539)
    at com.bea.staxb.runtime.internal.AttributeRuntimeBin dingType$QNameRuntimeProperty.fillCollection(Attri buteRuntimeBindingType.java:382)
    +... 30 more.>+
    +<Dec 6, 2010 7:13:35 PM EST> <Error> <Deployer> <BEA-149265>+
    +<Failure occurred in the execution of deployment request with ID '1291680813688' for task '1'. Error is: 'weblogic.management.DeploymentException: '+
    weblogic.management.DeploymentException:
    at weblogic.management.deploy.internal.MBeanConverter .reconcile81MBeans(MBeanConverter.java:303)
    at weblogic.deploy.internal.targetserver.operations.R edeployOperation.compatibilityProcessor(RedeployOp eration.java:180)
    at weblogic.deploy.internal.targetserver.operations.A bstractOperation.setupPrepare(AbstractOperation.ja va:295)
    at weblogic.deploy.internal.targetserver.operations.R edeployOperation.doPrepare(RedeployOperation.java: 121)
    at weblogic.deploy.internal.targetserver.operations.A bstractOperation.prepare(AbstractOperation.java:21 7)
    Truncated. see log file for complete stacktrace
    Caused By: weblogic.descriptor.BeanAlreadyExistsException: Bean already exists:
    +"weblogic.j2ee.descriptor.ModuleBeanImpl@edc8b 460(/Modules[weblogic.descriptor.internal.DescriptorBeanKey@ee8 d02ab])"+
    at weblogic.descriptor.internal.ReferenceManager.regi sterBean(ReferenceManager.java:227)
    at weblogic.j2ee.descriptor.ApplicationBeanImpl.setMo dules(ApplicationBeanImpl.java:427)
    at sun.reflect.GeneratedMethodAccessor74.invoke(Unkno wn Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    Truncated. see log file for complete stacktrace>
    +<Dec 6, 2010 7:13:35 PM EST> <Warning> <Deployer> <BEA-149004> <Failures were detected while initiating deploy task for application '_appsdir_pentaho_ear'.>+
    +<Dec 6, 2010 7:13:35 PM EST> <Warning> <Deployer> <BEA-149078> <Stack trace for message 149004 weblogic.management.DeploymentException:+
    at weblogic.management.deploy.internal.MBeanConverter .reconcile81MBeans(MBeanConverter.java:303)
    at weblogic.deploy.internal.targetserver.operations.R edeployOperation.compatibilityProcessor(RedeployOp eration.java:180)
    at weblogic.deploy.internal.targetserver.operations.A bstractOperation.setupPrepare(AbstractOperation.ja va:295)
    at weblogic.deploy.internal.targetserver.operations.R edeployOperation.doPrepare(RedeployOperation.java: 121)
    at weblogic.deploy.internal.targetserver.operations.A bstractOperation.prepare(AbstractOperation.java:21 7)
    Truncated. see log file for complete stacktrace
    Caused By: weblogic.descriptor.BeanAlreadyExistsException: Bean already exists:
    +"weblogic.j2ee.descriptor.ModuleBeanImpl@edc8b 460(/Modules[weblogic.descriptor.internal.DescriptorBeanKey@ee8 d02ab])"+
    at weblogic.descriptor.internal.ReferenceManager.regi sterBean(ReferenceManager.java:227)
    at weblogic.j2ee.descriptor.ApplicationBeanImpl.setMo dules(ApplicationBeanImpl.java:427)
    at sun.reflect.GeneratedMethodAccessor74.invoke(Unkno wn Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    Truncated. see log file for complete stacktrace>
    The application.xml file that the above code is referencing looks like this:
    +<?xml version='1.0' encoding='UTF-8'?>+
    +<application xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">+
    +<module>+
    +<web>+
    +<web-uri>pentaho-ears/jboss/portal/pentaho.war</web-uri>+
    +<context-root>pentaho</context-root>+
    +</web>+
    +</module>+
    +<module>+
    +<web>+
    +<web-uri>pentaho-portal-layout.war</web-uri>+
    +<context-root>pentaho-portal-layout</context-root>+
    +</web>+
    +</module>+
    +<module>+
    +<web>+
    +<web-uri>pentaho-style.war</web-uri>+
    +<context-root>pentaho-style</context-root>+
    +</web>+
    +</module>+
    +<module>+
    +<web>+
    +<web-uri>pentaho-wars/pentaho-portal-layout.war</web-uri>+
    +<context-root>pentaho-portal-layout</context-root>+
    +</web>+
    +</module>+
    +<module>+
    +<web>+
    +<web-uri>pentaho-wars/pentaho-style.war</web-uri>+
    +<context-root>pentaho-style</context-root>+
    +</web>+
    +</module>+
    +<module>+
    +<web>+
    +<web-uri>pentaho.war</web-uri>+
    +<context-root>pentaho</context-root>+
    +</web>+
    +</module>+
    +</application>+
    Any help is appreciated
    Edited by: Wes Gibbs on Dec 6, 2010 6:18 PM

    Thank you once again Jay.  That corrected my problem.  I actually put the libraries in autodeploy\pentaho.ear\lib directory and it seemed to correct it.  I have another problem that I am unsure how to fix.  It is defined below.  The file that these errors are referring to ("applicationContext-spring-security.xml") is also posted below.  Any ideas what might be causing this issue?
    ERROR Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'filterChainProxy' defined in file
         [C:\pentaho\server\biserver-ee\pentaho-solutions\system\applicationContext-spring-security.xml]: Invocation of init method failed; nested exception is      org.springframework.beans.factory.BeanCreationException:
    Error creating bean with name 'authenticationProcessingFilter' defined
    in file [C:\pentaho\server\biserver-ee\pentaho-solutions\system\applicationCont
    ext-spring-security.xml]: Cannot resolve reference to bean 'authenticationManage
    r' while setting bean property 'authenticationManager'; nested exception is org.
    springframework.beans.factory.BeanCreationException:
    Error creating bean with na
    me 'authenticationManager' defined in file [C:\pentaho\server\biserver-ee\pentah
    o-solutions\system\applicationContext-spring-security.xml]: Cannot resolve refer
    ence to bean 'daoAuthenticationProvider' while setting bean property 'providers'
    with key [0]; nested exception is org.springframework.beans.factory.BeanCreatio
    nException:
    Error creating bean with name 'daoAuthenticationProvider' defined in
    file [C:\pentaho\server\biserver-ee\pentaho-solutions\system\applicationContext
    -spring-security-hibernate.xml]: Cannot resolve reference to bean 'userDetailsSe
    rvice' while setting bean property 'userDetailsService'; nested exception is org
    .springframework.beans.factory.BeanCreationException:
    Error creating bean with n
    ame 'userDetailsService' defined in file [C:\pentaho\server\biserver-ee\pentaho-
    solutions\system\applicationContext-spring-security-hibernate.xml]: Cannot resol
    ve reference to bean 'userRoleDao' while setting bean property 'userRoleDao'; ne
    sted exception is org.springframework.beans.factory.BeanCreationException:
    Error
    creating bean with name 'userRoleDao' defined in file [C:\pentaho\server\biserv
    er-ee\pentaho-solutions\system\applicationContext-spring-security-hibernate.xml]
    : Cannot resolve reference to bean 'sessionFactory' while setting bean property
    'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCrea
    tionException:
    Error creating bean with name 'sessionFactory' defined in file [C
    :\pentaho\server\biserver-ee\pentaho-solutions\system\applicationContext-spring-
    security-hibernate.xml]: Invocation of init method failed; nested exception is j
    ava.lang.NoClassDefFoundError: org/dom4j/DocumentException
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
    at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
    at weblogic.servlet.internal.EventsManager$FireContextListenerAction.run(EventsManager.java:481)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
    at weblogic.servlet.internal.EventsManager.notifyContextCreatedEvent(EventsManager.java:181)
    at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1863)
    at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:3126)
    at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1512)
    at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:486)
    at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:41)
    at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
    at weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:200)
    at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:247)
    at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:41)
    at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
    at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:27)
    at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:1267)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:41)
    at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:409)
    at weblogic.application.internal.EarDeployment.activate(EarDeployment.java:58)
    at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:161)
    at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:79)
    at weblogic.deploy.internal.targetserver.BasicDeployment.activate(BasicDeployment.java:184)
    at weblogic.deploy.internal.targetserver.BasicDeployment.activateFromServerLifecycle(BasicDeployment.java:361)
    at weblogic.management.deploy.internal.DeploymentAdapter$1.doActivate(DeploymentAdapter.java:51)
    at weblogic.management.deploy.internal.DeploymentAdapter.activate(DeploymentAdapter.java:200)
    at weblogic.management.deploy.internal.AppTransition$2.transitionApp(AppTransition.java:30)
    at weblogic.management.deploy.internal.ConfiguredDeployments.transitionApps(ConfiguredDeployments.java:240)
    at weblogic.management.deploy.internal.ConfiguredDeployments.activate(ConfiguredDeployments.java:169)
    at weblogic.management.deploy.internal.ConfiguredDeployments.deploy(ConfiguredDeployments.java:123)
    at weblogic.management.deploy.internal.DeploymentServerService.resume(DeploymentServerService.java:180)
    at weblogic.management.deploy.internal.DeploymentServerService.start(DeploymentServerService.java:96)
    at weblogic.t3.srvr.SubsystemRequest.run(SubsystemRequest.java:64)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
    * End of Output for the weblogic error log, the following is the text from my applicationContext-spring-security.xml file: *
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springsource.org/dtd/spring-beans.dtd">
    <!--+
    | Application context containing FilterChainProxy.
    +-->
    <beans>
    <!-- ======================== FILTER CHAIN ======================= -->
         <!--
              if you wish to use channel security, add "channelProcessingFilter," in
              front of "httpSessionContextIntegrationFilter" in the list below
         -->
         <bean id="filterChainProxy" class="org.springframework.security.util.FilterChainProxy">
              <property name="filterInvocationDefinitionSource">
                   <value>
    <![CDATA[CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON
    PATTERN_TYPE_APACHE_ANT
    /**=securityContextHolderAwareRequestFilter,httpSessionContextIntegrationFilter,httpSessionReuseDetectionFilter,logoutFilter,authenticationProcessingFilter,basicProcessingFilter,requestParameterProcessingFilter,anonymousProcessingFilter,pentahoSecurityStartupFilter,exceptionTranslationFilter,filterInvocationInterceptor]]>
                   </value>
              </property>
         </bean>
    <!-- ======================== AUTHENTICATION ======================= -->
         <bean id="authenticationManager" class="org.springframework.security.providers.ProviderManager">
              <property name="providers">
                   <list>
                        <ref bean="daoAuthenticationProvider" />
                        <ref local="anonymousAuthenticationProvider" />
                   </list>
              </property>
         </bean>
    <!-- Automatically receives AuthenticationEvent messages -->
         <bean id="loggerListener"
              class="org.springframework.security.event.authentication.LoggerListener" />
         <bean id="basicProcessingFilter"
              class="org.springframework.security.ui.basicauth.BasicProcessingFilter">
              <property name="authenticationManager">
                   <ref local="authenticationManager" />
              </property>
              <property name="authenticationEntryPoint">
                   <ref local="basicProcessingFilterEntryPoint" />
              </property>
         </bean>
         <bean id="basicProcessingFilterEntryPoint"
              class="org.springframework.security.ui.basicauth.BasicProcessingFilterEntryPoint">
              <property name="realmName" value="Pentaho Realm" />
         </bean>
    <!-- custom Pentaho begin -->
         <bean id="requestParameterProcessingFilter"
              class="org.pentaho.platform.web.http.security.RequestParameterAuthenticationFilter">
              <property name="authenticationManager">
                   <ref local="authenticationManager" />
              </property>
              <property name="authenticationEntryPoint">
                   <ref local="requestParameterProcessingFilterEntryPoint" />
              </property>
         </bean>
         <bean id="requestParameterProcessingFilterEntryPoint"
              class="org.pentaho.platform.web.http.security.RequestParameterFilterEntryPoint" />
    <bean id="pentahoSecurityStartupFilter"
    class="org.pentaho.platform.web.http.security.SecurityStartupFilter">
    <property name="injectAnonymous" value="true" />
    </bean>
    <!-- custom Pentaho end -->
         <bean id="anonymousProcessingFilter"
              class="org.springframework.security.providers.anonymous.AnonymousProcessingFilter">
              <property name="key" value="foobar" />
              <property name="userAttribute" value="anonymousUser,Anonymous" />
         </bean>
         <bean id="anonymousAuthenticationProvider"
              class="org.springframework.security.providers.anonymous.AnonymousAuthenticationProvider">
              <property name="key" value="foobar" />
         </bean>
         <bean id="httpSessionContextIntegrationFilter"
              class="org.springframework.security.context.HttpSessionContextIntegrationFilter" />
         <bean id="logoutFilter" class="org.springframework.security.ui.logout.LogoutFilter">
              <constructor-arg value="/index.jsp" />
    <!-- URL redirected to after logout -->
              <constructor-arg>
                   <list>
                        <bean class="org.pentaho.platform.web.http.security.PentahoLogoutHandler" />
                        <bean
                             class="org.springframework.security.ui.logout.SecurityContextLogoutHandler" />
                   </list>
              </constructor-arg>
              <property name="filterProcessesUrl" value="/Logout" />
         </bean>
         <bean id="securityContextHolderAwareRequestFilter"
              class="org.springframework.security.wrapper.SecurityContextHolderAwareRequestFilter" />
         <bean id="httpSessionReuseDetectionFilter"
              class="org.pentaho.platform.web.http.security.HttpSessionReuseDetectionFilter">
              <property name="filterProcessesUrl" value="/j_spring_security_check" />
              <property name="sessionReuseDetectedUrl" value="/Login?login_error=2" />
         </bean>
         <!--
              ===================== HTTP REQUEST SECURITY ====================
         -->
         <bean id="exceptionTranslationFilter"
              class="org.springframework.security.ui.ExceptionTranslationFilter">
              <property name="authenticationEntryPoint">
                   <ref local="authenticationProcessingFilterEntryPoint" />
              </property>
              <property name="accessDeniedHandler">
                   <bean class="org.springframework.security.ui.AccessDeniedHandlerImpl" />
              </property>
         </bean>
         <bean id="authenticationProcessingFilter"
              class="org.springframework.security.ui.webapp.AuthenticationProcessingFilter">
              <property name="authenticationManager">
                   <ref local="authenticationManager" />
              </property>
              <property name="authenticationFailureUrl" value="/Login?login_error=1" />
              <property name="defaultTargetUrl" value="/Home" />
              <property name="filterProcessesUrl" value="/j_spring_security_check" />
              <property name="targetUrlResolver">
                   <bean id="targetUrlResolver" class="org.springframework.security.ui.TargetUrlResolverImpl">
                        <property name="justUseSavedRequestOnGet" value="true" />
                   </bean>
              </property>
         </bean>
         <bean id="authenticationProcessingFilterEntryPoint"
              class="org.springframework.security.ui.webapp.AuthenticationProcessingFilterEntryPoint">
              <property name="loginFormUrl" value="/Login" />
              <property name="forceHttps" value="false" />
         </bean>
         <bean id="httpRequestAccessDecisionManager" class="org.springframework.security.vote.AffirmativeBased">
              <property name="allowIfAllAbstainDecisions" value="false" />
              <property name="decisionVoters">
                   <list>
                        <ref bean="roleVoter" />
                   </list>
              </property>
         </bean>
         <!--
              Note the order that entries are placed against the
              objectDefinitionSource is critical. The FilterSecurityInterceptor will
              work from the top of the list down to the FIRST pattern that matches
              the request URL. Accordingly, you should place MOST SPECIFIC (ie
              a/b/c/d.*) expressions first, with LEAST SPECIFIC (ie a/.*)
              expressions last
         -->
         <bean id="filterInvocationInterceptor"
              class="org.springframework.security.intercept.web.FilterSecurityInterceptor">
              <property name="authenticationManager">
                   <ref local="authenticationManager" />
              </property>
              <property name="accessDecisionManager">
                   <ref local="httpRequestAccessDecisionManager" />
              </property>
              <property name="objectDefinitionSource">
                   <value>
                        <!--
                             Note - the "=Nobody" below is saying that resource URLs with those
                             patterns not be available through a web call.
                        -->
    <![CDATA[
    CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON
    \A/docs/.*\Z=Anonymous,Authenticated
    \A/mantlelogin/.*\Z=Anonymous,Authenticated
    \A/mantle/mantleloginservice/*\Z=Anonymous,Authenticated
    \A/mantle/.*\Z=Authenticated
    \A/welcome/.*\Z=Anonymous,Authenticated
    \A/public/.*\Z=Anonymous,Authenticated
    \A/login.*\Z=Anonymous,Authenticated
    \A/ping/alive.gif.*\Z=Anonymous,Authenticated
    \A/j_spring_security_check.*\Z=Anonymous,Authenticated
    \A/getimage.*\Z=Anonymous,Authenticated
    \A/getresource.*\Z=Anonymous,Authenticated
    \A/admin.*\Z=Admin
    \A/auditreport.*\Z=Admin
    \A/auditreportlist.*\Z=Admin
    \A/versioncontrol.*\Z=Admin
    \A/propertieseditor.*\Z=Admin
    \A/propertiespanel.*\Z=Admin
    \A/subscriptionadmin.*\Z=Admin
    \A/resetrepository.*\Z=Admin
    \A/viewaction.*solution.admin.*\Z=Admin
    \A/scheduleradmin.*\Z=Admin
    \A/publish.*\Z=Admin
    \A/logout.*\Z=Anonymous
    \A/solutionrepositoryservice.*component=delete.*solution=system.*\Z=Nobody
    \A/solutionrepositoryservice.*solution=system.*component=delete.*\Z=Nobody
    .*system.*pentaho.xml.*=Nobody
    .*system.*applicationcontext.*.xml.*=Nobody
    .*system.*pentahoobjects.spring.xml.*=Nobody
    .*system.*pentahosystemconfig.xml.*=Nobody
    .*system.*adminplugins.xml.*=Nobody
    .*system.*plugin.properties.*=Nobody
    .*system.*publisher_config.xml.*=Nobody
    .*system.*sessionstartupactions.xml.*=Nobody
    .*system.*systemlisteners.xml.*=Nobody
    .*system.*hibernate.*=Nobody
    .*system.*birt/.*=Nobody
    .*system.*dialects/.*=Nobody
    .*system.*google/.*=Nobody
    .*system.*jasperreports/.*=Nobody
    .*system.*jfree/.*=Nobody
    .*system.*kettle/.*=Nobody
    .*system.*logs/.*=Nobody
    .*system.*metadata/.*=Nobody
    .*system.*mondrian/.*=Nobody
    .*system.*olap/.*=Nobody
    .*system.*quartz/.*=Nobody
    .*system.*simple-jndi/.*=Nobody
    .*system.*smtp-email/.*=Nobody
    .*system.*ui/.*=Nobody
    .*system.*analysistemplate.tpl.*=Nobody
    .*system.*\.\./.*=Nobody
    \A/.*\Z=Authenticated
    ]]>
                   </value>
              </property>
         </bean>
    </beans>

  • Hibernate SessionFactory in a cluster?

    I have been developing an application on WLS 8.1.4 with hibernate 3.1.2 .
              On WLS I created
              - adminServer on localhost:7001
              - MyCluster group
              - manageServer1 on localhost:7021
              - manageServer2 on localhost:7022
              I deploy TestEjb.ejb on MyCluster
              TestEjb.ejb
              - META-INF
              - ejbModule.jar
              - hibernate3.jar and lib for hibernate
              * Hibernate 3.1.2 doesn't have problem about ANTLR.
              hibernate.cfg.xml
              <property name="session_factory_name">sessionFactory</property>
              <property name="hibernate.jndi.class">weblogic.jndi.WLInitialContextFactory</property>
              <property name="hibernate.jndi.url">t3://localhost:7021</property>
              <property name="transaction.factory_class">org.hibernate.transaction.CMTTransactionFactory</property>
              <property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.WeblogicTransactionManagerLookup</property>
              SessionBean
              public class TestServiceBeanImpl
              extends TestServiceBean
              implements SessionBean
              public java.lang.Boolean testMethod() {
              try {
              new Configuration().configure().buildSessionFactory();
              } catch (Exception ex) {
              log.error("error", ex);
              throw new RuntimeException(ex);
              return null;
              public java.lang.Boolean testMethod2() {
              try {
              InitialContext ct = new InitialContext();
              Object obj = ct.lookup("sessionFactory");
              log.info("obj : " + obj);
              } catch (Exception ex) {
              ex.printStackTrace();
              throw new EJBException(ex);
              return null;
              Test client
              public class TestServiceTestClient2 {
              private TestServiceRemote testServiceRemote = null;
              private TestServiceRemoteHome testServiceRemoteHome = null;
              //Construct the EJB test client
              public TestServiceTestClient2() {
              initialize();
              try {
              testServiceRemote = testServiceRemoteHome.create();
              testServiceRemote.testMethod();
              } catch (Exception ex) {
              ex.printStackTrace();
              public void initialize() {
              try {
              //get naming context
              Context context = getInitialContext();
              //look up jndi name
              Object ref = context.lookup("TestService");
              //look up jndi name and cast to Home interface
              testServiceRemoteHome = (TestServiceRemoteHome)
              PortableRemoteObject.narrow(ref,
              TestServiceRemoteHome.class);
              } catch (Exception e) {
              e.printStackTrace();
              public Context getInitialContext() throws Exception {
              String url = "t3://127.0.0.1:7021";
              Properties properties;
              try {
              properties = new Properties();
              properties.put(Context.INITIAL_CONTEXT_FACTORY,
              "weblogic.jndi.WLInitialContextFactory");
              properties.put(Context.PROVIDER_URL, url);
              return new javax.naming.InitialContext(properties);
              } catch (Exception e) {
              throw e;
              public static void main(String[] args) {
              TestServiceTestClient2 client = new TestServiceTestClient2();
              I'm not sure about property "hibernate.jndi.url". Is it right?
              I create test client to invoke TestServiceBean method testMethod() on localhost:7021 that work I can binding "sessionFactory" on manageServer1 and manageServer2 (I use WLS console view JNDI tree on manageServer1 and manageServer2) and I invoke testMethod2() on localhost:7021, I can lookup SessionFactory object from JNDI.
              Then I change test client to invoke testMethod2() on localhost:7022, I get null from JNDI.
              This is warning on my console
              13 3 2006 18:42:21,968 WARN org.hibernate.impl.SessionFactoryObjectFactory - Not found: 2c9498dc09f356340109f36711790001
              13 3 2006 18:42:21,968 INFO test.service.TestService_8oegc0_Impl - obj : null
              How can i solve the problem?
              Thanks in advance for tips or other suggestions!
              Regards,
              piya

    ANTLR classloading ?
              http://www.hibernate.org/250.html#A25

  • TopLink deployment problem

    Hi
    I have an application using TopLink. In my development environment, i am able to access the SessionFacadeBean, directly. This is, i can do a new SessionFacadeBean(), and i get the facade and can freely invoke their methods and routines
    However, i am trying to deploy the app to a OC4J standalone, and when i do it, everytime i try to use the SessionFacadeBean methods directly, the applications crashes
    There is no much relevant information about the problem, but i have noticed one common issue:
    at oracle.toplink.util.SessionFactory.acquireSession(SessionFactory.java:116)
         at ec.com.carrasco.spyral.stgc.portal.model.app.StgcAdminFacadeBean.findAppuserSessionDataByLogin(StgcAdminFacadeBean.java:288)
         at ec.com.carrasco.spyral.stgc.portal.view.web.session.AppSessionUser.loadUserData(AppSessionUser.java:75)
         at ec.com.carrasco.spyral.stgc.portal.view.web.session.AppSessionUser.getUserName(AppSessionUser.java:54)
         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:585)
         at com.sun.faces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:79)
    so, i think that for some reason, the acquireSession method cannot produce a working session and therefore, the app doesn't work ok
    any ideas

    Here is little more insight for the problem , further check reveals that :
    start connecting rmwtest
    exception occured for connection test , Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2.0.1 (Build b09d-fcs (12/06/2007))): oracle.toplink.essentials.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: Listener refused the connection with the following error:
    ORA-12514, TNS:listener does not currently know of service requested in connect descriptor
    The Connection descriptor used by the client was:
    //localhost:1521/ORCL
    we do not have any idea how is localhost:1521/ORCL picked up , in our persistence.xml we have
    where as rmwtest defined in persistence.xml as
    <persistence-unit name="rmwtest" transaction-type="RESOURCE_LOCAL">
    <provider>oracle.toplink.essentials.PersistenceProvider</provider>
    <class>rmw.gnf.entity.ServSesnUser</class>
    <class>rmw.gnf.entity.RmwData</class>
    <class>rmw.gnf.entity.GnfData</class>
    <properties>
    <property name="toplink.logging.level" value="FINEST"/>
    <property name="toplink.jdbc.driver" value="oracle.jdbc.driver.OracleDriver"/>
    <property name="toplink.jdbc.url" value="jdbc:oracle:thin:@middb.1dc.com:1621:ukdbins"/>
    <property name="toplink.jdbc.user" value="****"/>
    <property name="toplink.jdbc.password" value="********"/>
    </properties>
    </persistence-unit>

Maybe you are looking for