I need to use Stanfordparser.jar, pdfbox.jar, FontBox.jar in my web application. I’m developing this web app on Netbeans und using tomcat 7.0.22 server, I have include all those .jar file in both WEB-INF/lib AND Libraries Folder (But webapp uses .jar in the libraries folder), The web app runs fine on local machine. But when I run the .war file in WSO2 Stratoes live server and go to the JSP page that uses the .jar file ,it give this error.
java.lang.NullPointerException
controler.ControlerServelet.doPost(ControlerServelet.java:499)
javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
sun.reflect.GeneratedMethodAccessor1364.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:273)
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:270)
java.security.AccessController.doPrivileged(Native Method)
javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:305)
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165)
Putting .jar files just in WEB-INF/lib is enough? Or do I need to point them in the web.xml file? Or how do I overcome this issue?
Update
this is my code
String url = "jdbc:mysql://rss1.stratoslive.wso2.com/karshamarkuptool_karsha_opensource_lk";
String username = "root2_lQrhzZUK";
String password = "nbuser";
BasicDataSource ds = new BasicDataSource();
ds.setDriverClassName("com.mysql.jdbc.Driver");
ds.setUrl(url);
ds.setUsername(username);
ds.setPassword(password);
byte[] b = null;
try {
b = getBLOB("2");
} catch (Exception ex) {
Logger.getLogger(ControlerServelet.class.getName()).log(Level.SEVERE, null, ex);
}
492 //ArrayList<String> sentenceList = new ArrayList<String>();
493 ArrayList<String> sentenceList;
494 parseDocument doc = new parseDocument(); // Parse document object this has the external dependencies
495 sentenceList=doc.pdfDocToSentence(b);
499 // sentenceList.add("test string");
500 request.setAttribute("allphrases", sentenceList);
I have commented out line 499 and modified 492 to 493. Now web page shows no error, But a blank page. Rest of the pages works fine
I'm using netbeans IDE and added external jar files to project's Libraries folder too. Althought I have jar files in WEb_INf/lib folder, the clases are using the external libraries from project folder's Library folder, Can this be a problem? do i need to point servelet classes to use the libraies from WEB_INf/lib folder?