Netbeans error using struts2

后端 未结 1 2050
执笔经年
执笔经年 2021-01-29 06:12

I have run the web application done using struts. I not able to run the application i have faced the error while starting Apache tomcat errors and while run the web application

1条回答
  •  北恋
    北恋 (楼主)
    2021-01-29 06:57

    You cannot deploy Struts2 web application without Struts2 core libraries. The filter class declared in the web.xml can't be found on the classpath by web application classloader.

    
    
        
            struts2
            org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
        
    
        
            struts2
            /*
        
    
        
    
    
    

    How to resolve such issue. First you could try searching the internet for the class org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter. Even if the first result from Google points to web.xml there's a lot of usable information but nothing about core libraries used by the framework. Ok, trying to search the class name on the struts.apache.org and it's giving the second result Create Struts 2 Web Application Using Maven To Manage Artifacts and To Build The Application. It's created with Maven as a build tool. if you are not familiar with it you should read maven.apache.org. In pom.xml it uses a dependency

    
        org.apache.struts
        struts2-core
        X.X.X.X
    
    

    Of course replace the X.X.X.X with the current Struts 2 version. Maven will get the struts2-core jar and the other jar files struts2-core requires (transitive dependencies).

    Netbeans has full support for Maven:

    NetBeans includes full Maven support since 6.7, including Maven 3 support in 7.0+. You can open any Maven project in the IDE and start coding immediately.

    For more information see the NetBeans.org wiki page.

    If you don't know how to find dependency for your project, you should read FAQ.

    How to find dependencies on public Maven repositories?

    You could use the following search engines:
    
    • http://search.maven.org
    • http://repository.apache.org
    • http://mvnrepository.com

    Here you will find search for struts2-core all required libraries depending on the version you need 2.3.12 I'd recommend the latest stable release at the moment 2.3.24.1.

    You can use Maven in your project to download required library and add them to dependencies. If you decide to manage your project dependencies manually you can get information about struts2-core dependencies on the maven site.

    0 讨论(0)
提交回复
热议问题