Stefan Evans wrote:Hi Ahmed, welcome to the ranch.
It looks like you need to add these ".tagger" files to your web application's classpath and load them appropriately.
A web application's classpath is
- files in the WEB-INF/classes directory
- jar files in the WEB-INF/lib directory
So right now the ".tagger" files aren't in the classpath, and your code is trying to access them from the web root which also doesn't work.
Create a "classes" folder under WEB-INF
Move the .tagger and .tagger.props files from WEB-INF/lib to WEB-INF/classes. There should only be ".jar" files in the lib directory.
Change your initialization code to
That should at least give you a different error message :-)
Stefan Evans wrote:Sorry, I'm still waking up here.
You get stuff into the "classes" folder by having it in your source (duh!)
So my new suggestions are:
- make a folder "taggers" under src
- copy those tagger/properties file into src/taggers.
Theoretically that should work for both your app, and your webapp.
Tim Holloway wrote:My vision is a bit blurry today and I can't follow all that, but two things ring alarm bells:
1. Any question that starts with "I'm running XXX with YYY IDE". If your choice or use of an IDE is causing problems, you don't understand what you are doing. The IDE isn't going to be there when the app runs in production, so it should be HELPING you, not an essential part of the component being built and tested.
and thus, related to that:
2. " "WebContent\\WEB-INF\\lib\\english-bidirectional-distsim.tagger"
DOS filenames in Java programs are never a good idea, if for no other reason than that one misplaced backslash can wreak havoc. Even if it's a DOS (Windows) file, use the Unix-style paths. Furthermore, you've included part of your Eclipse project in what I'm presuming to be your web application code. To properly locate a WAR resource, the path format should look more like this:
Meaning folder WEB-INF at the top of the WAR.
That's above and beyond the questionable practice of putting something in /WEB-INF/lib that isn't a libary (jar).
A servlet's classpath includes the resources (class files, property files, and so forth) under /WEB-INF/classes. the contents of al jars found in the /WEB-INF/lib directory (note that this is different from command-line java, where a directory full of jars will not go into the classpath), followed by a run down the server-wide classpath (directories such as Tomcat's /lib directory). In most cases, you want your class-loadable resources to be contained within the WAR (/WEB-INF/classes and lib), not in the server library, with the exception of server-sharable resources such as jdbc drivers (if you don't know it's sharable, assume it isn't).
Classpath Additions from outside the server entirely, such as CLASSPATH environment or java command-line classpath are done at your own peril, and in some cases, the web application server will simply not even see them, since the webapp server has extensive classpath customization logic of its own.
>Caused by: java.io.IOException: Unable to resolve "WebContent\WEB-INF\lib\english-left3words-distsim.tagger" as either class path, filename or URL