0

I'm trying to add Boilerpipe to do web scraping with my Tomcat project, but when I do so I tend to run into a problem. I add the jar as well as the necessary resources (nekohtml-1.9.13.jar and xerces-2.9.1.jar) to my Web-INF/lib folder and as an external library in the project structure.

However, every time I try to deploy the application, I get a java.io.ClassNotFoundException while building from Tomcat and I have no idea why. Specifically, Tomcat tells me that access is denied, but I have no idea what that could mean since it is easily accessing other Jars in the same folder.

Here is the full stacktrace of the Tomcat error

Error:Internal error: (java.io.FileNotFoundException) C:\Users\micro\IdeaProjects\Spectral_Phasor_Experimentation\out\artifacts\Spectral_Phasor_Experimentation_war_exploded\WEB-INF\lib\boilerpipe-1.2.0.jar (Access is denied)
java.io.FileNotFoundException: C:\Users\micro\IdeaProjects\Spectral_Phasor_Experimentation\out\artifacts\Spectral_Phasor_Experimentation_war_exploded\WEB-INF\lib\boilerpipe-1.2.0.jar (Access is denied)
    at java.base/java.io.FileOutputStream.open0(Native Method)
    at java.base/java.io.FileOutputStream.open(FileOutputStream.java:292)
    at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:235)
    at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:185)
    at com.intellij.openapi.util.io.FileUtil.openOutputStream(FileUtil.java:436)
    at com.intellij.openapi.util.io.FileUtil.performCopy(FileUtil.java:405)
    at com.intellij.openapi.util.io.FileUtil.copyContent(FileUtil.java:399)
    at org.jetbrains.jps.incremental.FSOperations.copy(FSOperations.java:413)
    at org.jetbrains.jps.incremental.artifacts.instructions.FilterCopyHandler.copyFile(FilterCopyHandler.java:40)
    at org.jetbrains.jps.incremental.artifacts.instructions.FileBasedArtifactRootDescriptor.copyFromRoot(FileBasedArtifactRootDescriptor.java:87)
    at org.jetbrains.jps.incremental.artifacts.IncArtifactBuilder.build(IncArtifactBuilder.java:160)
    at org.jetbrains.jps.incremental.artifacts.IncArtifactBuilder.build(IncArtifactBuilder.java:50)
    at org.jetbrains.jps.incremental.IncProjectBuilder.buildTarget(IncProjectBuilder.java:1034)
    at org.jetbrains.jps.incremental.IncProjectBuilder.runBuildersForChunk(IncProjectBuilder.java:1015)
    at org.jetbrains.jps.incremental.IncProjectBuilder.buildTargetsChunk(IncProjectBuilder.java:1071)
    at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunkIfAffected(IncProjectBuilder.java:965)
    at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunks(IncProjectBuilder.java:794)
    at org.jetbrains.jps.incremental.IncProjectBuilder.runBuild(IncProjectBuilder.java:376)
    at org.jetbrains.jps.incremental.IncProjectBuilder.build(IncProjectBuilder.java:178)
    at org.jetbrains.jps.cmdline.BuildRunner.runBuild(BuildRunner.java:139)
    at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:288)
    at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:121)
    at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler.lambda$channelRead0$0(BuildMain.java:228)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:830)
Please perform full project rebuild (Build | Rebuild Project)

I also read somwhere that duplicating Tomcat's existing libaries in the WEB-INF/lib folder is bad, but I am not sure if I did that. Here is what I have in my lib folder: (most of it was auto-imported by IntelliJ)

javax.annotation.jar
javax.ejb.jar
javax.jms.jar
javax.persistence.jar
javax.resource.jar
javax.servlet.jar
javax.servlet.jsp.jar
javax.servlet.jsp.jstl.jar
javax.transaction.jar
joda-time-2.10.5.jar
jstl-1.2.jar
mysql-connector-java-5.1.48-bin.jar
taglibs-standard-jstlel-1.2.5.jar

Any help would be greatly appreciated.

Thanks.

bluesquare
  • 76
  • 1
  • 8
  • 1
    "Access Denied" --> Check file permissions, e.g. compare the permissions to the permissions on the other files that work ok. – Andreas Apr 09 '20 at 07:09
  • I also thought that too, but the other jars have the same permissions aka SYSTEM, my username, and Administration all have complete access to all the Jars. – bluesquare Apr 09 '20 at 07:16
  • So if you run `icacls foo.jar` in a command prompt on the files, they all print the same thing? If yes, try rebooting. – Andreas Apr 09 '20 at 07:19
  • Yep, I get the exact same output on jars that do work and the jars that don't. I rebooted my computer and am still getting the same error. – bluesquare Apr 09 '20 at 17:06

0 Answers0