Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!

sabbir kazi

Ranch Hand
+ Follow
since Feb 03, 2001
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by sabbir kazi

Hi Paul,

Thanks for your reply. Here is the exception stack trace:

Hi,

I am getting a NullPointerException when trying to execute:

List fileList = fileUpload.parseRequest(request); in my Servlet.

Please help me find out why I am getting this exception.

Thanks.

Sabbir

Here is the full code:

public void doPost( HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {

// JDBC Connection
if (conn == null){
prepareConnection();
try {
stmt = conn.prepareStatement(
"INSERT into Template (customer_id, template_name, template_size,"+
"template) VALUES"+
"(123456,?,?,?)");

// parse the incoming request
ServletFileUpload fileUpload = new ServletFileUpload();


try {
System.out.println("Calling ServletFileUpload's parseRequest method...");
List fileList = fileUpload.parseRequest(request);
System.out.println("Successful");
Iterator fileItemItr = fileList.iterator();
while (fileItemItr.hasNext()){
if (!fileItem.isFormField()){
fileItem = (FileItem) fileItemItr.next();
fileName = fileItem.getName();
fileInputStream = fileItem.getInputStream();
fileSize = fileItem.getSize();
} else {
// must be other fields
}
// writing to database
stmt.setString(1, fileName);
stmt.setLong(2, fileSize);
stmt.setBinaryStream(3, fileInputStream, 10);
stmt.execute();
}
} catch (FileUploadException e1) {
// TODO Auto-generated catch block
System.out.println("Un-Successful "+ e1.getMessage());
e1.printStackTrace();
}

releaseConnection();

} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
Hi,

My code is as follows:

public static void main(String[] args)
{
JasperReport jasperReport;
JasperPrint jasperPrint;
try
{
//JasperDesign jd = JasperManager.loadXmlDesign("C:\\JasperDemo\\TestReport.jrxml");
jasperReport = JasperCompileManager.compileReport("C:\\JasperDemo\\TestReport.jrxml");
jasperPrint = JasperFillManager.fillReport(jasperReport, new HashMap(), new JREmptyDataSource());
JasperExportManager.exportReportToPdfFile(jasperPrint, "C:\\JasperDemo\\simple_report_X.pdf");
}
catch (JRException e)
{
e.printStackTrace();
}
}

And getting the following exceptions:

net.sf.jasperreports.engine.JRException: Error compiling report java source files : C:\USSTools\TestReport_1165252593363_207653.java
at net.sf.jasperreports.engine.design.JRJavacCompiler.compileClasses(JRJavacCompiler.java:93)
at net.sf.jasperreports.engine.design.JRAbstractClassCompiler.compileUnits(JRAbstractClassCompiler.java:67)
at net.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:190)
at net.sf.jasperreports.engine.design.JRDefaultCompiler.compileReport(JRDefaultCompiler.java:105)
at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:211)
at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:144)
at com.ds.udecide.tools.report.TestJasper.main(TestJasper.java:26)
Caused by: java.io.IOException: CreateProcess: javac -classpath "C:\USSTools\classes;C:\USSTools\lib\mysql-connector-java-3.0.11-stable-bin.jar;C:\USS Development Code\uDecideServer\webapps\uDecide\WEB-INF\classes;C:\USS Development Code\uDecideServer\webapps\uDecide\WEB-INF\lib\commons-beanutils.jar;C:\USS Development Code\uDecideServer\webapps\uDecide\WEB-INF\lib\commons-collections.jar;C:\USS Development Code\uDecideServer\webapps\uDecide\WEB-INF\lib\commons-digester.jar;C:\USS Development Code\uDecideServer\webapps\uDecide\WEB-INF\lib\commons-fileupload.jar;C:\USS Development Code\uDecideServer\webapps\uDecide\WEB-INF\lib\commons-lang.jar;C:\USS Development Code\uDecideServer\webapps\uDecide\WEB-INF\lib\commons-validator.jar;C:\USS Development Code\uDecideServer\webapps\uDecide\WEB-INF\lib\itext-1.2.jar;C:\USS Development Code\uDecideServer\webapps\uDecide\WEB-INF\lib\jCookie.jar;C:\USS Development Code\uDecideServer\webapps\uDecide\WEB-INF\lib\jep-2.24.jar;C:\USS Development Code\uDecideServer\webapps\uDecide\WEB-INF\lib\mysql-connecto�
at java.lang.Win32Process.create(Native Method)
at java.lang.Win32Process.<init>(Unknown Source)
at java.lang.Runtime.execInternal(Native Method)
at java.lang.Runtime.exec(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at net.sf.jasperreports.engine.design.JRJavacCompiler.compileClasses(JRJavacCompiler.java:62)
... 6 more


Please help me figure out why I am getting this error.

Thanks.
I can�t access Sathya's site too, can anyone e-mail it to me?

My email address is - kazisabbir@gmail.com

Thanks.

Sabbir
Thanks Jaikiran. After reserving ports from 1098 to 1101 using regedt32.exe (as suggested in the JBoss forum), the problem has gone - even without closing my MS Outlook.

Thank you all.

Sabbir
14 years ago
Thanks Andreas Schaefer for your reply.
After closing MS Outlook, it still got jboss.service:HAJNDI exception as it finds that port 1101 in use already.

But I can see the jmx-console this time. I ama afraid that still JBoss is not starting up properly.

Thanks.

Sabbir
14 years ago
When I start up JBoss (using Windows batch file), it finds that port 1098 is being used...so can't start up properly. At the end, I get "Page Not Found" when I point "localhost:8080/jmx-console" in my browser.

I checked with "netstat" that no other program is using port 1098.

How can I solve this problem? Thanks in advance.

Sabbir
14 years ago
Thanks Manuel Palacio, for your reply.
14 years ago
Is there any way to determine the encoding format (whether UTF-8 or not) at the time of reading a text file using InputStream or whatever? I need to handle utf-8 encoded file differently from the normal text file.

Thanks in advance.
14 years ago
I am trying to display a JtextPane embedded into a JScrollPane in a JFrame. But I can only see the JScrollPane (not the JTextPane) in the JFrame. Here is my code:

public class JTextPaneTest extends JFrame {

public static void main(String args[]) {
try {
JTextPaneTest frame = new JTextPaneTest();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}

public JTextPaneTest() {
super();
getContentPane().setBackground(new Color(241, 243, 248));
//setBounds(100, 100, 500, 375);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
getContentPane().setLayout(null);
//this.setPreferredSize(new Dimension(1020,730));
this.setSize(536, 300);
this.setLocationRelativeTo(null);

final JTextPane textPane_1 = new JTextPane();
textPane_1.setText("New JTextPane");

final JScrollPane statisticsScrollPane = new JScrollPane(textPane_1);
statisticsScrollPane.setBorder(new TitledBorder(new EtchedBorder(), "Statistics", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, new Color(0, 128, 255)));
statisticsScrollPane.setLayout(null);
statisticsScrollPane.setBounds(6, 14, 486, 140);
getContentPane().add(statisticsScrollPane);

}
}

Just wondering, what am I doing wrong? Please help.
14 years ago
Any solution for this problem? Please let me know.
In my situation, I am reading a XML file (UTF-8) thruh JDOM parser where one of the element is in Chinese. But I can't display the chinese character using System.out.println(). It only displays "?" for a Chinese Character.

Any help will be greatly appreciated.
15 years ago
I am having the similar problem. While exporting my eclipse java project to a jar file, MF does not include the jars (plug-ins and externals) used in the buildpath of the project.

Please help me how to solve this problem using Eclipse.

Sabbir