Announcement Announcement Module
Collapse
No announcement yet.
Getting applicationContext from a jar throws a FileNotFoundException Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    ok, then i'll work through this stuff first and if this works, whenever this is, i'll continue the documentation you posted before... :-)

    But actually its a pitty that a simple fileload throws me backward so much... (i think this is no correct english... :-))

    Thanks...

    Comment


    • #17
      By the way... As i read the document you posted before i changed my entire project, cause the stuff my friend build is old. He used a class called TransactionProxyFactoryBean. and in the documentation is written that this class isn't used anymore sind spring 2.0. I also changed the entire springDispatcher-servlet.xml to the new <tx:-Tags, that haven't been in before.

      But this code before worked.

      Code:
      //BeanFactory bf= new XmlBeanFactory(new FileSystemResource(evt.getServletContext().getRealPath("WEB-INF/SpringDispatcher-servlet.xml")));

      Comment


      • #18
        Another information
        if i make this, i get another exception... i read that i can load the file with a FileSystemXmlApplicationContext too.

        Code:
        	String realPath = evt.getServletContext().getRealPath("WEB-INF/SpringDispatcher-servlet.xml");		
        	ApplicationContext ctx = new FileSystemXmlApplicationContext(realPath);

        org.springframework.beans.factory.BeanDefinitionSt oreException: Unexpected exception parsing XML document from file [C:\Dokumente und Einstellungen\Nico\workspace\sf\WEB-INF\SpringDispatcher-servlet.xml]; nested exception is java.lang.NoClassDefFoundError: org/aspectj/weaver/tools/PointcutPrimitive
        Caused by:
        java.lang.NoClassDefFoundError: org/aspectj/weaver/tools/PointcutPrimitive
        at org.springframework.aop.aspectj.AspectJExpressionP ointcut.<clinit>(AspectJExpressionPointcut.java:61 )
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Unknown Source)
        at org.springframework.aop.config.ConfigBeanDefinitio nParser.class$(ConfigBeanDefinitionParser.java:228 )
        at org.springframework.aop.config.ConfigBeanDefinitio nParser.createPointcutDefinition(ConfigBeanDefinit ionParser.java:520)
        at org.springframework.aop.config.ConfigBeanDefinitio nParser.parsePointcut(ConfigBeanDefinitionParser.j ava:448)
        at org.springframework.aop.config.ConfigBeanDefinitio nParser.parse(ConfigBeanDefinitionParser.java:145)
        at org.springframework.beans.factory.xml.NamespaceHan dlerSupport.parse(NamespaceHandlerSupport.java:75)
        at org.springframework.beans.factory.xml.BeanDefiniti onParserDelegate.parseCustomElement(BeanDefinition ParserDelegate.java:1147)
        at org.springframework.beans.factory.xml.BeanDefiniti onParserDelegate.parseCustomElement(BeanDefinition ParserDelegate.java:1137)
        at org.springframework.beans.factory.xml.DefaultBeanD efinitionDocumentReader.parseBeanDefinitions(Defau ltBeanDefinitionDocumentReader.java:143)
        at org.springframework.beans.factory.xml.DefaultBeanD efinitionDocumentReader.registerBeanDefinitions(De faultBeanDefinitionDocumentReader.java:88)
        at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.registerBeanDefinitions(XmlBeanDefinit ionReader.java:499)
        at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.doLoadBeanDefinitions(XmlBeanDefinitio nReader.java:407)
        at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.loadBeanDefinitions(XmlBeanDefinitionR eader.java:357)
        at org.springframework.beans.factory.xml.XmlBeanDefin itionReader.loadBeanDefinitions(XmlBeanDefinitionR eader.java:334)
        at org.springframework.beans.factory.support.Abstract BeanDefinitionReader.loadBeanDefinitions(AbstractB eanDefinitionReader.java:126)
        at org.springframework.beans.factory.support.Abstract BeanDefinitionReader.loadBeanDefinitions(AbstractB eanDefinitionReader.java:142)
        at org.springframework.beans.factory.support.Abstract BeanDefinitionReader.loadBeanDefinitions(AbstractB eanDefinitionReader.java:168)
        at org.springframework.context.support.AbstractXmlApp licationContext.loadBeanDefinitions(AbstractXmlApp licationContext.java:113)
        at org.springframework.context.support.AbstractXmlApp licationContext.loadBeanDefinitions(AbstractXmlApp licationContext.java:79)
        at org.springframework.context.support.AbstractRefres hableApplicationContext.refreshBeanFactory(Abstrac tRefreshableApplicationContext.java:94)
        at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:292)
        at org.springframework.context.support.FileSystemXmlA pplicationContext.<init>(FileSystemXmlApplicationC ontext.java:89)
        at org.springframework.context.support.FileSystemXmlA pplicationContext.<init>(FileSystemXmlApplicationC ontext.java:74)
        at de.hosp.sf.config.ContextListener.contextInitializ ed(ContextListener.java:28)
        at org.apache.catalina.core.StandardContext.listenerS tart(StandardContext.java:3763)
        at org.apache.catalina.core.StandardContext.start(Sta ndardContext.java:4211)
        at org.apache.catalina.core.ContainerBase.start(Conta inerBase.java:1013)
        at org.apache.catalina.core.StandardHost.start(Standa rdHost.java:718)
        at org.apache.catalina.core.ContainerBase.start(Conta inerBase.java:1013)
        at org.apache.catalina.core.StandardEngine.start(Stan dardEngine.java:442)
        at org.apache.catalina.core.StandardService.start(Sta ndardService.java:450)
        at org.apache.catalina.core.StandardServer.start(Stan dardServer.java:709)
        at org.apache.catalina.startup.Catalina.start(Catalin a.java:551)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknow n Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Un known Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.apache.catalina.startup.Bootstrap.start(Bootst rap.java:294)
        at org.apache.catalina.startup.Bootstrap.main(Bootstr ap.java:432)

        Comment


        • #19
          Your missing the aspectJ jar from the classpath. If you have downloaded Spring with dependencies then there is an aspectJ folder which contains the jar you need.

          BTW, you can still use the TransactionProxyFactoryBean its just that the tx:advice tags are supposed to be a shortcut and cut down the amount of XML.

          Comment


          • #20
            Actually i prefer to cut down the amount of xml. cause hiow you saw is my xml-file big. if you have more ideas to cut down the amount of lines please tell me.

            i have already included the aspectjrt.jar and the aspectjweaver.jar. these files i found in the asp-folder in the lib-folder from spring.

            I found out an interesting thing. I always get a filenotfound-exception or a java.lang.NoClassDefFoundError: org/aspectj/weaver/tools/PointcutPrimitive-Exception. But if i cut out the entire code with all these tx:-Tags, it works...

            Comment


            • #21
              Its quite hard to understand what your doing, but whatever you changed you must have removed the need for the aspectJ jar. Hence the exception goes away. As for the cutting down the XML, I would have a read of the reference manual, but there are various things you can do; templating, autowiring (I don't like to use this however), new namespaces, etc..

              Comment


              • #22
                well, i'm a c# and basic developer sind many years. now i wanna learn new things and its hard for me to understand that things work just cause of writing a filename in a xml-file. next is that i cant imagine that i have three different ways to load the springdispatcher-file, like mdeinum wrote.

                now i'll repair the things mdeinum wrote and then i'll write down all my files. i agree with him that i wanna split al the stuff in many separate files. i will go forward step by step. i will set myself many little milestones and at the end of this year i wanna get my data loaded from the database.

                i write again when i have repaired my web.xml...

                after this the next milestone will be to separate the files. so i can show you guys better where are problems.. cause posting all the lines has nothing to do with overview anymore...

                Comment

                Working...
                X