Applet Servlet communication compiles but does not communicate

Hi,
I have a applet which has a button named A. By clicking the button, the applet passes the letter A to the servlet. The servlet in turn accesses an Oracle database and retrieves the name corresponding to letter A from a table (name is Andy in the present case). The servlet interacts with the databse via a simple stored procedure and uses its output parameter to display the name Andy back in the applet.
Both the applet and servlet codes have compiled fine(servlet code compiled with -classpath option to servlet jar using a TOMCAT). However, on clicking button A in the applet, I do not get the name Andy.
Any help/suggestion in resolution of this is highly appreciated. Thanks in advance.
HTML CODE:
<html>
<center>
<applet code = "NameApplet.class" width = "600" height = "400">
</applet>
</center>
</html>
STORED PROCEDURE CODE:
procedure get_letter_description(
ac_letter IN CHAR,
as_letter_description OUT VARCHAR2) IS
BEGIN
SELECT letter_description INTO as_letter_description FROM letter WHERE letter =
ac_letter;
EXCEPTION
WHEN no_data_found THEN as_letter_description := 'No description available';
END get_letter_description;
APPLET CODE:
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import java.util.*;
import java.io.*;
import java.net.*;
public class NameApplet extends Applet implements ActionListener
private TextField text;
private Button button1;
private String webServerStr = null;
private String hostName = "localhost";
     private int port = 8080;
private String servletPath = "/examples/servlet/NameServlet?letter=";
private String letter;
public void init()
     button1 = new Button("A");
button1.addActionListener(this);
add(button1);
          text = new TextField(20);
     add(text);
// get the host name and port of the applet's web server
          URL hostURL = getCodeBase();
     hostName = hostURL.getHost();
port = hostURL.getPort();
          webServerStr = "http://" + hostName + ":" + port + servletPath;
public void actionPerformed(ActionEvent e)
     if (e.getSource() == button1)
     letter = "" + 'A';
