Results 1 to 10 of 10
  1. #1
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    8

    Default please help problem with applicationContext.xml

    Trying to run some samples that go together with the Manning, Struts 2 in Action book
    that I am studying.
    There is a problem with the applicationContext.xml (at WEB-INF)
    Here is the error message (and see the please xml at the final part)
    and it is obvious that the xml does not like the nested bean! of line 30
    (Administrators-Mac-mini:~ willem$ java -version
    java version "1.8.0_05"):

    org.springframework.web.context.ContextLoader initWebApplicationContext
    SEVERE: Context initialization failed
    org.springframework.beans.factory.BeanDefinitionSt oreException: Unexpected exception parsing XML document from ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is java.lang.IllegalStateException: AnnotationTransactionAttributeSource is only available on Java 1.5 and higher
    Caused by: java.lang.IllegalStateException: AnnotationTransactionAttributeSource is only available on Java 1.5 and higher
    at org.springframework.transaction.config.TxNamespace Utils.getAnnotationTransactionAttributeSourceClass (TxNamespaceUtils.java:43)
    at org.springframework.transaction.config.AnnotationD rivenBeanDefinitionParser.parseInternal(Annotation DrivenBeanDefinitionParser.java:64)
    at org.springframework.beans.factory.xml.AbstractBean DefinitionParser.parse(AbstractBeanDefinitionParse r.java:56)
    at org.springframework.beans.factory.xml.NamespaceHan dlerSupport.parse(NamespaceHandlerSupport.java:69)
    at org.springframework.beans.factory.xml.BeanDefiniti onParserDelegate.parseCustomElement(BeanDefinition ParserDelegate.java:1123)
    at org.springframework.beans.factory.xml.BeanDefiniti onParserDelegate.parseCustomElement(BeanDefinition ParserDelegate.java:1113)
    at org.springframework.beans.factory.xml.DefaultBeanD efinitionDocumentReader.parseBeanDefinitions(Defau ltBeanDefinitionDocumentReader.java:133)
    at org.springframework.beans.factory.xml.DefaultBeanD efinitionDocumentReader.registerBeanDefinitions(De faultBeanDefinitionDocumentReader.java:90)
    at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.registerBeanDefinitions(XmlBeanDefinit ionReader.java:468)
    at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.doLoadBeanDefinitions(XmlBeanDefinitio nReader.java:363)
    at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.loadBeanDefinitions(XmlBeanDefinitionR eader.java:313)
    at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.loadBeanDefinitions(XmlBeanDefinitionR eader.java:290)
    at org.springframework.beans.factory.support.Abstract BeanDefinitionReader.loadBeanDefinitions(AbstractB eanDefinitionReader.java:131)
    at org.springframework.beans.factory.support.Abstract BeanDefinitionReader.loadBeanDefinitions(AbstractB eanDefinitionReader.java:147)
    at org.springframework.web.context.support.XmlWebAppl icationContext.loadBeanDefinitions(XmlWebApplicati onContext.java:124)
    at org.springframework.web.context.support.XmlWebAppl icationContext.loadBeanDefinitions(XmlWebApplicati onContext.java:92)
    at org.springframework.context.support.AbstractRefres hableApplicationContext.refreshBeanFactory(Abstrac tRefreshableApplicationContext.java:101)
    at org.springframework.context.support.AbstractApplic ationContext.obtainFreshBeanFactory(AbstractApplic ationContext.java:389)
    at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:324)
    at org.springframework.web.context.ContextLoader.crea teWebApplicationContext(ContextLoader.java:245)
    at org.springframework.web.context.ContextLoader.init WebApplicationContext(ContextLoader.java:188)
    at org.springframework.web.context.ContextLoaderListe ner.contextInitialized(ContextLoaderListener.java: 49)
    at org.apache.catalina.core.StandardContext.listenerS tart(StandardContext.java:4760)
    at org.apache.catalina.core.StandardContext.startInte rnal(StandardContext.java:5184)
    at org.apache.catalina.util.LifecycleBase.start(Lifec ycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild. call(ContainerBase.java:1396)
    at org.apache.catalina.core.ContainerBase$StartChild. call(ContainerBase.java:1386)
    at java.util.concurrent.FutureTask.run(FutureTask.jav a:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker( ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

    Jul 21, 2014 12:27:31 AM org.apache.catalina.core.StandardContext listenerStart
    SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListe ner
    org.springframework.beans.factory.BeanDefinitionSt oreException: Unexpected exception parsing XML document from ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is java.lang.IllegalStateException: AnnotationTransactionAttributeSource is only available on Java 1.5 and higher
    Caused by: java.lang.IllegalStateException: AnnotationTransactionAttributeSource is only available on Java 1.5 and higher
    at org.springframework.transaction.config.TxNamespace Utils.getAnnotationTransactionAttributeSourceClass (TxNamespaceUtils.java:43)
    at org.springframework.transaction.config.AnnotationD rivenBeanDefinitionParser.parseInternal(Annotation DrivenBeanDefinitionParser.java:64)
    at org.springframework.beans.factory.xml.AbstractBean DefinitionParser.parse(AbstractBeanDefinitionParse r.java:56)
    at org.springframework.beans.factory.xml.NamespaceHan dlerSupport.parse(NamespaceHandlerSupport.java:69)
    at org.springframework.beans.factory.xml.BeanDefiniti onParserDelegate.parseCustomElement(BeanDefinition ParserDelegate.java:1123)
    at org.springframework.beans.factory.xml.BeanDefiniti onParserDelegate.parseCustomElement(BeanDefinition ParserDelegate.java:1113)
    at org.springframework.beans.factory.xml.DefaultBeanD efinitionDocumentReader.parseBeanDefinitions(Defau ltBeanDefinitionDocumentReader.java:133)
    at org.springframework.beans.factory.xml.DefaultBeanD efinitionDocumentReader.registerBeanDefinitions(De faultBeanDefinitionDocumentReader.java:90)
    at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.registerBeanDefinitions(XmlBeanDefinit ionReader.java:468)
    at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.doLoadBeanDefinitions(XmlBeanDefinitio nReader.java:363)
    at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.loadBeanDefinitions(XmlBeanDefinitionR eader.java:313)
    at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.loadBeanDefinitions(XmlBeanDefinitionR eader.java:290)
    at org.springframework.beans.factory.support.Abstract BeanDefinitionReader.loadBeanDefinitions(AbstractB eanDefinitionReader.java:131)
    at org.springframework.beans.factory.support.Abstract BeanDefinitionReader.loadBeanDefinitions(AbstractB eanDefinitionReader.java:147)
    at org.springframework.web.context.support.XmlWebAppl icationContext.loadBeanDefinitions(XmlWebApplicati onContext.java:124)
    at org.springframework.web.context.support.XmlWebAppl icationContext.loadBeanDefinitions(XmlWebApplicati onContext.java:92)
    at org.springframework.context.support.AbstractRefres hableApplicationContext.refreshBeanFactory(Abstrac tRefreshableApplicationContext.java:101)
    at org.springframework.context.support.AbstractApplic ationContext.obtainFreshBeanFactory(AbstractApplic ationContext.java:389)
    at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:324)
    at org.springframework.web.context.ContextLoader.crea teWebApplicationContext(ContextLoader.java:245)
    at org.springframework.web.context.ContextLoader.init WebApplicationContext(ContextLoader.java:188)
    at org.springframework.web.context.ContextLoaderListe ner.contextInitialized(ContextLoaderListener.java: 49)
    at org.apache.catalina.core.StandardContext.listenerS tart(StandardContext.java:4760)
    at org.apache.catalina.core.StandardContext.startInte rnal(StandardContext.java:5184)
    at org.apache.catalina.util.LifecycleBase.start(Lifec ycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild. call(ContainerBase.java:1396)
    at org.apache.catalina.core.ContainerBase$StartChild. call(ContainerBase.java:1386)
    at java.util.concurrent.FutureTask.run(FutureTask.jav a:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker( ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

    Jul 21, 2014 12:27:31 AM org.apache.catalina.core.StandardContext startInternal
    SEVERE: Error listenerStart
    Jul 21, 2014 12:27:31 AM org.apache.catalina.core.StandardContext startInternal
    SEVERE: Context [/Struts2InAction] startup failed due to previous errors
    Jul 21, 2014 12:27:31 AM org.apache.catalina.core.ApplicationContext log
    INFO: Closing Spring root WebApplicationContext
    Jul 21, 2014 12:27:31 AM org.apache.coyote.AbstractProtocol start
    INFO: Starting ProtocolHandler ["http-nio-8080"]
    Jul 21, 2014 12:27:31 AM org.apache.coyote.AbstractProtocol start
    INFO: Starting ProtocolHandler ["ajp-nio-8009"]
    Jul 21, 2014 12:27:31 AM org.apache.catalina.startup.Catalina start
    INFO: Server startup in 5245 ms



    Java Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <!--  This is the Spring configuration file.  This file declares all of the Spring beans that
    			will be used by the Struts 2 Portfolio, starting with Chapter Nine.
    -->
    
    <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:tx="http://www.springframework.org/schema/tx"
        xsi:schemaLocation="
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
        http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
    
    
    	
    
       <bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" />
       
       
       <!--  Change the value of the fileSystemHome to a point to the images directory in this web application
             that is a top level directory in your deployed web application.  In the document root, along side
             the JSP directories.  
        -->
       <bean id="portfolioService" class="manning.utils.PortfolioServiceJPAImpl">
          <property name="fileSystemHome" value="/home/chadmichael/workspace/manningSampleApp/images/"/>
       </bean>
       
       <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
            <property name="dataSource" ref="dataSource" />
            <property name="jpaVendorAdapter">
               <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
                    <property name="database" value="MYSQL" />
                    <property name="showSql" value="true" />
         	   </bean>
            </property>
        </bean>
       
         
        
        <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
            <property name="driverClassName" value="org.gjt.mm.mysql.Driver" />
            <property name="url" value="jdbc:mysql://127.0.0.1:3306/manning" />
            <property name="username" value="manning" />
            <property name="password" value="action" />
        </bean>
        
        <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
            <property name="entityManagerFactory" ref="entityManagerFactory" />
        </bean>
    
        <tx:annotation-driven transaction-manager="transactionManager" />
       
    </beans>
    Last edited by willemjav; 07-21-2014 at 01:08 AM.

  2. #2
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    8

    Default Re: please help problem with applicationContext.xml

    Doing some more research concerning this error:

    Unexpected exception parsing XML document from ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is java.lang.IllegalStateException: AnnotationTransactionAttributeSource is only available on Java 1.5 and higher

    https://bugzilla.redhat.com/show_bug...ple&id=1090968

    It is said that "Struts Two in Action" book (Manning) is one of the best manuals about Struts 2, so I got a copy!
    I have read 25% of it and it is very important to study the code of the examples (which are only partly printed in the book).
    So please help me to fix that strange error so I can stop flailing!

  3. #3
    Join Date
    Apr 2014
    Posts
    49
    Rep Power
    0

    Default Re: please help problem with applicationContext.xml


  4. #4
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    8

    Default Re: please help problem with applicationContext.xml

    Thanks Itswebin I'll look into it but I am also going to contact Manning!

  5. #5
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    8

    Default Re: please help problem with applicationContext.xml

    There are two things here:
    1) An understanding of the Struts2 programming concept;
    2) Next: configurate it for your needs (in my case JPA/Hibernate DB stuff).

    Tolls and Gimbal2 are right:
    "Basically you've just been trying stuff and hope for the best; that is your main problem. You can't blame the tools."

    But where to start?
    When a "basic" Struts2 conf. of the famous Struts2 in Action book is not working and nobody can tell me why?
    (see the info of this thread)

  6. #6
    gimbal2 is online now Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,076
    Rep Power
    6

    Default Re: please help problem with applicationContext.xml

    Soft push mode.

    So have you copy/pasted "java.lang.IllegalStateException: AnnotationTransactionAttributeSource is only available on Java 1.5 and higher" into google yet?

    It is said that "Struts Two in Action" book (Manning) is one of the best manuals about Struts 2, so I got a copy!
    Hard push mode. Beware.

    You read something in one source and then you just take that at face value without checking up on it some more? If I check the user reviews on Amazon on that book, they are a little less positive in general. Not bad, just not great either. I certainly wouldn't have bought it based on that and one other key factor I will illustrate in a bit.

    This should give you a hint on what you might be doing wrong. You don't seem to spread your research very much, you want everything to come from one source and when that doesn't work, you come running here and ask other people to provide the solution for you. That's simply not how it works. And yes, many books contain broken examples; that is because they tend to be rushed towards a release. When you then buy a book which does not see re-prints in the form of a 2nd edition (your book is from 2008), those problems are not corrected either. That is why I don't buy older books which have not seen re-releases.

    BTW: as far as I can tell, you are not using "Struts 2". You are at the very least using Spring framework and you might be wanting to combine that with Struts 2, I don't know. But your problems are stemming from the Spring configuration, so you are probably already barking up the wrong tree for a long time now. Something you could have avoided by just looking at the error you are getting. The word 'springframework' is in there two dozen times.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  7. #7
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    8

    Default Re: please help problem with applicationContext.xml

    I also wondered about the spring content of the above xml: I haven't gone into spring yet and I would like
    to avoid going into it for the moment.
    I did research the net present of Struts2 manuals a lot, but the results are disappointing!
    The only clean Struts2 examples I get until now are the HelloWorld ones (I did get beyond those I believe).
    There are quite some superficial manuals about Struts2 (like: tutorial point) which are great as an introduction.
    Once you want to go some deeper the trouble starts. Any good book or manual is welcome, so let me know!
    Probably my research skills aren't as good as yours Gimbal2, but I am on the net almost constantly!

    So the bottom-line: I did go through a Struts2 introduction and need some more "advanced" stuff to study.
    That part is hard to tackle because you get (unwillingly) into all kind of "side-issues" like Maven. JPA, Spring etc.
    So what would be a clean Struts2 approach after HelloWorld?
    I did go into your article but first I'd rather get more familiar with Struts (of JPA, Maven I do have some good stuff)

    I did not buy that book, we have it at the office, and I am learning things by reading it, but it would be nice
    to have the examples working as well. Than, going through everything (text and code examples) I eventually will
    get a better understanding of all of it.

    "So have you copy/pasted "java.lang.IllegalStateException: AnnotationTransactionAttributeSource is only available on Java 1.5 and higher" into google yet?"....... more than a hundred times!
    It gets me into all kind of Spring-stuff which I haven't studied yet (going circles)...

    Sure I was hoping for a quick fix of you guys, but not to have it the easy-way! I was hoping to get started with that book and seeing the important code examples at work! I know I will spend many hours studying all that material and coming back with some more question. Eventually I will get to all of it: Spring Maven JPA, because I do understand now that I need to configure a lot more in order to get it all working. For this I do need first a better understanding (going circles again).....

    The point is how to get started!

  8. #8
    gimbal2 is online now Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,076
    Rep Power
    6

    Default Re: please help problem with applicationContext.xml

    I give up again. You don't want to get into Spring yet you are still using it. At this point if I continue I'm going to pull out hairs and start speaking in Latin.

    The point is how to get started!
    Home
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  9. #9
    willemjav is offline Senior Member
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    1,075
    Rep Power
    8

    Default Re: please help problem with applicationContext.xml

    Oculi mei semper ad Dominum,
    quia ipse evellet de laqueo pedes meos:
    respice in me, et miserere mei.

  10. #10
    SurfMan's Avatar
    SurfMan is online now Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    980
    Rep Power
    2

    Default Re: please help problem with applicationContext.xml

    This forum is getting weirder by the day. The only thing we haven't had yet is a bunch of people from India posting Online (Scam) Courses. Oh, wait....
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2 2013

Similar Threads

  1. Replies: 2
    Last Post: 12-17-2012, 01:44 PM
  2. Replies: 1
    Last Post: 12-17-2012, 10:31 AM
  3. Replies: 0
    Last Post: 11-07-2012, 12:44 PM
  4. Replies: 9
    Last Post: 09-21-2010, 04:15 PM
  5. Replies: 2
    Last Post: 06-12-2007, 04:33 PM

Posting Permissions

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