HTTP 500 - Cannot create JDBC driver of class '' for connect URL 'null'

前端 未结 3 1970
天命终不由人
天命终不由人 2021-01-07 05:55

I have been searching to fix that problem for 3 days reading forums... Then I decided to ask for some help. Nedless to say that your help would be highly appreciated :-)

3条回答
  •  南方客
    南方客 (楼主)
    2021-01-07 06:07

    I've eventually found out the solution and I'll share it with those who are encountering the same problem.

    Create the META-INF folder under src/main/webapp as WEB-INF sibling Move the Tomcat-config/context.xml file to the META-INF folder. You'll see in the pom.xml that this file is not going to be part of the WAR file.

    META-INF/context.xml

    
    
    
        
        WEB-INF/web.xml
    
     
    
    

    Adapt the pom.xml

    
                org.apache.tomcat.maven
                tomcat7-maven-plugin
                2.2
                
                    http://127.0.0.1:8080/manager/text
                    TomcatServer 
                    /${project.build.finalName}
                    8080
                    UTF-8
                    ${project.build.finalName}
                    ${project.basedir}/src/main/webapp/META-INF/context.xml 
                
                
                    
                        mysql
                        mysql-connector-java 
                        5.1.27
                    
                
            
    

    MAVEN_HOME/conf/settings.xml The id is referenced in the pom.xml. The username and the password are declared in the tomcat-users.xml

    
        TomcatServer
        xxxxx
        xxxxxxxxx
    
    

    Eclipse / Run - Run configurations ...

    • create new launch configuration
    • Base direrctory ${workspace_loc:/your project name}
    • Goals clean tomcat7:run

    • Apply

    • Run

    Next time you can click on the arrow near the Run As... button in the ToolBar and select the configuration you want to run. The Stop and Relaunch buttons are very useful.

提交回复
热议问题