private String getName(String letter){
String name = "" ;
try {
          URL u = new URL(webServerStr + letter);
          Object content = u.getContent();
name = content.toString();
     } catch (Exception e) {
     System.err.println("Error in getting name");
return name;
SERVLET CODE:
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
import java.sql.*;
import java.util.Properties;
public class NameAppletServlet extends HttpServlet {
private static Connection conn = null;
private static final char DEFAULT_CHAR = 'A';
private static final char MIN_CHAR = 'A';
private static final char MAX_CHAR = 'G';
private static final String PROCEDURE_CALL
= "{call get_letter_description(?, ?)}";
protected void doGet( HttpServletRequest request,
HttpServletResponse response )
throws ServletException, IOException
handleHttpRequest(request, response);
protected void doPost( HttpServletRequest request,
HttpServletResponse response )
throws ServletException, IOException
handleHttpRequest(request, response);
protected void handleHttpRequest( HttpServletRequest request,
HttpServletResponse response )
throws ServletException, IOException
String phrase = null;
char letter = getLetter(request, DEFAULT_CHAR);
if (letter >= MIN_CHAR && letter <= MAX_CHAR) {
try {
name = getName(conn, letter);
} catch (SQLException se) {
String msg = "Unable to retrieve name from database.";
name = msg;
} else {
String msg = "Invalid letter '" + letter + "' requested.";
//throw new ServletException(msg);
phrase = msg;
response.setContentType("text/plain");
PrintWriter out = response.getWriter();
out.println(name);
private String getName(Connection conn, char letter)
throws SQLException
CallableStatement cstmt = conn.prepareCall(PROCEDURE_CALL);
cstmt.setString(1, String.valueOf(letter));
cstmt.registerOutParameter(2, Types.VARCHAR);
cstmt.execute();
String name = cstmt.getString(2);
cstmt.close();
return name;
private char getLetter(HttpServletRequest request, char defaultLetter) {
char letter = defaultLetter;
String letterString = request.getParameter("letter");
if (letterString!=null) {
letter = letterString.charAt(0);
return letter;
public void init(ServletConfig conf) throws ServletException {
super.init(conf);
String dbPropertyFile = getInitParameter("db.property.file");
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
conn = DriverManager.getConnection(
"jdbc:oracle:thin:myserver:1521:CDD",
"scott",
"tiger");
} catch (IOException ioe) {
throw new ServletException(
"Unable to init ReinforcementServlet: " + ioe.toString());
} catch (ClassNotFoundException cnfe) {
throw new ServletException(
"Unable to init ReinforcementServlet. Could not find driver: "
+ cnfe.toString());
} catch (SQLException se) {
throw new ServletException(
"Unable to init ReinforcementServlet. Error establishing"
+ " database connection: " + se.toString());
}

Hi,
I am not able to understand by which method you are doing Applet-Servlet commuincation.
If you want to use Object Serialization method, plz.get the details from following URL.
http://www.j-nine.com/pubs/applet2servlet/
Ajay

Similar Messages

  • Applet compiles but does not appear...

    the applet compiles but does not appear :(
    all that appears is a blank box...hopefully someone can help
    import java.awt.*;
    import java.applet.*;
    import java.awt.event.*;
    public class program2 extends Applet implements ActionListener
         private Button btLeft, btRight, btUp, btDown, btBgYellow,
         btBgRed, btBgBlue, btBgOrange, btTxtRed,btTxtYellow, btTxtBlue,
         btTxtOrange, btFtHel, btFtCr, btFtTr, btFtSy;
         private MessagePanel messagePanel;
         private Panel p = new Panel();
         public void init()
              p.setLayout(new BorderLayout());
              messagePanel = new MessagePanel("Java is Life");
              messagePanel.setBackground(Color.white);
              //directional buttons
              Panel pButtons = new Panel();
              pButtons.setLayout(new FlowLayout());
              pButtons.add(btLeft = new Button());
              pButtons.add(btRight = new Button());
              pButtons.add(btUp = new Button());
              pButtons.add(btDown = new Button());
              //Background buttons
              Panel BgButtons = new Panel();
              BgButtons.setLayout(new FlowLayout());
              BgButtons.add(btBgRed = new Button());
              btBgRed.setBackground(Color.red);
              BgButtons.add(btBgYellow = new Button());
              btBgYellow.setBackground(Color.yellow);
              BgButtons.add(btBgBlue = new Button());
              btBgBlue.setBackground(Color.blue);
              BgButtons.add(btBgOrange = new Button());
              btBgOrange.setBackground(Color.orange);
              //text color buttons
              Panel txtButtons = new Panel();
              txtButtons.setLayout(new GridLayout(4,1));
              txtButtons.add(btTxtRed = new Button());
              btTxtRed.setBackground(Color.red);
              txtButtons.add(btTxtYellow = new Button());
              btTxtYellow.setBackground(Color.yellow);
              txtButtons.add(btTxtBlue = new Button());
              btTxtBlue.setBackground(Color.blue);
              txtButtons.add(btTxtOrange = new Button());
              btTxtOrange.setBackground(Color.orange);
              //font buttons
              Panel ftButtons = new Panel();
              ftButtons.setLayout(new GridLayout(4,1));
              ftButtons.add(btFtHel = new Button());
              ftButtons.add(btFtCr = new Button());
              ftButtons.add(btFtTr = new Button());
              ftButtons.add(btFtSy = new Button());
              //layout
              p.add(messagePanel, BorderLayout.CENTER);//set center 1st
              p.add(pButtons, BorderLayout.SOUTH);
              p.add(BgButtons, BorderLayout.NORTH);
              p.add(txtButtons, BorderLayout.EAST);
              p.add(ftButtons, BorderLayout.WEST);
              //listeners
              btLeft.addActionListener(this);
              btRight.addActionListener(this);
              btUp.addActionListener(this);
              btDown.addActionListener(this);
              btBgRed.addActionListener(this);
              btBgYellow.addActionListener(this);
              btBgBlue.addActionListener(this);
              btBgOrange.addActionListener(this);
              btTxtRed.addActionListener(this);
              btTxtYellow.addActionListener(this);
              btTxtBlue.addActionListener(this);
              btTxtOrange.addActionListener(this);
              btFtHel.addActionListener(this);
              btFtCr.addActionListener(this);
              btFtTr.addActionListener(this);
              btFtSy.addActionListener(this);
         //implement listener
         public void actionPerformed(ActionEvent e)
              if(e.getSource() == btLeft)
                   left();
              else if(e.getSource() == btRight)
                   right();
              else if(e.getSource() == btUp)
                   up();
              else if(e.getSource() == btDown)
                   down();
              else if(e.getSource() == btBgRed)
                   red();
              else if(e.getSource() == btBgYellow)
                   yellow();
              else if(e.getSource() == btBgBlue)
                   blue();
              else if(e.getSource() == btBgOrange)
                   orange();
              else if(e.getSource() == btTxtRed)
                   redText();
              else if(e.getSource() == btTxtYellow)
                   yellowText();
              else if(e.getSource() == btTxtBlue)
                   blueText();
              else if(e.getSource() == btTxtOrange)
                   orangeText();
              else if(e.getSource() == btFtHel)
                   helvetica();
              else if(e.getSource() == btFtCr)
                   courier();
              else if(e.getSource() == btFtTr)
                   times();
              else if(e.getSource() == btFtSy)
                   symbol();
         //directional methods :0)
         private void left()
              int x = messagePanel.getXCoordinate();
              if(x > 10)
                   messagePanel.setXCoordinate(x - 10);
                   messagePanel.repaint();
         private void right()
              int x = messagePanel.getXCoordinate();
              if(x < (getSize().width - 5))
                   messagePanel.setXCoordinate(x + 5);
                   messagePanel.repaint();
         private void up()
              int y = messagePanel.getYCoordinate();
              if(y < (getSize().height - 10))
                   messagePanel.setYCoordinate(y - 10);
                   messagePanel.repaint();
         private void down()
              int y = messagePanel.getYCoordinate();
              if(y < (getSize().height + 10))
                   messagePanel.setYCoordinate(y + 10);
                   messagePanel.repaint();
         //background methods :)
         private void red()
              messagePanel.setBackground(Color.red);
         private void yellow()
              messagePanel.setBackground(Color.yellow);
         private void blue()
              messagePanel.setBackground(Color.blue);
         private void orange()
              messagePanel.setBackground(Color.orange);
         //text color methods :)
         private void redText()
              messagePanel.setForeground(Color.red);
         private void yellowText()
              messagePanel.setForeground(Color.yellow);
         private void blueText()
              messagePanel.setForeground(Color.blue);
         private void orangeText()
              messagePanel.setForeground(Color.orange);
         private void helvetica()
              Font myfont = new Font("Helvetica", Font.PLAIN,12);
              messagePanel.setFont(myfont);
         private void courier()
              Font myfont = new Font("Courier", Font.PLAIN,12);
              messagePanel.setFont(myfont);
         private void times()
              Font myfont = new Font("TimesRoman", Font.PLAIN,12);
              messagePanel.setFont(myfont);
         private void symbol()
              Font myfont = new Font("Symbol", Font.PLAIN,12);
              messagePanel.setFont(myfont);

    You add everything to the Panel p but you never add that panel to the applet. What you probably want is to add everything to the applet. An applet is a special kind of panel so you can just change "p" to "this" everywhere in init and remove the declaration of p at the top.

  • Program compiles, but does not run

    To: XCode Users <[email protected]>
    From: Brigit Ananya <[email protected]>
    Subject: Program compiles, but does not run
    I am trying to port a Java application from the PC to the Mac. I am using XCode and the program compiles, but it does not run.
    When I try to run the ...app, I get the message that the main class is not specified, etc.
    When I try to run the ...jar, I do not get the message that the main class is not specified, but I do get the message that there is no Manifest section for bouncycastle, etc.
    Here are the detailed messages I get in the Console when I try to run the program:
    When I try to run the ...app, I get the following message:
    1/9/09 7:21:17 AM [0x0-0x8c08c].com.AnanyaSystems.AnanyaCurves[2253] [LaunchRunner Error] No main class specified
    1/9/09 7:21:17 AM [0x0-0x8c08c].com.AnanyaSystems.AnanyaCurves[2253] [JavaAppLauncher Error] CallStaticVoidMethod() threw an exception
    1/9/09 7:21:17 AM [0x0-0x8c08c].com.AnanyaSystems.AnanyaCurves[2253] Exception in thread "main" java.lang.NullPointerException
    1/9/09 7:21:17 AM [0x0-0x8c08c].com.AnanyaSystems.AnanyaCurves[2253] at apple.launcher.LaunchRunner.run(LaunchRunner.java:112)
    1/9/09 7:21:17 AM [0x0-0x8c08c].com.AnanyaSystems.AnanyaCurves[2253] at apple.launcher.LaunchRunner.callMain(LaunchRunner.java:50)
    1/9/09 7:21:17 AM [0x0-0x8c08c].com.AnanyaSystems.AnanyaCurves[2253] at apple.launcher.JavaApplicationLauncher.launch(JavaApplicationLauncher.java:52)
    When I try to run the ...jar, I do get the following message:
    1/9/09 7:22:43 AM [0x0-0x8d08d].com.apple.JarLauncher[2262] at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374)
    1/9/09 7:28:45 AM [0x0-0x8f08f].com.apple.JarLauncher[2277] Exception in thread "main"
    1/9/09 7:28:45 AM [0x0-0x8f08f].com.apple.JarLauncher[2277] java.lang.SecurityException: no manifiest section for signature file entry org/bouncycastle/asn1/DEREnumerated.class
    1/9/09 7:28:45 AM [0x0-0x8f08f].com.apple.JarLauncher[2277] at sun.security.util.SignatureFileVerifier.verifySection(SignatureFileVerifier.java:377)
    1/9/09 7:28:45 AM [0x0-0x8f08f].com.apple.JarLauncher[2277] at sun.security.util.SignatureFileVerifier.processImpl(SignatureFileVerifier.java:231)
    1/9/09 7:28:45 AM [0x0-0x8f08f].com.apple.JarLauncher[2277] at sun.security.util.SignatureFileVerifier.process(SignatureFileVerifier.java:176)
    1/9/09 7:28:45 AM [0x0-0x8f08f].com.apple.JarLauncher[2277] at java.util.jar.JarVerifier.processEntry(JarVerifier.java:233)
    1/9/09 7:28:45 AM [0x0-0x8f08f].com.apple.JarLauncher[2277] at java.util.jar.JarVerifier.update(JarVerifier.java:188)
    1/9/09 7:28:45 AM [0x0-0x8f08f].com.apple.JarLauncher[2277] at java.util.jar.JarFile.initializeVerifier(JarFile.java:325)
    1/9/09 7:28:45 AM [0x0-0x8f08f].com.apple.JarLauncher[2277] at java.util.jar.JarFile.getInputStream(JarFile.java:390)
    1/9/09 7:28:45 AM [0x0-0x8f08f].com.apple.JarLauncher[2277] at sun.misc.URLClassPath$JarLoader$1.getInputStream(URLClassPath.java:620)
    1/9/09 7:28:45 AM [0x0-0x8f08f].com.apple.JarLauncher[2277] at sun.misc.Resource.cachedInputStream(Resource.java:58)
    1/9/09 7:28:45 AM [0x0-0x8f08f].com.apple.JarLauncher[2277] at sun.misc.Resource.getByteBuffer(Resource.java:113)
    1/9/09 7:28:45 AM [0x0-0x8f08f].com.apple.JarLauncher[2277] at java.net.URLClassLoader.defineClass(URLClassLoader.java:249)
    1/9/09 7:28:45 AM [0x0-0x8f08f].com.apple.JarLauncher[2277] at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
    1/9/09 7:28:45 AM [0x0-0x8f08f].com.apple.JarLauncher[2277] at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
    1/9/09 7:28:45 AM [0x0-0x8f08f].com.apple.JarLauncher[2277] at java.security.AccessController.doPrivileged(Native Method)
    1/9/09 7:28:45 AM [0x0-0x8f08f].com.apple.JarLauncher[2277] at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    1/9/09 7:28:45 AM [0x0-0x8f08f].com.apple.JarLauncher[2277] at java.lang.ClassLoader.loadClass(ClassLoader.java:316)
    1/9/09 7:28:45 AM [0x0-0x8f08f].com.apple.JarLauncher[2277] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:280)
    1/9/09 7:28:45 AM [0x0-0x8f08f].com.apple.JarLauncher[2277] at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    1/9/09 7:28:45 AM [0x0-0x8f08f].com.apple.JarLauncher[2277] at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374)
    I do specify the main class in both, the Manifest file and the Info.plist file, in the correct way, "package.MainClass". Is there another place where I need to specify it?
    Why do I need org/bouncycastle/asn1/DEREnumerated.class, and how would I have to specify it in Manifest?
    I also posted these questions at Mac Programming at forums.macrumors.com and at Xcode-users Mailing List at lists.apple.com/mailman/listinfo, but I did not get any answer.
    Please help! Thanks!

    There was something wrong with my Info.plist file.
    So, here is my corrected Info.plist file:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
         <key>CFBundleDevelopmentRegion</key>
         <string>English</string>
         <key>CFBundleExecutable</key>
         <string>AnanyaCurves</string>
         <key>CFBundleGetInfoString</key>
         <string></string>
         <key>CFBundleIconFile</key>
         <string>AnanyaCurves.icns</string>
         <key>CFBundleIdentifier</key>
         <string>com.AnanyaSystems.AnanyaCurves</string>
         <key>CFBundleInfoDictionaryVersion</key>
         <string>6.0</string>
         <key>CFBundleName</key>
         <string>AnanyaCurves</string>
         <key>CFBundlePackageType</key>
         <string>APPL</string>
         <key>CFBundleShortVersionString</key>
         <string>0.1</string>
         <key>CFBundleSignature</key>
         <string>ac</string>
         <key>CFBundleVersion</key>
         <string>0.1</string>
         <key>Java</key>
         <dict>
              <key>JMVersion<key>
              <string>1.4+</string>
              <key>MainClass</key>
              <string>AnanyaCurves</string>
              <key>VMOptions</key>
              <string>-Xmx512m</string>
              <key>Properties</key>
              <dict>
                   <key>apple.laf.useScreenMenuBar</key>
                   <string>true</string>
                   <key>apple.awt.showGrowBox</key>
          <string>true</string>
              </dict>
         </dict>
    </dict>
    </plist>Ok, so now I can at least run the AnanyaCurves.jar file by double-clicking on it.
    However, I still cannot run the AnanyaCurves.app file. When I double-click on it, I get the following message in the Console:
    1/11/09 5:12:26 PM [0x0-0x67067].com.apple.JarLauncher[1128]  at ananyacurves.AnanyaCurves.main(AnanyaCurves.java:1961)
    1/11/09 5:13:11 PM [0x0-0x6a06a].com.AnanyaSystems.AnanyaCurves[1137] [JavaAppLauncher Error] CFBundleCopyResourceURL() failed loading MRJApp.properties file
    1/11/09 5:13:11 PM [0x0-0x6a06a].com.AnanyaSystems.AnanyaCurves[1137] [LaunchRunner Error] No main class specified
    1/11/09 5:13:11 PM [0x0-0x6a06a].com.AnanyaSystems.AnanyaCurves[1137] [JavaAppLauncher Error] CallStaticVoidMethod() threw an exception
    1/11/09 5:13:11 PM [0x0-0x6a06a].com.AnanyaSystems.AnanyaCurves[1137] Exception in thread "main" java.lang.NullPointerException
    1/11/09 5:13:11 PM [0x0-0x6a06a].com.AnanyaSystems.AnanyaCurves[1137]  at apple.launcher.LaunchRunner.run(LaunchRunner.java:112)
    1/11/09 5:13:11 PM [0x0-0x6a06a].com.AnanyaSystems.AnanyaCurves[1137]  at apple.launcher.LaunchRunner.callMain(LaunchRunner.java:50)
    1/11/09 5:13:11 PM [0x0-0x6a06a].com.AnanyaSystems.AnanyaCurves[1137]  at apple.launcher.JavaApplicationLauncher.main(JavaApplicationLauncher.java:61)Why is it looking for the MRJApp.properties file? Isn't this outdated? Shouldn't it look for the Info.plist file? I do not have a MRJApp.properties file.
    Also, in the Run menu of my XCode project, Go, Run, and Debug are disabled, but perhaps this has to do with not being able to run the AnanyaCurves.app file.
    Thanks for your time! I really appreciate any help you can give me!

  • Applet detect new particeipent  but does not show  any output.

    hi,
    I have written one applet which uses AVReceive2 as inner class.
    This applet detects new particepent joined but does not take any action like showing or playing movie.
    I cant understand where I am wrong.

    Doublechecking, KAT ... is the Device Screen looking a bit like the following screenshot?
    Which particular Windows OS are you using? (XP, Vista or 7?)

  • Compiles but does not execute as expected????

    Here is my code. I can compile and execute but does not perform as expected What do I need to change?
    import java.io.;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.text.NumberFormat;
    import java.math.*;
    public class CalcTest extends JFrame implements ActionListener, ItemListener
    public JMenuBar createMenuBar()
            JMenuBar mnuBar = new JMenuBar();
            setJMenuBar(mnuBar);
                //Create File & add Exit
            JMenu mnuFile = new JMenu("File", true);
            mnuFile.setMnemonic(KeyEvent.VK_F);
            mnuFile.setDisplayedMnemonicIndex(0);
            mnuBar.add(mnuFile);
            JMenuItem mnuFileExit = new JMenuItem("Exit");
            mnuFileExit.setMnemonic(KeyEvent.VK_F);
            mnuFileExit.setDisplayedMnemonicIndex(1);
            mnuFile.add(mnuFileExit);
            mnuFileExit.setActionCommand("Exit");
            mnuFileExit.addActionListener(this);
            JMenu mnuFunction = new JMenu("Function", true);
            mnuFunction.setMnemonic(KeyEvent.VK_F);
            mnuFunction.setDisplayedMnemonicIndex(0);
            mnuBar.add(mnuFunction);
           JMenuItem mnuFunctionClear = new JMenuItem("Clear");
           mnuFunctionClear.setMnemonic(KeyEvent.VK_F);
           mnuFunctionClear.setDisplayedMnemonicIndex(1);
           mnuFunction.add(mnuFunctionClear);
           mnuFunctionClear.setActionCommand("Clear");
           mnuFunctionClear.addActionListener(this);
            // Fields for Principle 
      JPanel row1 = new JPanel();
      JLabel dollar = new JLabel("How much are you borrowing?"); 
      JTextField money = new JTextField("", 15);
            // Fields for Term and Rate
       JPanel row2 = new JPanel();
       JLabel choice = new JLabel("Select Year & Rate:");
       JCheckBox altchoice = new JCheckBox("Alt. Method");
       JTextField YR = new JTextField("", 4);
       JTextField RT = new JTextField("", 4);
           //Jcombobox R=rate,Y=year
       String[] RY =  {   
            "7 years at 5.35%", "15 years at 5.5 %", "30 years at 5.75%", " "  
      JComboBox mortgage = new JComboBox(RY);
                // Fields for Payment   
        JPanel row3 = new JPanel(); 
        JLabel payment = new JLabel("Your monthly payment will be:");
        JTextField owe = new JTextField(" ", 15); 
              //Scroll Pane and Text Area
       JPanel row4 = new JPanel();
       JLabel amortization = new JLabel("Amortization:");
       JTextArea chart = new JTextArea(" ", 7, 22); 
       JScrollPane scroll = new JScrollPane(chart, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,  
                                               JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);  
        StringBuffer amt = new StringBuffer();
        Container pane = getContentPane(); 
        FlowLayout flow = new FlowLayout(FlowLayout.LEFT);
        JButton Cal = new JButton("Calculate"); 
        NumberFormat currency = NumberFormat.getCurrencyInstance();  
      public CalcTest() 
               // Title and Exit of JFrame  
         super("Mortgage and Amortization Calculator"); 
         setSize(475, 328);  
         setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);  
                //JFrame layout      
         pane.setLayout(flow);     
               //Input output fields added to JFrame  
         row1.add(dollar);    
         row1.add(money);   
         pane.add(row1);    
         mortgage.setSelectedIndex(3);   
         mortgage.addActionListener(this);    
         mortgage.setActionCommand("mortgage");
         row2.add(altchoice);     
         altchoice.addItemListener(this);  
         row2.add(choice);     
         YR.setEditable(false);    
         RT.setEditable(false);     
         row2.add(YR);     
         row2.add(RT);      
         row2.add(mortgage);    
         pane.add(row2);     
         row3.add(payment);   
         row3.add(owe);       
         pane.add(row3);      
         owe.setEditable(false);  
                 //Scroll Pane added to JFrame     
          row4.add(amortization);      
          chart.setEditable(false); 
          row4.add(scroll);   
          pane.add(row4);     
                //Executable Button- Clear,Exit, Calculate 
          JPanel row5 = new JPanel();
          JButton clear = new JButton("Clear");  
          clear.addActionListener(this);     
          row5.add(clear); 
          pane.add(row5); 
          JButton exit = new JButton("Exit"); 
          exit.addActionListener(this);    
          row5.add(exit);      
          Cal.setEnabled(false);  
          Cal.addActionListener(this); 
          row5.add(Cal);       
          pane.add(row5);   
          setContentPane(pane);   
          setVisible(true); 
      }                    //End of constructor   
        private void calculate()
          String loanAmount = money.getText(); 
             if(loanAmount.equals(""))      
               return;      
               double P = Double.parseDouble(loanAmount);     
               int y;     
               double r;    
             if(altchoice.isSelected())   
              if(YR.getText().equals("") || RT.getText().equals(""))  
                 return;        
               y = Integer.parseInt(YR.getText());     
                r = Double.parseDouble(RT.getText());   
               else     
                  int index = mortgage.getSelectedIndex();  
                  if(index == 3)         
                  return;          
                  int[] terms = { 7, 15, 30 };     
                  double[] rates = { 5.5, 5.35, 5.75 }; 
                  y = terms[index];  
                  r = rates[index];  
                  double In = r / (100 * 12.0);  
                  double M = P * (In / (1 - Math.pow(In + 1, -12.0 * y)));
                  owe.setText(currency.format(M));      
                         //Column Titles for Text Area     
           chart.setText("Pmt#\tPrincipal\tInterest\tBalance\n");  
         for (int i = 0; i < y * 12; i++)     
      {            double interestAccrued = P * In;     
                   double principalPaid = M - interestAccrued;          
                   chart.append(i + 1 + "\t" + currency.format(principalPaid)           
                                    + "\t" + currency.format(interestAccrued)     
                                          + "\t" + currency.format(P) + "\n");      
                    P = P + interestAccrued - M;   
         public void itemStateChanged(ItemEvent ie) 
      {        int status = ie.getStateChange();    
           if (status == ItemEvent.SELECTED)     
               mortgage.setEnabled(false);  
               YR.setEditable(true); 
               RT.setEditable(true);   
               Cal.setEnabled(true);  
            else 
            mortgage.setEnabled(true); 
            YR.setEditable(false);    
            RT.setEditable(false);     
           Cal.setEnabled(false);     
      public void actionPerformed(ActionEvent ae)//Calculations and Button executions
          String command = ae.getActionCommand();  
                  // Exit program      
           if (command.equals("Exit"))   
            System.exit(0);
                  // Cal button 
          if (command.equals("Calculate") || command.equals("mortgage")) 
              calculate();      
                 // Clear fields  
          if (command.equals("Clear")) 
             money.setText(null);
             mortgage.setSelectedIndex(3); 
             owe.setText(null);   
             chart.setText(null); 
    }             //End actionPerformed 
       public static void main(String args[]) throws IOException
               new CalcTest();
    [/Code]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    Here is the code again
    import java.io.;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.text.NumberFormat;
    import java.math.*;
    public class CalcTest extends JFrame implements ActionListener, ItemListener
    public JMenuBar createMenuBar()
            JMenuBar mnuBar = new JMenuBar();
            setJMenuBar(mnuBar);
                //Create File & add Exit
            JMenu mnuFile = new JMenu("File", true);
            mnuFile.setMnemonic(KeyEvent.VK_F);
            mnuFile.setDisplayedMnemonicIndex(0);
            mnuBar.add(mnuFile);
            JMenuItem mnuFileExit = new JMenuItem("Exit");
            mnuFileExit.setMnemonic(KeyEvent.VK_F);
            mnuFileExit.setDisplayedMnemonicIndex(1);
            mnuFile.add(mnuFileExit);
            mnuFileExit.setActionCommand("Exit");
            mnuFileExit.addActionListener(this);
            JMenu mnuFunction = new JMenu("Function", true);
            mnuFunction.setMnemonic(KeyEvent.VK_F);
            mnuFunction.setDisplayedMnemonicIndex(0);
            mnuBar.add(mnuFunction);
           JMenuItem mnuFunctionClear = new JMenuItem("Clear");
           mnuFunctionClear.setMnemonic(KeyEvent.VK_F);
           mnuFunctionClear.setDisplayedMnemonicIndex(1);
           mnuFunction.add(mnuFunctionClear);
           mnuFunctionClear.setActionCommand("Clear");
           mnuFunctionClear.addActionListener(this);
            // Fields for Principle 
      JPanel row1 = new JPanel();
      JLabel dollar = new JLabel("How much are you borrowing?"); 
      JTextField money = new JTextField("", 15);
            // Fields for Term and Rate
       JPanel row2 = new JPanel();
       JLabel choice = new JLabel("Select Year & Rate:");
       JCheckBox altchoice = new JCheckBox("Alt. Method");
       JTextField YR = new JTextField("", 4);
       JTextField RT = new JTextField("", 4);
           //Jcombobox R=rate,Y=year
       String[] RY =  {   
            "7 years at 5.35%", "15 years at 5.5 %", "30 years at 5.75%", " "  
      JComboBox mortgage = new JComboBox(RY);
                // Fields for Payment   
        JPanel row3 = new JPanel(); 
        JLabel payment = new JLabel("Your monthly payment will be:");
        JTextField owe = new JTextField(" ", 15); 
              //Scroll Pane and Text Area
       JPanel row4 = new JPanel();
       JLabel amortization = new JLabel("Amortization:");
       JTextArea chart = new JTextArea(" ", 7, 22); 
       JScrollPane scroll = new JScrollPane(chart, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,  
                                               JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);  
        StringBuffer amt = new StringBuffer();
        Container pane = getContentPane(); 
        FlowLayout flow = new FlowLayout(FlowLayout.LEFT);
        JButton Cal = new JButton("Calculate"); 
        NumberFormat currency = NumberFormat.getCurrencyInstance();  
      public CalcTest() 
               // Title and Exit of JFrame  
         super("Mortgage and Amortization Calculator"); 
         setSize(475, 328);  
         setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);  
                //JFrame layout      
         pane.setLayout(flow);     
               //Input output fields added to JFrame  
         row1.add(dollar);    
         row1.add(money);   
         pane.add(row1);    
         mortgage.setSelectedIndex(3);   
         mortgage.addActionListener(this);    
         mortgage.setActionCommand("mortgage");
         row2.add(altchoice);     
         altchoice.addItemListener(this);  
         row2.add(choice);     
         YR.setEditable(false);    
         RT.setEditable(false);     
         row2.add(YR);     
         row2.add(RT);      
         row2.add(mortgage);    
         pane.add(row2);     
         row3.add(payment);   
         row3.add(owe);       
         pane.add(row3);      
         owe.setEditable(false);  
                 //Scroll Pane added to JFrame     
          row4.add(amortization);      
          chart.setEditable(false); 
          row4.add(scroll);   
          pane.add(row4);     
                //Executable Button- Clear,Exit, Calculate 
          JPanel row5 = new JPanel();
          JButton clear = new JButton("Clear");  
          clear.addActionListener(this);     
          row5.add(clear); 
          pane.add(row5); 
          JButton exit = new JButton("Exit"); 
          exit.addActionListener(this);    
          row5.add(exit);      
          Cal.setEnabled(false);  
          Cal.addActionListener(this); 
          row5.add(Cal);       
          pane.add(row5);   
          setContentPane(pane);   
          setVisible(true); 
      }                    //End of constructor   
        private void calculate()
          String loanAmount = money.getText(); 
             if(loanAmount.equals(""))      
               return;      
               double P = Double.parseDouble(loanAmount);     
               int y;     
               double r;    
             if(altchoice.isSelected())   
              if(YR.getText().equals("") || RT.getText().equals(""))  
                 return;        
               y = Integer.parseInt(YR.getText());     
                r = Double.parseDouble(RT.getText());   
               else     
                  int index = mortgage.getSelectedIndex();  
                  if(index == 3)         
                  return;          
                  int[] terms = { 7, 15, 30 };     
                  double[] rates = { 5.5, 5.35, 5.75 }; 
                  y = terms[index];  
                  r = rates[index];  
                  double In = r / (100 * 12.0);  
                  double M = P * (In / (1 - Math.pow(In + 1, -12.0 * y)));
                  owe.setText(currency.format(M));      
                         //Column Titles for Text Area     
           chart.setText("Pmt#\tPrincipal\tInterest\tBalance\n");  
         for (int i = 0; i < y * 12; i++)     
      {            double interestAccrued = P * In;     
                   double principalPaid = M - interestAccrued;          
                   chart.append(i + 1 + "\t" + currency.format(principalPaid)           
                                    + "\t" + currency.format(interestAccrued)     
                                          + "\t" + currency.format(P) + "\n");      
                    P = P + interestAccrued - M;   
         public void itemStateChanged(ItemEvent ie) 
      {        int status = ie.getStateChange();    
           if (status == ItemEvent.SELECTED)     
               mortgage.setEnabled(false);  
               YR.setEditable(true); 
               RT.setEditable(true);   
               Cal.setEnabled(true);  
            else 
            mortgage.setEnabled(true); 
            YR.setEditable(false);    
            RT.setEditable(false);     
           Cal.setEnabled(false);     
      public void actionPerformed(ActionEvent ae)//Calculations and Button executions
          String command = ae.getActionCommand();  
                  // Exit program      
           if (command.equals("Exit"))   
            System.exit(0);
                  // Cal button 
          if (command.equals("Calculate") || command.equals("mortgage")) 
              calculate();      
                 // Clear fields  
          if (command.equals("Clear")) 
             money.setText(null);
             mortgage.setSelectedIndex(3); 
             owe.setText(null);   
             chart.setText(null); 
    }             //End actionPerformed 
       public static void main(String args[]) throws IOException
               new CalcTest();

  • This program is well compiled but does not work.

    I would like to know why this program does not work properly:
    the idea is :
    1. the user introduces a text as a string
    2.the progam creates a file (with a FileOutputStream)
    3. then this file is encripted according to DES (using JCE, cipheroutputStream)
    4.the new filw is an encripte file, whose content is introduced in a string (with a FileInputStream)
    (gives no probles of compilation!!)
    (don know why it does not work)
    here goes the code:
    import java.awt.*;
    import java.awt.event.*;
    import java.applet.*;
    import java.io.*;
    import java.security.*;
    import javax.crypto.*;
    public class cuadro extends Applet{
         private TextArea area1 =new TextArea(5,50);
         private TextArea area2 =new TextArea(5,50);
         private Button encriptar=new Button("encriptar");
         private Button decriptar=new Button("decriptar");
         public cuadro(){
              layoutApplet();
              encriptar.addActionListener(new ButtonHandler());
              decriptar.addActionListener(new ButtonHandler());
              resize(400,400);
              private void layoutApplet(){
              Panel keyPanel = new Panel();
              keyPanel.add(encriptar);
              keyPanel.add(decriptar);
              Panel textPanel = new Panel();
              Panel texto1 = new Panel();
              Panel texto2 = new Panel();
              texto1.add(new Label("               plain text"));
              texto1.add(area1);
              texto2.add(new Label("               cipher text"));
              texto2.add(area2);
              textPanel.setLayout(new GridLayout(2,1));
              textPanel.add(texto1);
              textPanel.add(texto2);
              setLayout(new BorderLayout());
              add("North", keyPanel);
              add("Center", textPanel);
              public static String encriptar(String text1){
              //generar una clave
              SecretKey clave=null;
              String text2="";
              try{
              FileOutputStream fs =new FileOutputStream ("c:/javasoft/ti.txt");
              DataOutputStream es= new DataOutputStream(fs);
                   for(int i=0;i<text1.length();++i){
                        int j=text1.charAt(i);
                        es.write(j);
                   es.close();
              }catch(IOException e){
                   System.out.println("no funciona escritura");
              }catch(SecurityException e){
                   System.out.println("el fichero existe pero es un directorio");
              try{
                   //existe archivo DESkey.ser?
                   ObjectInputStream claveFich =new ObjectInputStream(new FileInputStream ("DESKey.ser"));
                   clave = (SecretKey) claveFich.readObject();
                   claveFich.close();
              }catch(FileNotFoundException e){
                   System.out.println("creando DESkey.ser");
                   //si no, generar generar y guardar clave nueva
              try{
                   KeyGenerator claveGen = KeyGenerator.getInstance("DES");
                   clave= claveGen.generateKey();
                   ObjectOutputStream claveFich = new ObjectOutputStream(new FileOutputStream("DESKey.ser"));
                   claveFich.writeObject(clave);
                   claveFich.close();
              }catch(NoSuchAlgorithmException ex){
                   System.out.println("DES key Generator no encontrado.");
                   System.exit(0);
              }catch(IOException ex){
                   System.out.println("error al salvar la clave");
                   System.exit(0);
         }catch(Exception e){
              System.out.println("error leyendo clave");
              System.exit(0);
         //crear una cifra
         Cipher cifra = null;
         try{
              cifra= Cipher.getInstance("DES/ECB/PKCS5Padding");
              cifra.init(Cipher.ENCRYPT_MODE,clave);
         }catch(InvalidKeyException e){
              System.out.println("clave no valida");
              System.exit(0);
         }catch(Exception e){
              System.out.println("error creando cifra");
              System.exit(0);
         //leer y encriptar el archivo
         try{
              DataInputStream in = new DataInputStream(new FileInputStream("c:/javasoft/ti.txt"));
              CipherOutputStream out = new CipherOutputStream(new DataOutputStream(new FileOutputStream("c:/javasoft/t.txt")),cifra);
              int i;
              do{
                   i=in.read();
                   if(i!=-1) out.write(i);
              }while (i!=-1);
              in.close();
              out.close();
         }catch(IOException e){
              System.out.println("error en lectura y encriptacion");
              System.exit(0);
         try{
              FileInputStream fe=new FileInputStream("c:/javasoft/t.txt");
              DataInputStream le =new DataInputStream(fe);
                   int i;
                   char c;
                   do{
                        i=le.read();
                        c= (char)i;
                        if(i!=-1){
                        text2 += text2.valueOf(c);
                   }while(i!=-1);
                        le.close();
              /*}catch(FileNotFoundException e){
                   System.out.println("fichero no encontrado");
                   System.exit(0);
              }catch(ClassNotFoundException e){
                   System.out.println("clase no encontrada");
                   System.exit(0);
              */}catch(IOException e){
                   System.out.println("error e/s");
                   System.exit(0);
              return text2;
         class ButtonHandler implements ActionListener{
         public void actionPerformed(ActionEvent e){
              try{
              if (e.getActionCommand().equals(encriptar.getLabel()))
                   //     area2.setText(t1)
                   area2.setText(encriptar(area1.getText()));
                   //area2.setText("escribe algo");
                   else if (e.getActionCommand().equals(decriptar.getLabel()))
                        System.out.println("esto es decriptar");
                        //area2.setText("hola");
         }catch(Exception ex){
              System.out.println("error en motor de encriptacion");
                   //else System.out.println("no coge el boton encriptado/decript");

    If you don't require your code to run as an applet, you will probably get more mileage from refactoring it to run as an application.
    As sudha_mp implied, an unsigned applet will fail on the line
    FileInputStream fe=new FileInputStream("c:/javasoft/t.txt");
    due to security restrictions. (Which, incidentally, are there for a very good reason)

  • This Formula(Function) compiles but does not display any result

    Please can anybody help me resolve this issue.The code below is a code for a formula(function) column in oracle report, i have complied this code and it successfully complied but it does not display any result for the column having a stock balance in the entire report.
    function CF_STOCK_BALFormula return Number is
         v_all_positive NUMBER;
         v_all_negative NUMBER;
    begin
         IF :transaction_type IN ('RECEIPT', 'RETURN') THEN
              IF :cp_stock_bal IS NULL OR :cp_stock_bal = 0 THEN
                   :cp_stock_bal := :opening_balance + :cp_stock_bal + :quantity;
              ELSE
                   :cp_stock_bal := :cp_stock_bal + :quantity;
              END IF;
         ELSIF :transaction_type IN ('ISSUE') THEN
              IF :cp_stock_bal IS NULL OR :cp_stock_bal = 0 THEN
                   :cp_stock_bal := :opening_balance + :cp_stock_bal - :quantity;
              ELSE
                   :cp_stock_bal := :cp_stock_bal - :quantity;
              END IF;
         END IF;
    RETURN (:cp_stock_bal);
    end;
    Edited by: Gbenga on Jan 17, 2012 11:30 PM

    Please can anybody help me resolve this issue.The code below is a code for a formula(function) column in oracle report, i have complied this code and it successfully complied but it does not display any result for the column having a stock balance in the entire report.
    function CF_STOCK_BALFormula return Number is
         v_all_positive NUMBER;
         v_all_negative NUMBER;
    begin
         IF :transaction_type IN ('RECEIPT', 'RETURN') THEN
              IF :cp_stock_bal IS NULL OR :cp_stock_bal = 0 THEN
                   :cp_stock_bal := :opening_balance + :cp_stock_bal + :quantity;
              ELSE
                   :cp_stock_bal := :cp_stock_bal + :quantity;
              END IF;
         ELSIF :transaction_type IN ('ISSUE') THEN
              IF :cp_stock_bal IS NULL OR :cp_stock_bal = 0 THEN
                   :cp_stock_bal := :opening_balance + :cp_stock_bal - :quantity;
              ELSE
                   :cp_stock_bal := :cp_stock_bal - :quantity;
              END IF;
         END IF;
    RETURN (:cp_stock_bal);
    end;
    Edited by: Gbenga on Jan 17, 2012 11:30 PM

  • Playbook connects but does not communicate Windows 8

    I have a playbook 16Gb which was working perfectly until I updated my BB PB to Os 2.1.0.1314 which totally trashed my playbook, first the icons were disappearing & now it wont connect to my Windows 8 Pro even with the BB DM it prompts an error (blackberry desktop software cannot communicate with the connected device) neither does it assign a new drive for Playbook, Did everything turned off Firewall,Windows Defender,updated BB DM,checked original data cable for any damage,turned off wifi & bluetooth,fully charged the Playbook + I even bought a new Usb port.... But it still wont connect!!! 
    And one more thing when I plug in the data cable & dismiss the (connected to computer screen) an exclamation mark appears on the TOP Left of the screen saying (Unable to charge battery with connected Source)
    Would be very thankful if someone helped....

    Sorry I was unable to post this comment but fortunately I managed to get a win XP on my PC & now the pb is working absolutely fine,the wifi technique worked for windows 8 but I got a very slow internet connection limited to 1MB/s which  was taking ages to upload a heavy file so it did not help me though.
    Anyway Thanks a lot for helping me out...

  • Servleto compiles but does not execute

    I have a problem with servlets about allocation memory, i have installed tomcat 5.0, j2sdk 1.4, servlets compile is good, but when i try to call them it cause the next error
    All this happen after reinstall again j2sdk and tomcat, please help me, any ideas
    2006-09-14 21:51:59 StandardWrapperValve[srvltSEGRPT023]: Excepci�n de reserva de espacio para servlet srvltSEGRPT023
    javax.servlet.ServletException: Error reservando espacio para una instancia de servlet
         at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:691)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:144)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
         at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
         at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
         at java.lang.Thread.run(Unknown Source)
    ----- Root Cause -----
    java.lang.NoClassDefFoundError: Illegal name: SEGUROS/Servlets/srvltSEGRPT023
         at java.lang.ClassLoader.defineClass(Unknown Source)
         at java.security.SecureClassLoader.defineClass(Unknown Source)
         at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1634)
         at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:860)
         at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1307)
         at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1189)
         at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:964)
         at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:687)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:144)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
         at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
         at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
         at java.lang.Thread.run(Unknown Source)

    http://forum.java.sun.com/thread.jspa?threadID=544602&messageID=2650499
    http://www.jchq.net/discus/messages/50028/51378.html?1109907530
    You need to replace the "/" slashes with "." dots for the class loader to find the class file.

  • Problem: airport extreme connects to network, but does not communicate

    I have been able to communicate via wireless networks using my airport extreme-enabled iBook G4... that is, until Thursday. (Or about Thursday... maybe it was Wednesday. Somewhere around then.)
    Now I can connect to a wireless network, but I am unable to communicate across the connection. ping fails. Web sites don't load--it appears the DNS lookup fails. Curiously, if I look at the network activity in the Activity Monitor I see a bunch of little bits of data getting sent and received, generally in the range of 20-100 bytes per second, though there is no obvious need for network activity. (Maybe my computer is attempting to get DNS info and such?) When things were working previously, a quiet system meant no network activity.
    Further muddying the waters, I can connect and communicate via wireless networks I had not connected to prior to Thursday. Today I went to three different wireless hotspots I had not connected to before, and was able to connect and communicate--everything worked fine at all three. But if I connect to any wireless networks I had previously connected to before Thursday, I get the problem I describe above.
    I did not knowingly make any networking changes on Thursday. I did, however, run Disk Utility's "Repair file permissions" around that time, due to problems with iTunes 7. Today I ran "Repair disk" in Disk Utility but no problems were found or fixed.
    My best guess is that some airport settings were corrupted for existing wireless networks on my computer sometime on Thursday, and this corrupted data is persisting. However, I have not been able to identify where that data would be.
    I deleted com.apple.airport.preferences.plist and NetworkInterfaces.plist in /Library/Preferences/SystemConfiguration, but that didn't fix the problem. (Of course, when Mac OS recreated these files it could have been from corrupted cached data, I suppose.)
    Dial-up access works fine.
    One last thing, I'm getting the following error message in /private/var/log/system.log when I connect to a network:
    Sep 22 20:49:41 localhost mach_init[2]: Server 2427 in bootstrap d03 uid 0: "/usr/sbin/lookupd": exited as a result of signal 1 [pid 515]
    However, I get the same message when I connect via dial-up (which is working OK), so I don't think that's related.
    Any ideas?
    iBook G4   Mac OS X (10.3.9)  

    Hard start reset solved the problem.

  • The ANE library is compiled to MacOS, but does not compile on Windows.

    ANE lbrary FPHockeyApp http://flashpress.ru/blog/contents/ane/hockeyapp/FPHockeyApp-6.1.ane
    Application:
    package
        import flash.display.Sprite;
        import ru.flashpress.hockeyapp.FPHockeyApp;
        import ru.flashpress.hockeyapp.ns.haIOS;
        public class TestHockeyApp extends Sprite
            public function TestHockeyApp()
                super();
                use namespace haIOS;
                var APP_ID:String = 'you app id';
                FPHockeyApp.manager.configureWithIdentifier(APP_ID);
                FPHockeyApp.manager.startManager();
                FPHockeyApp.manager.authenticator.authenticateInstallation();
    Compiled in MacOS, but does not compile on Windows:
    Why so?

    Windows 64-bit.
    On a single MacBookPro installed OSX and Windows(not virtual).

  • Windows xp runs java application but does not compile it - urgent please

    Hi
    My new PC(portable) does not compile my java progran:
    'javac' is not recognized as an internal or external command, operatable program or batch file.
    If you have any suggestion, please let me know!
    Aria

    Thanks anyhow;
    The following information is sent to beginners site.
    I have talked to british, belgian and others regarding this problem. They said it is very expensive and we laughed.
    Hi,
    Windows XP runs java application but does not compile it. I get following message:
    'javac' is not recognized as an internal or external command, operatable program or batch file.
    MS-DOS does not exists but a command line edits autoexec.nt having allinformation regarding installed jdk5. I run my java applicat
    ion from here. But no compilation.
    Environment variables has following information.
    JAVA_HOME C:\jdk5.0
    CLASSPATH C:\jdk5.0\myPrograms
    path %JAVA_HOME%bin
    All information in autoexec.nt exists as windows 98 and I run it from command line.
    Would you please tell me what is wrong?
    Thanks
    Aria

  • Applet/servlet communication for byte transmission

    Hello all !
    I wrote an applet to transfer binary file from web servlet (running under Tomcat 5.5) to a client (it's a signed applet) but I have a problem of interpretation of byte during transmission.
    the code of the servlet is :
            response.setContentType("application/octet-stream");
            ServletOutputStream sos = response.getOutputStream();
            FileInputStream fis = new FileInputStream(new File(
                    "C:\\WINDOWS\\system32\\setup.bmp"));
            byte[] b = new byte[1024];
            int nbRead = 1;
            while (nbRead > 0) {
                nbRead = fis.read(b);
                System.out.println("octets lus = " + nbRead);
                sos.write(b, 0, nbRead-1);
            fis.close();
            sos.close();et le code de l'applet qui appelle cette servlet est :
            URL selicPortal = null;
            try {
                selicPortal = new URL(
                        "http://localhost:8080/AppletTest/servlet/FileManipulation");
            } catch (MalformedURLException e) {
                e.printStackTrace();
            URLConnection selicConnection = null;
            try {
                selicConnection = selicPortal.openConnection();
            } catch (IOException e) {
                e.printStackTrace();
            selicConnection.setDoInput(true);
            selicConnection.setDoOutput(true);
            selicConnection.setUseCaches(false);
            selicConnection.setRequestProperty("Content-Type",
                    "application/octet-stream");
            try {
                InputStream in = selicConnection.getInputStream();
                FileOutputStream fos = new FileOutputStream(new File(tempDir
                        + "\\toto.bmp"));
                byte[] b = new byte[1024];
                int nbRead = in.read(b);
                while (nbRead > 0) {
                    fos.write(b);
                in.close();
                fos.close();
             } catch (IOException ioe) {
                ioe.printStackTrace();
            }the file dowloaded is broken. it seems that bytes 01 00 or 00 01 are not correctly process.
    Some ideas to help me please ?

    hi,
    have you solved this issue.. please post me the code since i m also doing the applet/servlet communication and can use your code as reference.
    how to read the content placed in the urlConnection stream in the servlet
    Below is my code in applet
    public void upload(byte[] imageByte)
              URL uploadURL=null;
              try
                   uploadURL=new URL("<url>");
                   URLConnection urlConnection=uploadURL.openConnection();
                   urlConnection.setDoInput(true);
                   urlConnection.setDoOutput(true);
                   urlConnection.setUseCaches(false);
                   urlConnection.setRequestProperty("Content-type","application/octet-stream");
                   urlConnection.setRequestProperty("Content-length",""+imageByte.length);
                   OutputStream outStream=urlConnection.getOutputStream();
                   outStream.write(imageByte);
                   outStream.close();
              catch(MalformedURLException ex)
              catch(IOException ex)
    How can i read the byte sent on the outstream (in above code) in the servlet.
    Thanks,
    Mclaren

  • Asynchronous applet-servlet communication

    Hi all,
    I am trying to implement asynchronous applet-servlet communication and need your help. Anything would help(I tried with synchronous applet-servlet communication but doesn't solve my problem).
    Thanks,

    http://java.sun.com/docs/books/tutorial/networking/index.html
    You can open a socket connection. Bother the client and the server
    can have separate threads for reading and writing and that you gives you
    asynchronous communication. Later, if you think the server is generating
    too many threads and not scaling, you can use features of .java.nio to
    make it more scalable:
    java.nio.channels

  • Applet/Servlet communication - StreamCorruptedException

    Hi, I'm having a problem when I try to connect to a servlet. I am using applet/servlet communication. The problem only occurs when I have lauched a crystal report via http in a new window.
    After the report is launched if I try to hit my servlet I get the following error:
    java.io.CorruptedStreamException: invalid stream header
    Not all crystal reports I launch cause this behavior but I can see nothing in the url I use to launch the report that is out of place or different than other reports.
    APPLET-SERVLET CONNECTION
    try {
    StringBuffer path = new StringBuffer();
    path.append(ip);
    path.append("servlet/DatabaseServlet?");
    path.append("option=getRecords&query=").append(URLEncoder.encode(query,"UTF-8"));
    URL url = new URL(path.toString());
    URLConnection servletConnection = url.openConnection();
    servletConnection.setUseCaches(false);
    servletConnection.setDoInput(true);
    servletConnection.setDoOutput(true);
    servletConnection.setRequestProperty("Content-Type", "application/x-java-serialized-object");
    ObjectInputStream inputFromServlet = new ObjectInputStream(servletConnection.getInputStream());
    rc = (RecordCollection) inputFromServlet.readObject();
    inputFromServlet.close();
    } catch (Exception e) {
    e.printStackTrace();
    SERVLET CODE
    Forwards to doPost
    public void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
    System.out.println("session id: " + request.getSession().getId());
    this.doPost(request, response);
    LAUNCHING REPORT FROM APPLET
    try {
    String launchURL = host + directory + report + "?promptOnRefresh=0"+ "&" +
    authentication + "&" + key + "&" + startPeriods + "&" + reportYears + "&" + reportTitle + "&" endPeriods "&" + locations + "&" + reportPeriod + "&" + fiscalWeek + "&" + fiscalYear + "&" +time;
    context.showDocument(new URL(launchURL), "_blank");
    } catch (Exception ex) {
    ex.printStackTrace();
    SAMPLE URL THAT CAUSES PROBLEM
    http://localhost:113/Reports/OpenToBuy_3.class?promptOnRefresh=0&user0=rpuser&password0=er34sw1&[email protected]=rpuser&[email protected]=er34sw1&user0@sub2=rpuser&[email protected]=er34sw1&promptex-key="L","L1","ALL"&promptex-start="1"&promptex-years="2004","2004"&promptex-title="Report Title"&promptex-end="1"&promptex-locs="01","03","04","05"&promptex-period="Feb 2004 [04-01]"&promptex-cw="1"&promptex-cy="2004"&promptex-time=-2-52728"
    Everything works fine until I launch this report then I can no longer get data from my servlet. I thought the URL lenght for the report might be the problem but I lauch a report with a URL longer than the problem one and there I don't get the errors after. When I try to connect to the servlet the println statement in the doGet method of my servlet doesn't get printed so it's not even making it inside that method in the servlet.
    Anyone have any idea what could be causing this? Anyone have any ideas what would be causing this? I'm really stumped.

    I've seen this problem before. Because your accessing a complete URL (ie http://<host>:<port>/xxx), you are actually creating a new session. Whenever the applet opens a connection to a servlet it is running on it's own session not the same as the JSP. This is rather obvious since the Page and Applet are separate entities.
    Try sending authentication with the url. I think the syntax is:
    username:password@http://localhost/xxx
    However I'm not sure how well this might work for Tomcat. As for Java it may try and throw a MalformedURLException I would have to test it first - it's been a long time since I used this technique!
    Wish I could be more help,
    Anthony

Maybe you are looking for

  • Tomcat6 does not load class files from WEB-INF/lib/myjarfile.jar  WHY???

    I have placed my jar file in c:\tomcat6\webapps\my-application\WEB-INF\lib\myjarfile.jar But, after restarting tomcat6, when i try to import the class file contained in the myjarfile.jar in a servlet, it says ProcessFileUpload.java:4: package test.te

  • Camera preview is great, then Aperture destroys it.

    When loading RAW photos from my Fuji X-T1 and Fuji X100 into Aperture, the camera previews are excellent (IMHO). Then, when I select the photo, "Loading..." briefly overlays the photo and then the RAW photo goes flat and lifeless. I spend a lot of ti

  • OBIEE on Unix

    Hi All, I have a small query. My Siebel is running on Windows. Can I have my OBIEE installed in Unix/Linux and get the data from Siebel(From WIndows)? Thanks in advance, Imtiaz.

  • Name of collective search help.

    Hi, How can we find the name of collective search help of any field in a  transaction? Say if we need to find the name of the collective search help of BATCH in VL02N transaction. Please suggest. Thanks, Suchi.

  • Adjustment A/C for GR/IR -OBYP

    Dear All Can anyone please tell me the what we have to do in OBYP-Define Adjustment Accounts for GR/IR Clearing. Thanks & Regards Kanwaljit