Cannot instantiate class: org.apache.naming.java.javaURLContextFactory

后端 未结 2 1383
我寻月下人不归
我寻月下人不归 2021-01-04 20:18

I\'m working on Junit test file which loads SQL file and loads it into Oracle:

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;         


        
2条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-04 21:19

    I fixed this by adding libraries from Apache Tomcat to the Run-time Test Libraries.

    In Netbeans:

    Project Properties -> Libraries -> Run Tests
    
    Add JAR/Folder
    

    The two libraries I needed were catalina.jar and tomcat-juli.jar. You mileage may vary.

    I found them under the installation directory for Tomcat. e.g:

    apache-tomcat-7.0.34/bin/tomcat-juli.jar
    apache-tomcat-7.0.34/lib/catalina.jar
    

    Note one of the jars is in the bin directory, the other in the lib directory

    This probably isn't the best way to fix your problem. It would be better to have a different way to inject the DataSource.

提交回复
热议问题