What language to write a simple webcam application

Hey all,
I need to write a simple application that will allow me to record video and audio from the computers webcam and mic. I need to be able to upload this to a server with a decent api for this sort of thing. I know webcams work in linux because of Ekiga (i think?) ,skype and etc.. working with it. But what language for linux would give me access to this hardware in a linux environment.
I have some ruby and python experience, and am not opposed to learning a new language to do this. I would like it to be cross platform or easily portable.
any suggestions?
thanks

fiddlinmacx wrote:Why reinvent the wheel? You can do this with VLC Media Player at the command line and you can even control it by sending commands to a network socket.
This, i did not know. Thanks very much.
I do need to wrap this in a simple GUI.
I would ideally like it to just have a record and upload button. Very simple. Just wondering the best way to pull this off.
Thanks again, will look at some of the CLI parameters with vlc
Last edited by skrite (2012-06-12 16:53:28)

Similar Messages

  • What is wrong in this simple J2EE application?

    Hello everyone,
    I am an undergraduate studying J2EE and I don't understand why the JavaBean that I create in the servlet is not correctly passed to the JSP page (I am trying to create a very simple Model 2 application that gets authentication data from an html form and return a jsp page that says if the login is ok or not, access to database is simulated by an if statement).
    In particular, the problem that I experience is that all values that I try to get from the JavaBean object in the JSP page are null instead of having the correct value that I set in the domain logic classes.
    The war archive is available at http://www.webalice.it/m.soderi/ApplicazioneLogin.war
    Can you give me a suggestion?
    Many thanks,
    Mirco Soderi.

    Hi,
    In the login result page you are creating a new instamce of the bean
    by calling
    <jsp:useBean id="UserInformation" class="login.LoginBean" scope="request"/>
    and using "UserInformation" in
    <jsp:getProperty
    you will always get null..
    In your approch you have to use scriplets to print the informatiom required from the session attribute "User information"
    dont declare a new bean using <jsp:useBean id="UserInformation"
    if you want to set the values to the bean then use setproperty method

  • What language should I learn?

    What single programming language should I learn that is most flexible? It's needs are to form the basis for MacOSX Cocoa applications, Linux command-line programs (and preferably least X11). This I ask here, for scientists likely lurk here, but don't always program in Objective C. (Though I've heard nothing but good things about it!)
    Currently, I use a variant of APL to assist as I work. When simplifying my life, around 1980, I changed to one editor: the platform-independent emacs. Now I should like to do the same with a 'general' programming language.
    Science is free, and scientists (I might suppose) support Richard Stallman's philosophy. Scientific source code needs be freely offered, written in an ISO standard language, and capable of being made platform-independent. It must easily be modified to use scientific libraries (lapack & netlib's others) and write linux, command-line programs, distributed by way of Sourceforge.
    I've been separated from other scientists for a long time. Is there a language satisfying the above scientific requirements that can also write 'modular' object-oriented applications for MacOSX, using the Aqua interface? If there are no caveats to using 'Java' for this purpose, I'll invest time in that. Have scientists or others faced this question?
    Thanks,
    Bruce
    PS. This question arose while searching for a simple little program to change images into icons:
    http://discussions.apple.com/message.jspa?messageID=7511505#7511505
    Here's the continuation of that post, that illustrates the problem, likely faced my many:
    Indeed, ... I could always use GraphicConverter.
    This topic begs the question of why we use GraphicConverter or PhotoShop to change a single color in an image. That's wasn't always supposed to be the case.
    Unix's credo: do only one thing, but do it well, and the popularity of Lotus 1-2-3, decades ago caused a great idea to emerge and gradually grow, until it became alive in developers' minds. Then it suffered a quick death, from unknown causes.
    Modular Software
    One day, a housewife becoming tired of spending a year learning and 'tuning' huge word processors to write a quick note saying she had gone to the corner market and would be back soon. The concept of modular software emerged: one would buy essentially, a text editor, then buy only those extra little modules you needed for your particular use: editing frills (as in emacs), formatting, adding images, importing & exporting formats, &c: 'personal' software. This needed a modular language; and, as it happened, C++ emerged soon. What ever happened to this idea (or the idea of using sounds for messages in addition to alarms, as in Growl), I never understood.
    Simple Software
    Many 'Google Images' have a white borders. It would be a clever idea to make background colors 'pure' (not in need of dithering when converted to a raster image). In the latter case, every GIF image could be dropped on an icon that could convert the lower-righthand pixel (the background) to a 'transparent' color. An old GIF image taken from the web could lose its background, and be ready to paste to the tiny icon in and 'Info Window'.
    Simple Modules
    Ah, but what about a Shft-Cmd-4 copy from my desktop? Mine are in JPEG format. I need to convert it to GIF. I could add a conversion module to the original little program (which could even convert to PNG). Ah, but the color of my Desktop varies or is, at least, not an 8-bit color (thank God). Then I could add a module that 'de-dithers' the color.
    Relation to Unix
    In old Unix these would be filters, something like this:
    cat image | ddthr | rfmt -png > icon
    Now I find myself using PhotoShop or GraphicConverter for finding & changing one color in an image. I'm still looking, and now becoming inclined to start programming again (which was always a mistake in the past).
    Problems with Programming
    Programming, I've avoided for two reasons: (1) two decades ago, I realized I had learned nearly a dozen text editors until I decided to use solely the platform-independent 'emacs'; and (2) I discovered it took me well over 6 months to master any programming language (more for a word processor), yet less than 6 weeks to forget it completely. (In the distant past, it was wise to choose one's language to match the project.)
    Macs
    However, I switched from Unix to Mac so I wouldn't have to think about computing any longer. Macs had always been built for such people as I, they are beautiful, and they can maintain themselves (or, a networked one can be set-up to do so).
    APL
    My preferred language is the APL variant 'J', which I use daily to test hypotheses, as I think about my research. Such a language, by the way, is great for pre-school children who can't read words yet. (Whether they'll ever be able to punctuate English correctly is another matter.)
    http://www.jsoftware.com
    Need for another Language
    However, I need eventually to convert my scientific algorithms to run in a Linux shell, using Linux's operators (such as 'filter' or 'tee') to combine the little modules.
    I'm now considering (re-)learning the platform-independent 'Java' language, and developing applications on Sourceforge. This way, scientific (ie. free) calculations could be integrated into online scientific papers and placed on other websites as well.

    Kappy,
    Sorry, I thought the question would be a common one confronting casual programmers. With such a variety of popular languages, there is likely no simple answer. I rescind the question with an apology and shall investigate my own problem myself. Sorry.
    The question was, being tired of using the wrong but kindly written MacOSX applications, is there a programming language I can learn now that will also serve me in the future?
    1. Now I need to write, for example, the program described to process photographic images, whose structures are arrays of arrays. Is there a language with such structures less bloated than C++?
    2. Old APL an object-orented language designed for quickly writing algorithms for exactly these structures (the common structures in engineering, science, and mathematics).
    3. Is there an object-oriented language for such structures, also used to write MacOSX applications, that one can learn to correctly build applications in 6 months (rather than 6 years)? This means strong typing, static type checking, automatic memory management, &c. An 'interpreter' as well would be nice!
    4. For science, it must be a high-level, very portable but standard language that can be compiled into (say) byte code for a standard virtual machine that is on all computers. For image processing on my own little Mac, it needs to be compiled all the way to Altvec-optimized machine code.
    5. Is there now such a beast? One that can be hooked at a low level with libraries (written in C or C++), and hooked at a high level to an OOUI (Aqua, in particular)?
    Sorry, I expected an engineer to say:-
    'Sure, MacOSX's compiler is based on the GCC, which contains a compiler for Java. It hooks at many levels. We use it to send code to afilliates around the Globe; and even Windows users haven't complained.
    'Several lexical analyzers have even been written (in C) for Java: so you can parse your spam as well!'
    But I don't know the above to be true.
    I was looking for reasons why Java might not be the better of the GCC languages for 'amateur programming'. I'm sorry I 'passed the buck', when I shouldn't have. This footwork I'll do myself after I can again install /Developer.
    Things I expect to be common problems never are.
    Thanks anyway.
    Bruce

  • Deploy simple Labview applications without installing the Labview runtime?

    [Labview 8.21 - Windows XP]
    Hello and a happy new year to all !
    I have coded very simple Labview applications that basically read text files (exported from Ms Excel), make some string operations, array sorting and at the end write another text file that is then imported in Ms Access. Now I would like other people from the School parents association to use this application on their own PC but ideally without having to install the Labview run-time;  for various reasons one of them being that they are not administrator of their PC, another reason being that I feel bad to ask them to install 100Mb of programs on their PC to execute my <1Mb applications. All that I can assume is that they have Excel and Access installed on their PC.
    I have read some postings on the Forum and in the Knowledge base from which I understand that the only way to use my application without the Labview runtime is to build a shared library that maybe I could then link via a VBA code from inside Excel or Access. But I cannot find any usable example on how to do that practically. And maybe it is not possible. 
    What is the easiest way to run such very simple Labview compiled applications on a PC that does not have Labview installed? Is Labview not at all built for such use?
    Thanks a lot for your help and ideas.
    Christophe

    You will need to have the runtime installed. There is a lot of other languages that also have the need for there own runtime, but they are commonly installed with the OS, so you don't realize it. Just building a dll won't solve this.
    There might be a hack possible, though. People have managed to strip down the required installation and been able to deploy the required parts of the runtime only. If you want to go this way, search on LAVA. But I'm not sure if it works with LV 8.20, and you will need to invest some time to figure out the minimum requirements. But be aware that it is a hack, so it's on your own risk.
    Felix
    www.aescusoft.de
    My latest community nugget on producer/consumer design
    My current blog: A journey through uml

  • What language would suit someone who hates anything that isn't PHP?

    Psst. Yes, this message is long, but so are my requirements. Please take the extra few seconds to read it
    First it was QBasic, then QuickBasic, then, of all things, Visual Basic... version 1.0. On Win98. Then XP.
    I made a lot of stuff with VB. 500 doesn't give a very good indication of how many things I made with VB 1.0, but I remember having more items than that in my c:\vbwin folder. VB might not look all that great visually, but it had a few things I've not found in any other language/environment, namely simplicity, freedom of use, speed, flexibility, hackability, and speed. Definately speed. It wasn't great on memory usage however - after my projects started creating 80KB binaries, VB would start to get crashy.
    But VB had simplicity because it didn't use the 2873598734-options 997341234-properties 897592873562874353469582743-functions mantra of VB 6.0 nor the 9-billion-of-everything mantra of .net. I could whip up an application in that environment within seconds - indeed, I became quite a master at configuring some defaults I liked for forms and adding a hidden button that responded to the ESC key in about 7 seconds. It had freedom of use because... I could do anything with it. I could, because I was just that patient enough, use 234 perfectly aligned pictureboxes to create "the Win95 look" in a program designed to work on Windows 3.1 (yes, VB 1.0 is 16-bit ), and VB had speed because those 234 pictureboxes appeared on my running program's form when I hit F5 faster than I could blink. It had flexibility because I could shove 12MB of BMPs into my EXE and it'd run fine. It had hackability because I could import the Win16 API and work around issues in the language itself to make my applications what I wanted them to be. Did I mention the speed? Well, it was copyrighted in 1991, so was written in the good old days of the 16MHz 486!
    However, all that fun was, sadly, from a while ago. Like, 8 months ago or so, probably more.
    What marked the end of that period was a conversation on IRC one day: someone gave me a 5-or-so line snippet of code in PHP. It wasn't very complicated, but it showed a clean solution to something I needed to do with web development, which I was just getting into at the time - I can't really remember what the actual issue was, but I do remember that my choices were either to use the code snippet, or go through some looong complex process to complete whatever it was I wanted to do manually.
    The code didn't look too scary, so I installed PHP and gave it a whirl. And I've liked, used, and abused PHP for many months following that initial "well maybe this isn't so bad". I don't mind PHP's use of 14 functions or more/less to do the same thing, or the fact that PHP isn't multithreaded. I probably wouldn't take advantage of multithreading in my code for a long time anyway, and PHP does have pcntl_fork() if I want to do two things at once in a controlled way.
    However... I'm starting to outgrow PHP, and I'm a bit homesick of VB's visual ease of use as well. I want an environment that lets me drag'n'drop a picturebox onto a form, shove a pile of pictureboxes inside of it, then programmatically manage them all. Yes, that's exactly the kind of thing I'd do with VB 1.0, and what do you know, I created something good from it - a simple but very usable media center-ish user interface complete with animation and it all ran fast on the PC I was using, a Pentium 3 clocked at 450MHz, with only 128MB RAM.
    Yes, PHP-GTK, PHP-QT and PHP-TK do exist, and they've all failed on my system at various points: PHP-GTK compiles and works absolutely fine, but breaks PHP-CGI. PHP-QT won't compile on my system, and its compile process is just too hard to tweak so I can't try gcc-3.4 on it. And anything involving PHP-TK that doesn't amount to creating a single, empty, lifeless window titled "PHP/TK" produces warnings or segfaults.
    So I'm looking for a programming language that gives me something comparable or equal to what VB 1.0 had - a visual drag'n'drop development environment that didn't visually overwhelm, compilation, and speed, and what PHP has - simplicity, readability, and bindings to/for everything that isn't desktop application development, without the VB syntax format. I'm past VB, and about to surpass PHP.
    Possible candidates for a new language are pretty much anything that includes both a compiler and interpreter, looks and feels like PHP, has nothing PHP doesn't have, but offers more power by using more functions, not weird, non-C-like ASCII character soup. So, if you were to take the PHP parsing engine and couple that with a bunch of libraries that adds sane stuff like native window support, the ability to manage boxes and squares in code, and so on. OR anything equivalent. So if something had ability XYZ which I couldn't figure out how to use, but also let me complete goal ABC while *not* using XYZ, it meets my requirements. And if something has just an compiler, you'll have a bit of a hard time convincing me to like it, but if it only has an interpreter, you'll really need to sell it to me, since I'm starting to get the compilation bug again, just like I did 7-8 years ago when I gazed at the wonder that was the EXE and wanted so badly to create my own.
    Also, before you list Perl, let me stop you: Perl has too many unreadabilities. "test ? abc : def" is about as far as I'm prepared to go; I far prefer English text over regular expressions, Awk and the like. Also, C is just too much. It is, probably unsurprisingly considering what you've just read, too cool for my artistic brain. I don't want a language that can do everything: I get inspired by difficulty, not being able to do whatever I want. Yes, that's how my brain works, and I need to go with the flow, not against it, so simply because C can do absolutely anything and everything, I can't use it.
    I will, however, note that I also like the Bash language, and the way it works, if only it wasn't so slow!
    So, to sum up, the best things I've written include a media center user interface in a language that's 17 years old (same age as me! ), a telnet server using PHP (I wrote the RFC-compliant telnet parser myself, from scratch), and lastly a textual taskbar, an IRC client, and some animations using Bash.
    I want a language that is readable and doesn't try to extend or expound on its own using syntax but lets me do the thinking my own way, so I have nothing stopping me from using it for what it wasn't used for. Because isn't that what we all do with programming languages anyway?
    -dav7

    As promised...
    A little simple at the moment, but it's the result of a dream... to create The Perfect Language. I just may end up calling it TPL if it works out.
    ; dav7's view of what The Perfect Language is
    ; Licensed under the Nonexistant Public License (NPL) - "do w/e you want w/ it, just give me a bit of credit."
    ; 30-sep-08 - ?-oct-08
    ; <[email protected]>
    ; /me invents comment blocks so he doesn't have to keep typing ;s
    There. :D
    Now, the problem with most common programming languages (I'm looking at you, C) is that they
    - are rather unreadable
    - are really hard to work with for the unknowledgable
    - impose a 32768-second wait on the impatient, ADHD-infused programmer as the code file(s) compile for the
    247th time
    - involve a lot of typing, some of it needing to be a specific case (CAPS or lowercase)
    - requires a lot of input to get something basic functional, and has a very high initial code to output
    ratio: at the beginning of a project a high percentage of code is required to get a reasonable amount of
    output, and only after there is a fairly decent amount of code present will the code / output ratio
    decrease so that only a relatively small amount of code is needed to produce the application-specific
    output desired
    - is not natively very image-oriented - to display an image in a window without 5GB of libraries, I need to
    know Xlib, how to decode PNGs and how to manage double-buffering
    So, I want to create a language that
    - is both readable AND easy to type. No, I'm not going to do a survey of what word groups are the easiest
    for the eye to pick up on, or go anywhere near that extreme; rather, my language will have two "modes".
    One is amazingly quick to type, and the other, while relatively minimalistic, actually uses ASCII characters
    to denote function, data and flow, and my compiler/interpreter combo will have a converter that will pass
    through and convert a code file from one "syntax mode" to the other.
    - can be both interpreted or emitted, depending on the situation ("emitted" here means that instead of working on
    something that can generate native code for 784598754 platforms myself, I'll just output C-- code or something)
    - has bindings for X
    - makes it very easy to debug a program
    From a result-, goal- or solution-based person like myself, I don't see language design the way most others would.
    I don't value a language based on its algorithmic efficiency, I value it based on ease of use. I don't see things
    from a procedural perspective, but rather a tokenized object oriented tree of constructs that I must feed to the
    computter to achieve the result I want. This language adheres to that principle.
    So, let's get started with this new language. As I go along, I explain points of interest / trivia about whatever
    I'm referring to.
    ; The ubiquitous "Hello World". To print something, you encase it with single or double quotes and don't assign
    ; any meaning to it by telling the language to set the string to a variable or test it against something. A
    newline is automatically added at the end of a line of such output produced by quoting.
    "Hello world!"
    ; variable assignment by usage. There's no "true" or "false" here. Everything uses plain, un-expounded (in that 0
    won't mean false or 1 true) integers to represent state or status.
    x = 1
    ; if/then - the '? var : abc : def' construct compares 'var', and if 'var' is 1, it executes 'abc', otherwise it
    ; executes 'def'. This'll print "x = 1!". This construct could be used to do anything - I'd want it to operate
    ; as much like the C preprocessor as possible.
    ? x = 1: "x = 1!" : "x = 0!"
    ; the previous line could also be written as:
    ? x: "x = 1!" : "x = 0!"
    ; or even:
    "'x' is equal to $x, which would equal"; ? x: "TRUE" : "FALSE"; "in a lot of other programming languages."
    ; calling a procedure. See the procedure declaration below for more info.
    test x
    ; a loop. Loops start with a '[' and end with a ']'. This language doesn't have any for or while loops - you
    ; construct those on your own.
    [ ;; this demos both nested comment blocks, and the fact that I stole C's add-1 method -> ;; x++
    ; the ! operator breaks out of a loop. I might change this.
    ? x > 5: !
    ; Print the current index, up to 5. Using a $ next to a known variable name in a quoted string will
    ; print that variable's contents.
    "$x"
    ; Now for a for-esque loop - very similar to the previous example. Note that at the beginning of the block, a
    ; semicolon isn't required to denote its seperation of the pre- or proceeding code behind and in front of it.
    z = 0 [ z++; ? z > 10: !
    "$z"
    ; procedure start. No definition of the function or parameters is required - variables are accessible inside
    ; the function as 'a', 'b', 'c', etc. When 'z' is reached the next variable is indexed as 'aa', then the next
    ; as 'ab', etc. Also, functions can be defined after they're called - the parser will have the entire program
    ; in memory before it executes a single line of it, and the compiler will likewise parse the entire program
    ; before outputting any C.
    test:
    ; Yes, it looks like I have the quotes wrong, but I don't. This language allows for Bash-style
    ; variable-string combination ;)
    "ohai from teh procedure! You passed "$a"!"
    ; procedure end. Note that I start with "proc:" and end with ":proc" - this makes it very easy to see
    ; what function I might be seeing the end of if it's long and I can see any function starts.
    :test
    ; Now for everything demoed here as a one-liner.
    "Hello world!"; x = 1; ? x: "x = 1!" : "x = 0!"; "'x' is equal to $x, which would equal"; ? x: "TRUE" : "FALSE"; "in a lot of other programming languages."; test; [ ? x > 5: !; "$x" ] z = 0 [ z++; ? z > 10: !; "$z" ] test: "ohai from teh procedure!" :test
    ; And now for everything in its slightly more readable form...
    "Hello world!"
    x = 1
    if x = 1 then "x = 1!" else "x = 0!"
    if x then "x = 1!" else "x = 0!"
    "'x' is equal to $x, which would equal"; if x then "TRUE" else "FALSE"; "in a lot of other programming languages."
    test
    [ x++
    if x is greater than 5 then break
    ; OR
    ; if x > 5 then break
    "$x"
    z = 0 [ z++; if z > 10 then !
    "$z"
    test:
    "ohai from teh procedure!"
    :test
    ; And now for this version as its oneliner:
    "Hello world!"; x = 1; if x then "x = 1!" else "x = 0!"; "'x' is equal to $x, which would equal"; ? x: "TRUE" : "FALSE"; "in a lot of other programming languages."; test; [ if x is greather than 5 then break; "$x" ] z = 0 [ z++; if z > 10 then break; "$z" ] test: "ohai from teh procedure!" :test
    That's about it.
    What do you think?
    What language has the closest syntax as mine?
    Is this language viable? Could it survive actually being developed?
    Please do let me know your opinions/comments/suggestions/flames.
    -dav7

  • Help needed in creating a simple paint application

    I want to create a simple paint application using swings in java, i am able to draw different shapes using mouse but the problem is when i select some other shape it simply replaces the already drawn object with the new one but i want the already drawn object also, like appending, what should be done for this, any logic missing here or i should use some other approach?
    Please help me
    package test;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class bmp extends JFrame implements MouseListener, MouseMotionListener,
              ActionListener {
         int w, h;
         int xstart, ystart, xend, yend;
         JButton elipse = new JButton("--Elipse--");
         JButton rect = new JButton  ("Rectangle");
         JPanel mainframe = new JPanel();
         JPanel buttons = new JPanel();
         String selected="no";
         public void init() {
              //super("Bitmap Functions");
              // display.setLayout(new FlowLayout());
              buttons.setLayout(new BoxLayout(buttons,BoxLayout.Y_AXIS));
              buttons.add(Box.createRigidArea(new Dimension(15,15)));
              buttons.add(elipse);
              buttons.add(Box.createRigidArea(new Dimension(0,15)));
              buttons.add(rect);
              Container contentpane = getContentPane();
              contentpane.add(buttons, BorderLayout.WEST);
              //getContentPane().add(display, BorderLayout.WEST);
              addMouseListener(this); // listens for own mouse and
              addMouseMotionListener(this); // mouse-motion events
              setSize(1152, 834);
              elipse.addActionListener(this);
              rect.addActionListener(this);
              setVisible(true);
         public void mousePressed(MouseEvent event) {
              xstart = event.getX();
              ystart = event.getY();
         public void mouseReleased(MouseEvent event) {
              xend = event.getX();
              yend = event.getY();
              repaint();
         public void mouseEntered(MouseEvent event) {
              //repaint();
         public void mouseExited(MouseEvent event) {
              //repaint();
         public void mouseDragged(MouseEvent event) {
              xend = event.getX();
              yend = event.getY();
              repaint();
         public void mouseMoved(MouseEvent event) {
              //repaint();
         public static void main(String args[]) {
              bmp application = new bmp();
              application.init();
              application.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         public void mouseClicked(MouseEvent arg0) {
         public void actionPerformed(ActionEvent event) {
              if (event.getSource() == elipse) {
                   selected = "elipse";
                   repaint();
              else if(event.getSource() == rect)
                   selected = "rectangle";
                   repaint();
         public void paint(Graphics g) {
              System.out.println(selected);
              super.paint(g); // clear the frame surface
              bmp b=new bmp();
              if (selected.equals("elipse"))
                   w = xend - xstart;
                   h = yend - ystart;
                   if (w < 0)
                        w = w * -1;
                   if (h < 0)
                        h = h * -1;
                   g.drawOval(xstart, ystart, w, h);
              if (selected.equals("rectangle"))
                   w = xend - xstart;
              h = yend - ystart;
              if (w < 0)
                   w = w * -1;
              if (h < 0)
                   h = h * -1;
              g.drawRect(xstart, ystart, w, h);
    }

    bvivek wrote:
    ..With this code, when i draw an elipse or line the image doesnt start from the point where i click the mouse. It added the MouseListener to the wrong thing.
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.image.BufferedImage;
    import javax.swing.*;
    public class test_bmp extends JPanel implements MouseListener,MouseMotionListener,ActionListener
           static BufferedImage image;
           Color color;
           Point start=new Point();
           Point end =new Point();
           JButton elipse=new JButton("Elipse");
           JButton rectangle=new JButton("Rectangle");
           JButton line=new JButton("Line");
           String selected;
           public test_bmp()
                   color = Color.black;
                   setBorder(BorderFactory.createLineBorder(Color.black));
           public void paintComponent(Graphics g)
                   //super.paintComponent(g);
                   g.drawImage(image, 0, 0, this);
                   Graphics2D g2 = (Graphics2D)g;
                   g2.setPaint(Color.black);
           if(selected=="elipse")
                   g2.drawOval(start.x, start.y, (end.x-start.x),(end.y-start.y));
                   System.out.println("paintComponent() "+start.getX()+","+start.getY()+","+(end.getX()-start.getX())+","+(end.getY()-start.getY()));
                   System.out.println("Start : "+start.x+","+start.y);
                   System.out.println("End   : "+end.x+","+end.y);
           if(selected=="line")
                   g2.drawLine(start.x,start.y,end.x,end.y);
           //Draw on Buffered image
           public void draw()
           Graphics2D g2 = image.createGraphics();
           g2.setPaint(color);
                   System.out.println("draw");
           if(selected=="line")
                   g2.drawLine(start.x, start.y, end.x, end.y);
           if(selected=="elipse")
                   g2.drawOval(start.x, start.y, (end.x-start.x),(end.y-start.y));
                   System.out.println("draw() "+start.getX()+","+start.getY()+","+(end.getX()-start.getX())+","+(end.getY()-start.getY()));
                   System.out.println("Start : "+start.x+","+start.y);
                   System.out.println("End   : "+end.x+","+end.y);
           repaint();
           g2.dispose();
           public JPanel addButtons()
                   JPanel buttonpanel=new JPanel();
                   buttonpanel.setBackground(color.lightGray);
                   buttonpanel.setLayout(new BoxLayout(buttonpanel,BoxLayout.Y_AXIS));
                   elipse.addActionListener(this);
                   rectangle.addActionListener(this);
                   line.addActionListener(this);
                   buttonpanel.add(elipse);
                   buttonpanel.add(Box.createRigidArea(new Dimension(15,15)));
                   buttonpanel.add(rectangle);
                   buttonpanel.add(Box.createRigidArea(new Dimension(15,15)));
                   buttonpanel.add(line);
                   return buttonpanel;
           public static void main(String args[])
                    test_bmp application=new test_bmp();
                    //Main window
                    JFrame frame=new JFrame("Whiteboard");
                    frame.setLayout(new BorderLayout());
                    frame.add(application.addButtons(),BorderLayout.WEST);
                    frame.add(application);
                    application.addMouseListener(application);
                    application.addMouseMotionListener(application);
                    //size of the window
                    frame.setSize(600,400);
                    frame.setLocation(0,0);
                    frame.setVisible(true);
                    int w = frame.getWidth();
                int h = frame.getHeight();
                image = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
                Graphics2D g2 = image.createGraphics();
                g2.setPaint(Color.white);
                g2.fillRect(0,0,w,h);
                g2.dispose();
                    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
           @Override
           public void mouseClicked(MouseEvent arg0) {
                   // TODO Auto-generated method stub
           @Override
           public void mouseEntered(MouseEvent arg0) {
                   // TODO Auto-generated method stub
           @Override
           public void mouseExited(MouseEvent arg0) {
                   // TODO Auto-generated method stub
           @Override
           public void mousePressed(MouseEvent event)
                   start = event.getPoint();
           @Override
           public void mouseReleased(MouseEvent event)
                   end = event.getPoint();
                   draw();
           @Override
           public void mouseDragged(MouseEvent e)
                   end=e.getPoint();
                   repaint();
           @Override
           public void mouseMoved(MouseEvent arg0) {
                   // TODO Auto-generated method stub
           @Override
           public void actionPerformed(ActionEvent e)
                   if(e.getSource()==elipse)
                           selected="elipse";
                   if(e.getSource()==line)
                           selected="line";
                   draw();
    }

  • Simple J2EE application fails under activation

    Hi,
    I have a simple J2EE application which contains one Servlet.
    I have two DCs: SSORedirector (Enterprise application project) and SSORedirectWebModuleWebModule (Web Module)
    (there is a third DC which is a child DC to SSORedirector, but I don't think it causes any problems)
    The web module has by default public part called war (an I haven't touched this).
    The Enterprise application project I have addeed the required references to the web module in the application.xml(this automatically set a Used DC reference).
    When right-clicking the enterprise application and selecting build, it builds a correct ear file, and if I deploy it to my local workplace installation, the J2EE application works as expected.
    However, when I try to check in and activate the activity the SDM deployment fails with the message: Info:java.lang.RuntimeException: Incorrect EAR file. EAR /usr/sap/ED2/JC00/SDM/root/origin/bouvet.com/SSORedirector/JDI_ZEPSSO_D/8596/bouvet.com_PASSTHROUGH_SSO_1_default_bouvet.com_SSORedirector_200602161842250637.sda does not contain entry META-INF/application.xml as required by the J2EE specification.
    I've retrieved the .sda file on the file system (shouldn't it be an .ear file) and it contains the application.xml under the folder meta-inf. The complete contents of the sda file is
    ./d1c66970ddbec7e6ffcc4d01c4705600.HASH
    ./META-INF/application-j2ee-engine.xml
    ./META-INF/application.xml
    ./META-INF/MANIFEST.MF
    ./META-INF/SAP_MANIFEST.MF
    ./META-INF/sda-dd.xml
    ./src/java/src.zip
    ./bouvet.com~SSORedirectorServlets.war
    What could possibly be wrong?
    Below are some logs.
    <b>Deployment log</b>
    SAP Change Management Service
    System sapJDI.st.bouvet.no
    Build space JDI_ZEPSSO_D
    Request 8554
    Step Deployment
    Log /sapmnt/JDI/global/TCS/LOG/JDI_ZEPSSO_D2006021618420025.log
    Info:deploy every archive associated to the buildspace: JDI_ZEPSSO_D
    Info:getting DC SSORedirector from CBS for buildspace: JDI_ZEPSSO_D
    Info:archive /sapmnt/JDI/global/TCS/DEPLOYARCHIVES/bouvet.com_PASSTHROUGH_SSO_1_default_bouvet.com_SSORedirector_200602161842250637.sda for DC SSORedirector was transfered
    Info:Start deployment:
    Info:The following archives will be deployed (on http://sapED2.st.bouvet.no:50018)
    Info:/sapmnt/JDI/global/TCS/DEPLOYARCHIVES/bouvet.com_PASSTHROUGH_SSO_1_default_bouvet.com_SSORedirector_200602161842250637.sda
    Info:SDM log:
    Info:
    Info:
    Info:
    Info:
    Info:
    Info:
    Info:
    Info:
    Info:Feb 16, 2006 7:39:58 PM  Info: -
    Starting deployment -
    Info:Feb 16, 2006 7:40:01 PM  Info: Loading selected archives...
    Info:Feb 16, 2006 7:40:01 PM  Info: Loading archive '/usr/sap/ED2/JC00/SDM/program/temp/bouvet.com_PASSTHROUGH_SSO_1_default_bouvet.com_SSORedirector_200602161842250637.sda'
    Info:Feb 16, 2006 7:40:11 PM  Info: Selected archives successfully loaded.
    Info:Feb 16, 2006 7:40:11 PM  Info: Actions per selected component:
    Info:Feb 16, 2006 7:40:11 PM  Info: Update: Selected development component 'SSORedirector'/'bouvet.com'/'JDI_ZEPSSO_D'/'8596' updates currently deployed development component 'SSORedirector'/'bouvet.com'/'JDI_ZEPSSO_D'/'8590'.
    Info:Feb 16, 2006 7:40:14 PM  Info: The deployment prerequisites finished withtout any errors.
    Info:Feb 16, 2006 7:40:14 PM  Info: Saved current Engine state.
    Info:Feb 16, 2006 7:40:15 PM  Info: Error handling strategy: OnErrorSkipDepending
    Info:Feb 16, 2006 7:40:15 PM  Info: Update strategy: UpdateAllVersions
    Info:Feb 16, 2006 7:40:15 PM  Info: Starting: Update: Selected development component 'SSORedirector'/'bouvet.com'/'JDI_ZEPSSO_D'/'8596' updates currently deployed development component 'SSORedirector'/'bouvet.com'/'JDI_ZEPSSO_D'/'8590'.
    Info:Feb 16, 2006 7:40:15 PM  Info: SDA to be deployed: /usr/sap/ED2/JC00/SDM/root/origin/bouvet.com/SSORedirector/JDI_ZEPSSO_D/8596/bouvet.com_PASSTHROUGH_SSO_1_default_bouvet.com_SSORedirector_200602161842250637.sda
    Info:Feb 16, 2006 7:40:15 PM  Info: Software type of SDA: J2EE
    Info:Feb 16, 2006 7:40:15 PM  Info: ***** Begin of SAP J2EE Engine Deployment (J2EE Application) *****
    Info:Feb 16, 2006 7:40:15 PM  Info: ***** End of SAP J2EE Engine Deployment (J2EE Application) *****
    Info:Feb 16, 2006 7:40:15 PM  Error: Aborted: development component 'SSORedirector'/'bouvet.com'/'JDI_ZEPSSO_D'/'8596':
    Info:Caught exception during access of archive "/usr/sap/ED2/JC00/SDM/root/origin/bouvet.com/SSORedirector/JDI_ZEPSSO_D/8596/bouvet.com_PASSTHROUGH_SSO_1_default_bouvet.com_SSORedirector_200602161842250637.sda":
    Info:java.lang.RuntimeException: Incorrect EAR file. EAR /usr/sap/ED2/JC00/SDM/root/origin/bouvet.com/SSORedirector/JDI_ZEPSSO_D/8596/bouvet.com_PASSTHROUGH_SSO_1_default_bouvet.com_SSORedirector_200602161842250637.sda does not contain entry META-INF/application.xml as required by the J2EE specification.
    Info: (message ID: com.sap.sdm.serverext.servertype.inqmy.extern.EngineApplOnlineDeployerImpl.performAction(DeploymentActionTypes).null)
    Info:Feb 16, 2006 7:40:26 PM  Info: J2EE Engine is in same state (online/offline) as it has been before this deployment process.
    Info:Feb 16, 2006 7:40:27 PM  Error: -
    At least one of the Deployments failed -
    Info:end of log received from SDM
    Info:End deployment:
    Info:deploy finished for SSORedirector (8554) with rc=12
    Info:deployment finished for buildspace: JDI_ZEPSSO_D
    <b>CBS log</b>
      CBS Request Log - [  8554/JDI_ZEPSSO_D  ]
      sapjdi.st.bouvet.no SAP Component Build Server   
    Build number assigned: 8596
    Change request state from QUEUED to PROCESSING
    ACTIVATION request in Build Space "JDI_ZEPSSO_D" at Node ID: 37,956,050
         [id: 8,554; parentID: 0; type: 4]
         [options: NO OPTIONS]
    REQUEST PROCESSING started at 2006-02-16 18:41:35.949 GMT
    ===== Pre-Processing =====
    List of activities to be activated:
         1 activity in compartment "bouvet.com_PASSTHROUGH_SSO_1"
              C049689.6 - Passthrough SSO
                   [seq. no 17][created by 433937 at 2006-02-16 19:41:49.0][ID 44ed44bc9f1911daae5b0012799e50b6]
    Analyse activities... started at 2006-02-16 18:41:35.967 GMT
         Synchronizing component "bouvet.com/SSORedirector" from repository... finished at 2006-02-16 18:41:37.129 GMT and took 1 s 10 ms
              Component "bouvet.com/SSORedirector" is to be CHANGED by this activation.
         Synchronizing component "bouvet.com/SSORedirectWebModule" from repository... finished at 2006-02-16 18:41:37.933 GMT and took 802 ms
              Component "bouvet.com/SSORedirectWebModule" is to be CHANGED by this activation.
         Synchronizing component "bouvet.com/SSORedirectorServlets" from repository... finished at 2006-02-16 18:41:39.144 GMT and took 1 s 211 ms
         3 components to be build in compartment "bouvet.com_PASSTHROUGH_SSO_1"
    Analyse activities... finished at 2006-02-16 18:41:39.202 GMT and took 3 s 235 ms
    Calculate all combinations of components and variants to be built...
         "bouvet.com/SSORedirector" variant "default"
         "bouvet.com/SSORedirectorServlets" variant "default"
         "bouvet.com/SSORedirectWebModule" variant "default"
    Prepare build environment in the file system... started at 2006-02-16 18:41:39.410 GMT
         Synchronize development configuration... finished at 2006-02-16 18:41:39.430 GMT and took 20 ms
         Synchronize component definitions... finished at 2006-02-16 18:41:39.469 GMT and took 38 ms
         Synchronize sources...
         Synchronize sources... finished at 2006-02-16 18:41:40.891 GMT and took 1 s 422 ms
         Synchronize used libraries...
              public part "war" of component "bouvet.com/SSORedirectWebModule" ... OK
                   [PP "war" of DC 381 variant "default"][SC 142][last successfull build: 0]
              public part "default" of component "sap.com/ejb20" ... OK
                   [PP "default" of DC 128 variant "default"][SC 139][last successfull build: 8020]
              public part "default" of component "sap.com/jdbc20" ... OK
                   [PP "default" of DC 145 variant "default"][SC 139][last successfull build: 8020]
              public part "default" of component "sap.com/jms" ... OK
                   [PP "default" of DC 147 variant "default"][SC 139][last successfull build: 8020]
              public part "default" of component "sap.com/servlet" ... OK
                   [PP "default" of DC 166 variant "default"][SC 139][last successfull build: 8020]
              public part "default" of component "sap.com/ejb20" ... OK
                   [PP "default" of DC 128 variant "default"][SC 139][last successfull build: 8020]
              public part "default" of component "sap.com/jdbc20" ... OK
                   [PP "default" of DC 145 variant "default"][SC 139][last successfull build: 8020]
              public part "default" of component "sap.com/jms" ... OK
                   [PP "default" of DC 147 variant "default"][SC 139][last successfull build: 8020]
              public part "default" of component "sap.com/servlet" ... OK
                   [PP "default" of DC 166 variant "default"][SC 139][last successfull build: 8020]
         Synchronize used libraries... finished at 2006-02-16 18:41:43.712 GMT and took 2 s 820 ms
    Prepare build environment in the file system... finished at 2006-02-16 18:41:43.712 GMT and took 4 s 302 ms
    ===== Pre-Processing =====  finished at 2006-02-16 18:41:43.713 GMT and took 7 s 755 ms
    ===== Processing =====
    BUILD DCs
         "bouvet.com/SSORedirectorServlets" in variant "default"
              Public Part "war" has been changed. Dependent components will be marked as DIRTY and re-built later.
              The build was SUCCESSFUL. Archives have been created.
         "bouvet.com/SSORedirectWebModule" in variant "default"
              Public Part "war" has been changed. Dependent components will be marked as DIRTY and re-built later.
              The build was SUCCESSFUL. Archives have been created.
         "bouvet.com/SSORedirector" in variant "default"
              The build was SUCCESSFUL. Archives have been created.
    ===== Processing =====  finished at 2006-02-16 18:41:56.154 GMT and took 12 s 436 ms
    ===== Post-Processing =====
    Check whether build was successful for all required variants...
         "bouvet.com/SSORedirectorServlets" in variant "default"   OK
         "bouvet.com/SSORedirectWebModule" in variant "default"   OK
         "bouvet.com/SSORedirector" in variant "default"   OK
    Update component metadata...
         "bouvet.com/SSORedirector"  has been CHANGED
         "bouvet.com/SSORedirectWebModule"  has been ACTIVATED
    STORE build results...
         "bouvet.com/SSORedirectorServlets": store meta-data
         "bouvet.com/SSORedirectorServlets" in "default" variant  is PROCESSED
         "bouvet.com/SSORedirectWebModule": store meta-data
         "bouvet.com/SSORedirectWebModule" in "default" variant  is PROCESSED
         "bouvet.com/SSORedirector": store meta-data
         "bouvet.com/SSORedirector" in "default" variant  is PROCESSED
    Change request state from PROCESSING to SUCCEEDED
    Analyse effect of applied changes to buildspace state... started at 2006-02-16 18:41:56.364 GMT
    Handle Cycles...
         No cycles detected.
    Determine components that have become DIRTY due to the results of this request...
         No such components have been found.
    Integrate activities into active workspace(s)...
         Integration of activities in compartment "bouvet.com_PASSTHROUGH_SSO_1" started at 2006-02-16 18:41:56.785 GMT
              "C049689.6 - Passthrough SSO"   OK
         Integration of 1 activities in compartment "bouvet.com_PASSTHROUGH_SSO_1" finished at 2006-02-16 18:42:16.614 GMT and took 19 s 829 ms
    Analyse effect of applied changes to buildspace state... finished at 2006-02-16 18:42:16.615 GMT and took 20 s 251 ms
    Request SUCCEEDED
    ===== Post-Processing =====  finished at 2006-02-16 18:42:16.617 GMT and took 20 s 451 ms
    REQUEST PROCESSING finished at 2006-02-16 18:42:16.618 GMT and took 40 s 669 ms

    Managed to solve it in a obscure way.
    I had earlier deployed the .ear file directly from NWDS to our dev system (hadn't installed dev workplace then). By removing the application from the deploy service in visual admin, the import suddenly worked.
    Dagfinn

  • New to Java. Want to write a simple applet for a mobile phone.

    Hello,
    I want to write a simple java applet for a mobile phone. currently I am in the stage of thinking about whether this is possible in a timeframe of about a month. I have very little java experience from a while back so I'm pretty much starting from scratch.
    All I want is an applet that lets you send 2 or 3 variables to an online server. The server will then reposition telescopes.
    All i'm concerned with is the mobile phone part, which doesn't have to be secure or impressive. Just a simple interface.
    Ideally it should work on my nokia 6070, which occording to the official specs has the following java technology:
    MIDP 2.0
    CLDC 1.1
    JSR 120 Wireless Messaging API
    JSR 135 Mobile Media API
    Nokia UI API
    (I don't know what any of this means but am a good learner).
    Can anyone offer me any advice? Is this possible in my timeframe? where should I start? I need a editor and compiler also (I'm using windows XP).
    Many thanks and kind regards,
    Jason

    Actually it is working on my phone now.
    I changed the target platform in the wireless toolkit settings to MIDP 1.0
    Now to create the fields coordinate fields etc. I don't have much of a clue really.
    Current I have:
    import java.io.*;
    import javax.microedition.lcdui.*;
    import javax.microedition.midlet.*;
    public class AtmosMIDlet extends MIDlet implements CommandListener
    Form WelcomeForm = new Form("AtmosMIDlet");
    StringItem WelcomeMes = new StringItem(null, "Please enter coordinates:");
    TextField Longitude = new TextField("Longitude", "", 3, TextField.NUMERIC);
    TextField Lattitude = new TextField("Lattitude", "", 3, TextField.NUMERIC);
    public AtmosMIDlet()
    try
    ImageItem logo = new ImageItem(Image.createImage("/logo.png"));
    WelcomeForm.append(logo);
    catch (java.io.IOException x)
    throw new RuntimeException ("Image not found");
    WelcomeForm.append(WelcomeMes);
    WelcomeForm.append(Longitude);
    WelcomeForm.append(Lattitude);
    WelcomeForm.addCommand(new Command("Exit", Command.EXIT, 0));
    WelcomeForm.setCommandListener(this);
    public void startApp()
    Display.getDisplay(this).setCurrent(WelcomeForm);
    public void pauseApp() {}
    public void destroyApp(boolean unconditional) {}
    public void commandAction(Command c, Displayable s)
    notifyDestroyed();
    I'm trying to get the image logo.png to display at the top but I get the error:
    C:\WTK25\apps\AtmosSpec\src\AtmosMIDlet.java:19: cannot find symbol
    symbol : constructor ImageItem(javax.microedition.lcdui.Image)
    location: class javax.microedition.lcdui.ImageItem
    ImageItem logo = new ImageItem(Image.createImage("/logo.png"));
    ^
    1 error
    com.sun.kvem.ktools.ExecutionException
    Build failed
    When I try to build.. Any help would be great.
    Ideally the image would be on a seperate screen for a couple of seconds.

  • Java.lang.ClassCastException in simple struts application. please help me!

    I have a simple struts application, it only have a login form. however, it's alway throw java.lang.ClassCastException when I submit the form. Here is full stack trace:
    14-03-2007 17:04:50 org.apache.struts.chain.ComposableRequestProcessor init
    INFO: Initializing composable request processor for module prefix ''
    14-03-2007 17:04:50 org.apache.struts.chain.commands.servlet.CreateAction getAction
    INFO: Initialize action of type: ndlinh.struts.lab.RegistrationForm
    14-03-2007 17:04:50 org.apache.struts.chain.commands.AbstractExceptionHandler execute
    WARNING: Unhandled exception
    java.lang.ClassCastException: ndlinh.struts.lab.RegistrationForm
         at org.apache.struts.chain.commands.servlet.CreateAction.getAction(CreateAction.java:66)
         at org.apache.struts.chain.commands.AbstractCreateAction.execute(AbstractCreateAction.java:82)
         at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:48)
         at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
         at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)
         at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
         at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:280)
         at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1858)
         at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:459)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
         at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
         at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
         at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
         at java.lang.Thread.run(Thread.java:595)
    14-03-2007 17:04:50 org.apache.struts.chain.commands.ExceptionCatcher postprocess
    WARNING: Exception from exceptionCommand 'servlet-exception'
    java.lang.ClassCastException: ndlinh.struts.lab.RegistrationForm
         at org.apache.struts.chain.commands.servlet.CreateAction.getAction(CreateAction.java:66)
         at org.apache.struts.chain.commands.AbstractCreateAction.execute(AbstractCreateAction.java:82)
         at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:48)
         at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
         at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)
         at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
         at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:280)
         at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1858)
         at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:459)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
         at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
         at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
         at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
         at java.lang.Thread.run(Thread.java:595)
    Here is my code:
    package ndlinh.struts.lab;
    import javax.servlet.http.HttpServletRequest;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionMapping;
    public class RegistrationForm extends ActionForm {
         private String userid = null;
         private String password = null;
         private String password2 = null;
         public RegistrationForm() {
              System.out.println("************ Registration Form created *************");
          * @return the password
         public String getPassword() {
              return password;
          * @param password the password to set
         public void setPassword(String password) {
              this.password = password;       
          * @return the password2
         public String getPassword2() {
              return password2;
          * @param password2 the password2 to set
         public void setPassword2(String password2) {
              this.password2 = password2;
          * @return the userid
         public String getUserid() {
              return userid;
          * @param userid the userid to set
         public void setUserid(String userid) {
              this.userid = userid;
         public void reset(ActionMapping arg0, HttpServletRequest arg1) {
              userid = "";
              password = "";
              password2 = "";
    package ndlinh.struts.lab;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import org.apache.struts.action.Action;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionForward;
    import org.apache.struts.action.ActionMapping;
    public final class RegistrationAction extends Action {
         public ActionForward execute(ActionMapping mapping, ActionForm actionForm,
                                             HttpServletRequest request, HttpServletResponse response)
              try {
                   System.out.println("*******************" + actionForm.toString() + "*******************");
                   RegistrationForm form = (RegistrationForm)actionForm;     
                   String username = form.getUserid();
                   String password = form.getPassword();
                   System.out.println(username);
                   // simple login checking.
                   // if userid equals password, user can login to system
                   if ( username.equalsIgnoreCase(password)) {
                        return mapping.findForward("success");
                   } else {
                        return mapping.findForward("failure");
              } catch (Exception e) {
                   e.printStackTrace();
                   return mapping.findForward("failure");
    }registration.jsp
    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
        pageEncoding="ISO-8859-1"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <%@taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Insert title here</title>
    </head>
    <body>
         <html:form action="/register">
              Username: <html:text property="userid" /> <br />
              Password: <html:password property="password" /> <br />
              Re-type: <html:password property="password2" />
              <html:submit value="Register" />
         </html:form>
    </body>
    </html>struts-config.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
    <struts-config>
      <form-beans>
           <form-bean name="registrationForm" type="ndlinh.struts.lab.RegistrationForm" />
      </form-beans>
      <action-mappings>
           <action path="/register"
                   type="ndlinh.struts.lab.RegistrationForm"
                   name="registrationForm"
                   validate="false"
                   scope="request"
                   input="registration.jsp" >
                <forward name="success" path="/jsp/success.jsp"  />
                <forward name="failure" path="/jsp/failure.jsp"  />
           </action>
      </action-mappings>
    </struts-config>web.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
    <web-app>
      <servlet>
        <servlet-name>action</servlet-name>
        <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
        <init-param>
          <param-name>config</param-name>
          <param-value>/WEB-INF/struts-config.xml</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
      </servlet>
      <servlet-mapping>
        <servlet-name>action</servlet-name>
        <url-pattern>*.do</url-pattern>
      </servlet-mapping>
    </web-app>System information:
    Tomcat 5.5.20
    Struts 1.3.5
    JDK1.5.08

    struts-config.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
    <struts-config>
      <form-beans>
           <form-bean name="registrationForm" type="ndlinh.struts.lab.RegistrationForm" />
      </form-beans>
      <action-mappings>
           <action path="/register"
                   type="ndlinh.struts.lab.RegistrationAction" // action class
                   name="registrationForm" // form bean name
                   validate="false"
                   scope="request"
                   input="registration.jsp" >
                <forward name="success" path="/jsp/success.jsp"  />
                <forward name="failure" path="/jsp/failure.jsp"  />
           </action>
      </action-mappings>
    </struts-config>HTH

  • What language should i use :C# or java?

    I want to develop an internet game that will allow entering for many users at the same time.And create in dynamic way new rooms.What language wouild you suggest me to use:C# or java?

    The only difference between these two languages is the performance.
    C# is a little bit faster in some fully graphical applications. If your program will use a lot of graphical information and a lot of online graphics updates than you should choose C#.
    Java is easier to develop due to its garbage collector and more pure OO than C#.
    Final: you should choose the language you know more. If you don�t know any of these, than choose JAVA. :^)

  • What is Report Writer in Abap ?

    What is Report Writer in Abap ?
    How we can write a simple report through report writer .
    It's Tcode , How to proceed ?
    I developed several report through ABAP , but i have no clue about Report Writer .
    What is advantage to using it .
    Plz give some Example .
    Regards : rajneesh

    Hi,
       see the help
    http://help.sap.com/saphelp_47x200/helpdata/en/66/bc7dc143c211d182b30000e829fbfe/frameset.htm
    Regards
    Kiran Sure

  • Testing simple JMS application

    I have written a very simple JMS application.
    I am trying to get it to run with the SUN App Server 8. I accepted the default values when installing the server. I have the app server up and running. The following code is suppose to create the Session:
    Context context = new InitialContext();
    ConnectionFactory connectionFactory =
    (ConnectionFactory)context.lookup("ConnectionFactory");
    Connection connection = connectionFactory.createConnection();
    session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
    I ave tried to run this from both the command line and from JBuilder. I have include the J2EE.jar in the classpath. I get the following error.
    javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
    I know that I can set properties for the InitialContext constructor, but is this required? If so, what would the properties be for the default server?

    Looks like you're missing the initial context factory class which is:
    java.naming.factory.initial=com.sun.enterprise.naming.SerialInitContextFactory
    But I believe Sun recommends not settting it directly. You should include appserv-rt.jar in your classpath. That jar file has a file called jndi.properties which specifies the above property I just mentioned. Open it up and take a look for yourself.

  • What language is JAVA written in?

    Hi,
    What language is JAVA written in? Please give me a simple and short answer for my question.
    God Bless,
    Bruce

    Most of the Java Libraries (java.lang.*, java.util.*, etc) and other APIs are written in Java.
    The compiler can be written in Java, but I think that most are probably written in a native language. The compiler turns your .java files into bytecode, which can then be read by ANY JVM, regardless of the platfrom.
    The JVM will always be written in some native language. On Windows systems, that will usually be C/C++, while on IBM mainframes it can vary. The JVM is in a native language because it is what's responsible for "translating" the compiled bytecode into machine language that the platform can understand.
    .java text files are platform-independent.
    .class bytecode files are platform independent.
    Most APIs (except ones that do platfrom specific actions) are platform independent bytecode.
    The JVM is native code, because it is what turns all the platform independent code into something the native platform can read.
    This explanation is awfully general, but it should give you a good idea of how it all works.

  • Simple Webcam Capture to JPG

    I cannot figure this out.
    All I want to do is write a simple program that will take a still capture from my webcam and save it as a JPG. I don't need any kind of GUI or drawing to the screen. I will be using it in a batch script to take a picture and upload to my website at a fixed interval.
    I have been messing around with it for a long time and have had no success. Here is some code I wrote just now that won't work. I have imported things while trying different pieces of code, but I never took any of them out. That's why I import so many things.
    As you can see, I throw the NoPlayerException and CannotRealizeException. I do not understand why I get these. Also, when I run the program the light on my webcam turns on so I know it's connecting at some level. The file saved test.jpg is not a capture but rather a black square. Is my error in getting the image from the webcam or in writing it onto the BufferedImage so I can the write it to the file?
    Any help would be appreciated.
    import javax.swing.*;
    import javax.swing.event.*;
    import java.io.*;
    import javax.media.*;
    import javax.media.format.*;
    import javax.media.util.*;
    import javax.media.control.*;
    import javax.media.protocol.*;
    import java.util.*;
    import java.awt.*;
    import java.awt.image.*;
    import java.awt.event.*;
    import com.sun.image.codec.jpeg.*;
    import javax.imageio.ImageIO;
    public class wc
         public static Player player = null;
         public static CaptureDeviceInfo di = null;
         public static MediaLocator ml = null;
         public static Buffer buf = null;
         public static Image img = null;
         public static BufferToImage btoi = null;
         public static void main(String[] args) throws IOException, NoPlayerException, CannotRealizeException
              String str = "vfw:Microsoft WDM Image Capture (Win32):0";
              di = CaptureDeviceManager.getDevice(str);
              ml = di.getLocator();
              player = Manager.createRealizedPlayer(ml);
              player.start();
              FrameGrabbingControl fgc = (FrameGrabbingControl)
              player.getControl("javax.media.control.FrameGrabbingControl");
              buf = fgc.grabFrame();
              btoi = new BufferToImage((VideoFormat)buf.getFormat());
              img = btoi.createImage(buf);
              BufferedImage bi = new BufferedImage(160, 120, BufferedImage.TYPE_INT_RGB);
              Graphics2D g2 = bi.createGraphics();
              g2.drawImage(img, null, null);
              File f = new File("test.jpg");
              ImageIO.write(bi, "jpg", f);
    }

    I have a question posted about this code, slightly modified in this thread:
    http://forum.java.sun.com/thread.jspa?threadID=5310154&tstart=0
    Would you check it out, I made a new thread because its not strictly related to this post.

  • How to work with EJBs and database for a simple login application

    Hi all :)
    I am new in JSP,EJB and Servlets. I just wanted to develop a simple login application, using JSP+EJBand servlets. In some tutorial I found that the beans are already populatesd with database records. But will it be good logic to retrive all records into a bean and then search for a perticuler users data for authentication.
    Can any one tell me me what is the best logic for doing so. :(
    Thanx in advance.

    Himanshu.Shekhar wrote:
    Hi all :)
    I am new in JSP,EJB and Servlets. I just wanted to develop a simple login application, using JSP+EJBand servlets. In some tutorial I found that the beans are already populatesd with database records. But will it be good logic to retrive all records into a bean and then search for a perticuler users data for authentication.No. Let the database do the search. It's far more efficient.
    %

Maybe you are looking for

  • How can I disable XF86Back / XF86Forward?

    I want to make it so buttons 8 and 9 (the thumb buttons) no longer act as Forward and Back. I found this page: https://wiki.archlinux.org/index.php/Al - ns_Working where I find this bit of information: In most modern applications which use back/forwa

  • SOAP-XI-RFC sync without BPM scenario: How to catch timeout exception in PI

    Hi all I made a scenario where a Webservice request was placed via XI to RFC in CRM. This is all done without BPM. Now the request came up that I have to handle undhandled exceptions from RFC such as Fatal Error, Dump in CRM etc in PI so that custome

  • Browse Documents in Advanced Search iView

    Hi, I am trying to develop a Search Component. I need to include a Browse Document also in the component as in the advanced search. How can we do this? Regards BP

  • View and terminate sessions in CDOT

    Trying to run the following command in CDOT 8.2.2 and getting the error message below NETAPP-01: qos statistics workload characteristics show -refresh-display true Error: command failed: This command is being run in five other sessions, the maximum t

  • Nokia E72 - Set up Hotmail, Gmail and Yahoo accoun...

    I bought my E72 3 days ago and the first impression i got was disappointing. The first action you do when switching on E72 for the first time is to set up your email accounts. Remember, E72 is Nokia's top email phone!!! I chose hotmail. I enter my em