Help Needed - FINAL PROJECT - SAAJ MESSAGING

Hi there!
currently im doing my final project and it involves sending and receiving soap messages.
im working with sun java studio creator for the first time.
i have done this example (excuse me for possible dumb errors im just a noobie):
* Page1.java
* Created on 6 de Novembro de 2006, 12:40
package webapplication1;
import com.sun.rave.web.ui.appbase.AbstractPageBean;
import com.sun.rave.web.ui.component.Body;
import com.sun.rave.web.ui.component.Form;
import com.sun.rave.web.ui.component.Head;
import com.sun.rave.web.ui.component.Html;
import com.sun.rave.web.ui.component.Link;
import com.sun.rave.web.ui.component.Page;
import javax.faces.FacesException;
import com.sun.rave.web.ui.component.Button;
import com.sun.rave.web.ui.component.TextArea;
//soap saaj
import javax.xml.*;
import javax.xml.soap.*;
import java.net.URL;
import java.net.*;
import java.util.*;
import javax.xml.soap.SOAPConnectionFactory;
import javax.xml.soap.SOAPConnection;
import javax.xml.soap.MessageFactory;
import javax.xml.soap.SOAPMessage;
import javax.xml.soap.SOAPPart;
import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPBody;
import javax.xml.soap.SOAPElement;
// add this import if you need soapaction
import javax.xml.soap.MimeHeaders;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.Transformer;
import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamResult;
import com.sun.xml.messaging.saaj.*;
import java.net.URL;
import javax.xml.soap.*;
import java.util.Iterator;
import javax.xml.soap.Name;
import javax.xml.soap.MessageFactory;
import javax.xml.soap.SOAPMessage;
import javax.xml.soap.SOAPBody;
import javax.xml.soap.SOAPPart;
import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPBodyElement;
import javax.xml.messaging.ReqRespListener;
import java.text.NumberFormat;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.Transformer;
import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamResult;
import com.sun.xml.messaging.saaj.*;
* <p>Page bean that corresponds to a similarly named JSP page. This
* class contains component definitions (and initialization code) for
* all components that you have defined on this page, as well as
* lifecycle methods and event handlers where you may add behavior
* to respond to incoming events.</p>
import javax.xml.messaging.JAXMServlet;
//extends JAXMServlet
public class Page1 extends AbstractPageBean implements ReqRespListener{
// <editor-fold defaultstate="collapsed" desc="Creator-managed Component Definition">
private int __placeholder;
* <p>Automatically managed component initialization. <strong>WARNING:</strong>
* This method is automatically generated, so any user-specified code inserted
* here is subject to being replaced.</p>
private void _init() throws Exception {
private Page page1 = new Page();
public Page getPage1() {
return page1;
public void setPage1(Page p) {
this.page1 = p;
private Html html1 = new Html();
public Html getHtml1() {
return html1;
public void setHtml1(Html h) {
this.html1 = h;
private Head head1 = new Head();
public Head getHead1() {
return head1;
public void setHead1(Head h) {
this.head1 = h;
private Link link1 = new Link();
public Link getLink1() {
return link1;
public void setLink1(Link l) {
this.link1 = l;
private Body body1 = new Body();
public Body getBody1() {
return body1;
public void setBody1(Body b) {
this.body1 = b;
private Form form1 = new Form();
public Form getForm1() {
return form1;
public void setForm1(Form f) {
this.form1 = f;
private Button button1 = new Button();
public Button getButton1() {
return button1;
public void setButton1(Button b) {
this.button1 = b;
private TextArea textArea1 = new TextArea();
public TextArea getTextArea1() {
return textArea1;
public void setTextArea1(TextArea ta) {
this.textArea1 = ta;
private TextArea textArea2 = new TextArea();
public TextArea getTextArea2() {
return textArea2;
public void setTextArea2(TextArea ta) {
this.textArea2 = ta;
// </editor-fold>/*
public MessageFactory messageFactSent= null;
public MessageFactory messageFactReply=null;
public MessageFactory messageFactReceiv= null;
public SOAPConnectionFactory soapConnectionFact;
public URL URLendpoint;
public SOAPConnection connection ;
public SOAPMessage messageSent;
public SOAPPart soapPartSent;
public SOAPEnvelope soapEnvelopeSent;
public SOAPBody SoapBodySent;
public SOAPMessage messageReceiv;
public SOAPPart soapPartReceiv;
public SOAPEnvelope soapEnvelopeReceiv;
public SOAPBody SoapBodyReceiv;
public SOAPMessage messageReply;
public SOAPPart soapPartReply;
public SOAPEnvelope soapEnvelopeReply;
public SOAPBody SoapBodyReply;
public SOAPMessage reply;
public String StringAux="";
public final String theURI = "http://172.16.5.223:8080/WebApplication1/";
//public final String theURI = "http://172.16.5.223:8080/WebApplication1/";
//public final String theURI = "http://172.16.5.193:8080/WebApplication1/";
//http://localhost:8080/WebApplication1/faces/Page1.jsp
public SOAPMessage onMessage(SOAPMessage message) {
StringAux=StringAux+"On message called in receiving servlet\n";
this.textArea1.setValue(StringAux);
try {
soapPartReceiv = message.getSOAPPart( );
soapEnvelopeReceiv = soapPartReceiv.getEnvelope();
SoapBodyReceiv = soapEnvelopeReceiv.getBody();
//analise...if needed
// Create the reply message
messageReply = messageFactReply.createMessage();
soapEnvelopeReply = messageReply.getSOAPPart().getEnvelope();
SoapBodyReply= soapEnvelopeReply.getBody();
// Remove empty header from the Envelope
soapEnvelopeReply.getHeader().detachNode();
Name bodyName = soapEnvelopeReply.createName("GetLastTradePrice",
"m", "http://wombat.ztrade.com");
SOAPBodyElement gltp = SoapBodyReply.addBodyElement(bodyName);
Name name = soapEnvelopeReply.createName("symbol");
SOAPElement symbol = gltp.addChildElement(name);
symbol.addTextNode("SUNW");
// Return a reply message back to the JAXM client
StringAux=StringAux+"devolveu menssagem\n";
this.textArea1.setValue(StringAux);
return messageReply ;
} catch(Exception e) {
StringAux=StringAux+"Error in processi ng or replying to a message - e: " + e+"\n";
this.textArea1.setValue(StringAux);
return null;
//this.getBean(name)
public Page1() {
// Service serve=new Service();
// Client cli=new Client();
// this.textArea1.setValue(serve.GetAux());
// this.textArea2.setValue(cli.GetAux());
// Create a MessageFactory
try {
URLendpoint=new URL(theURI);
StringAux=StringAux+"depois de criar o endpoint \n";
//Create SOAP connection
soapConnectionFact = SOAPConnectionFactory.newInstance();
connection = soapConnectionFact.createConnection();
// Create a message from the message factory.
messageFactSent = MessageFactory.newInstance();
messageFactReply = MessageFactory.newInstance();
messageFactReceiv = MessageFactory.newInstance();
StringAux=StringAux+"depois de criar as message factory \n";
this.textArea1.setValue(StringAux);
} catch(Throwable e) {
StringAux="erro2!\n"+StringAux+e.toString()+"\n";
this.textArea1.setValue(StringAux);
* <p>Return a reference to the scoped data bean.</p>
protected ApplicationBean1 getApplicationBean1() {
return (ApplicationBean1)getBean("ApplicationBean1");
* <p>Return a reference to the scoped data bean.</p>
protected RequestBean1 getRequestBean1() {
return (RequestBean1)getBean("RequestBean1");
* <p>Return a reference to the scoped data bean.</p>
protected SessionBean1 getSessionBean1() {
return (SessionBean1)getBean("SessionBean1");
* <p>Callback method that is called whenever a page is navigated to,
* either directly via a URL, or indirectly via page navigation.
* Customize this method to acquire resources that will be needed
* for event handlers and lifecycle methods, whether or not this
* page is performing post back processing.</p>
* <p>Note that, if the current request is a postback, the property
* values of the components do <strong>not</strong> represent any
* values submitted with this request. Instead, they represent the
* property values that were saved for this view when it was rendered.</p>
public void init() {
// Perform initializations inherited from our superclass
super.init();
// Perform application initialization that must complete
// before managed components are initialized
// TODO - add your own initialiation code here
// <editor-fold defaultstate="collapsed" desc="Creator-managed Component Initialization">
// Initialize automatically managed components
// Note - this logic should NOT be modified
try {
_init();
} catch (Exception e) {
log("Page1 Initialization Failure", e);
throw e instanceof FacesException ? (FacesException) e: new FacesException(e);
// </editor-fold>
// Perform application initialization that must complete
// after managed components are initialized
// TODO - add your own initialization code here
* <p>Callback method that is called after the component tree has been
* restored, but before any event processing takes place. This method
* will <strong>only</strong> be called on a postback request that
* is processing a form submit. Customize this method to allocate
* resources that will be required in your event handlers.</p>
public void preprocess() {
* <p>Callback method that is called just before rendering takes place.
* This method will <strong>only</strong> be called for the page that
* will actually be rendered (and not, for example, on a page that
* handled a postback and then navigated to a different page). Customize
* this method to allocate resources that will be required for rendering
* this page.</p>
public void prerender() {
* <p>Callback method that is called after rendering is completed for
* this request, if <code>init()</code> was called (regardless of whether
* or not this was the page that was actually rendered). Customize this
* method to release resources acquired in the <code>init()</code>,
* <code>preprocess()</code>, or <code>prerender()</code> methods (or
* acquired during execution of an event handler).</p>
public void destroy() {
public String button1_action() {
try {
StringAux=StringAux+"antes de criar a messagem para enviar\n";
messageSent = messageFactSent.createMessage();
soapEnvelopeSent = messageSent.getSOAPPart().getEnvelope();
//SoapBodySent = messageSent.getSOAPPart().getEnvelope().getBody();
SoapBodySent = soapEnvelopeSent.getBody();
Name bodyName = soapEnvelopeSent .createName("GetLastTradePrice",
"m", "http://wombat.ztrade.com");
SOAPBodyElement gltp = SoapBodySent.addBodyElement(bodyName);
Name name = soapEnvelopeSent.createName("symbol");
SOAPElement symbol = gltp.addChildElement(name);
symbol.addTextNode("SUNW");
StringAux=StringAux+"\nContent of the message: \n"+messageSent.toString()+"\n";
// Send the SOAP message and get reply
StringAux=StringAux+"Sending message to URL: \n"+ URLendpoint+"\n"+this.URLendpoint.getPath()+"\n";
reply = connection.call(messageSent,URLendpoint);
StringAux=StringAux+"\n\n Content of the reply message: \n"+reply.toString()+"\n";
this.textArea1.setValue(StringAux);
//tratamento da resposta
connection.close();
} catch(Throwable e) {
StringAux="erro!\n"+StringAux+e.toString()+"\n";
this.textArea1.setValue(StringAux);
return null;
Very simple , on a click of the button a message was supost to be sent. and receive on the other machine. i have launched the same war file on both pcs
but now nothing happens just a exception message
com.sun.xml.messaging.saaj.SOAPExceptionImpl: java.security.PrivilegedActionException: com.sun.xml.messaging.saaj.SOAPExceptionImpl: Invalid Content-Type:text/html. Is this an error message instead of a SOAP
....could someone help me out here ,even share a wprking project with this goal
thank you in advance
DMS
Message was edited by:
DaniDaOne

One time, after quitting IM and re-launching it later, my project disappeared from the project list.
Apple Support told me to do this.
1) quit IM
2) with the finder, move the project out of the project directory
3) launch IM
4) quit IM
5) with the finder, put the project back into the project directory
6) launch IM
My project re-appeared. He said these steps forces a project index to be rebuilt.
Your symptoms are different but maybe the cure is the same --- good luck.

Similar Messages

  • Help needed, M getting this message sandbox environment error no test user account, when downloading any application from iTunes, friend told me to sign out and sign in iTunes it might solve the problem but instead I cannot login I to my itune account.

    Help needed,
    I am getting this message sandbox environment error no test user account, when downloading any application from iTunes, friend told me to sign out and sign in iTunes it might solve the problem , and i triyed it but still  I cannot login I to my itune account. Same message keeping. Popping up,  this problem started supricly today.

    Take a look at the instructions here.
    http://www.technogal.net/2012/03/this-is-not-test-user-account-please.html

  • JMS Configuration Help Needed for Publish Subscribe Messaging

    Hi,
    I am new to JMS and need help to configure JMS from the sun admin console. As of now i have configured the topic and the connection factory from the JMS Resources under the Resources tab(here too i just specified the topic name and guest and password and jndi and similarly the connection factory name but have not specified any port or anything else), but i guess something is missing as i can publish but cannot subscribe nor can i view the messages on the topic..I think some sort of configuration is also need on the Java Message Service header under the Configuration tab.I have searched for this on the net but have not been able to find any sort of detailed help.If someone could give a detailed picture as too how to go about this configuration with an example it would be of great help.
    Vaishali Shah

    Sai,
    Seen this:
    http://tinyurl.com/pbshe
    Good Luck,
    Avi.

  • Help needed recovering project files from trash

    Hi everyone, I am hoping that someone will be able to help me. I just did something stupid!
    I created two new projects in iMovie this morning and then needed to clear out the mac in order to speed up a clip as I was getting the warning that my disk was full. So I copied a lot of files from iPhoto onto a hard drive and then moved them to trash including the raw files that I was using for these projects. (I got a bit carried away!) Yes the video files were in iPhoto and not iMovie Events as the last time I uploaded files iMovie was not playing the game.
    The files are still on the mac as I have not emptied the trash and they are also backed up on an external drive connected to the mac, but I have emptied the iPhoto trash. I tried importing the files back into iPhoto from trash and only got so far before the disk full message came up again. But even those ones that I did manage to re import are not showing up.
    Is there any way that I can continue with these projects or have I effectively ruined them? Do I need to start again from scratch? I hope not as they took me hours and hours to create and had pretty much finished them.
    Any help will be greatly appreciated. Thanks. :-)

    http://pondini.org/TM/17.html
    To see these "other" backups, you need the Browse Other Backup Disks or (Browse Other Time Machine Disks on Snow Leopard or Leopard) option.  It's available by Alt/Option-clicking the Time Machine icon in your Menubar, or by control-clicking (right-clicking) the Time Machine icon in your Dock.

  • Help needed for Project Work

    +People..I am new to this forum and your help is absolutely essential as it for my project work. There are two questions in my project. This is the second one. The first question is at the following thread.
    http://forum.java.sun.com/thread.jspa?threadID=5220057
    Thanks in advance..+*
    This is the Question
    Create a class ToyCollection that stores information about different toys in a toy shop.  The information to be stored about a single toy is,
    -         Toy identification as String
    -         Name of the toy as String
    -         Short description about the toy as a String
    -         Price of the toy as float
    -         Quantity of the toy in hand as short integer.
    This class contains following methods,
    -         Constructor method that assigns user input values to above mentioned variables.
    -         main ( ) method that creates array of 4 objects of ToyCollection class and that takes input for all above details from the user and
    calls method to check validity of Quantity and Price values. If all values are valid then create the objects and display the details
    for all 4 toys.
    -         Method that checks validity of quantity and price. If the quantity is 0 or negative then method should throw user defined
    exception with appropriate message and come out of program. Similarly if the price is 0 or negative then it should throw user defined exception with appropriate message and come out of program.
    -         Method that displays all details about a single toy in the following format, e.g. Here Total price should be calculated.
    Toy Identification                  :  S-1
    Toy Name                            :  Small Scooter
    Toy Description                    :  Ordinary 3 wheeler scooter
    Toy price                              :   650.50
    Quantity in hand                    :   3
    Total price of Toys               :    1951.50
    And i did the following coding
    import java.io.*;
    import java.lang.*;
    public class ToyCollection
         public int toyid;
         public String toyname;
         public String toydetails;
         public float toyprice;
         public int toyquantity;
         public void setToyid(int tid)
              toyid = tid;
         public void setToyname(String tname)
              toyname = tname;
         public void setToydetails(String tdet)     
              toydetails = tdet;
         public void setToyprice(float tpri)
              toyprice = tpri;
         public void setToyquantity(int tquan)
              toyquantity = tquan;
         public int getToyid()
              return toyid;
         public String getToyname()
              return toyname;
         public String getToydetails()     
              return toydetails;
         public float getToyprice()
              return toyprice;
         public int getToyquantity()
              return toyquantity;
         public static void main(String args[])throws Exception
              ToyCollection a=new ToyCollection();
              System.out.println("Enter the Toy id");
              BufferedReader br1=new BufferedReader(new InputStreamReader(System.in));
              int tid=Integer.parseInt(br1.readLine());
              a.setToyid(tid);
              System.out.println("Enter the Toy name");
              BufferedReader br2=new BufferedReader(new InputStreamReader(System.in));
              String tname=br2.readLine();
              a.setToyname(tname);
              System.out.println("Enter the Toy details");
              BufferedReader br3=new BufferedReader(new InputStreamReader(System.in));
              String tdet=br3.readLine();
              a.setToydetails(tdet);
              System.out.println("Enter the Toy price");
              BufferedReader br4=new BufferedReader(new InputStreamReader(System.in));
              float tpri=Float.parseFloat(br4.readLine());
              a.setToyprice(tpri);
              System.out.println("Enter the Toy quantity");
              BufferedReader br5=new BufferedReader(new InputStreamReader(System.in));
              int tquan=Integer.parseInt(br5.readLine());
              a.setToyquantity(tquan);
              System.out.println("The Toy Attributed you entered are displayed below \n" + " ID :" + a.getToyid() + "\n " +" Name :" + a.getToyname() + "\n " + " Details :" + a.getToydetails() + "\n " + " Price :" + a.getToyprice() + "\n " + " Quantity :" + a.getToyquantity());
    I submitted the above coding and this was the response from the evaluator
    *"You need to create array of toys. You are accepting details of toy in a single line and your program ends."*
    Eagerly awaiting your reply at the earliest people.

    DrLaszloJamf , here is the question.
    Create a class ToyCollection that stores information about different toys in a toy shop. The information to be stored about a single toy is,
    - Toy identification as String
    - Name of the toy as String
    - Short description about the toy as a String
    - Price of the toy as float
    - Quantity of the toy in hand as short integer.
    This class contains following methods,
    - Constructor method that assigns user input values to above mentioned variables.
    - main ( ) method that creates array of 4 objects of ToyCollection class and that takes input for all above details from the user and
    calls method to check validity of Quantity and Price values. If all values are valid then create the objects and display the details
    for all 4 toys.
    - Method that checks validity of quantity and price. If the quantity is 0 or negative then method should throw user defined
    exception with appropriate message and come out of program. Similarly if the price is 0 or negative then it should throw user defined exception with appropriate message and come out of program.
    - Method that displays all details about a single toy in the following format, e.g. Here Total price should be calculated.
    Toy Identification : S-1
    Toy Name : Small Scooter
    Toy Description : Ordinary 3 wheeler scooter
    Toy price : 650.50
    Quantity in hand : 3
    Total price of Toys : 1951.50
    What is the java code for the above ?

  • Help needed ASAP -- Project file won't open

    Stuck in Africa right now (can't call telephone support).
    I am volunteering on a medical/dental trip and am in charge of the final nights video.
    Here is the problem.
    I am almost done with the video (15 minutes long -- full HD) and suddenly the when I click on the project from the project library it won't open.
    all the other projects open fine. Just this one project won't.
    when I click on it, the project library slides to the side, but behind it is another project library, but when I mouse over it plays the movie, but it is un-editable in this state.
    It was working great until this dreadful moment....
    I saw another post about deleting the thumbnails for an EVENT that was having problems. Can this be done with a PROJECT file?
    The big movie presentation/trip is in 12 hours....
    Can anyone help me???

    One time, after quitting IM and re-launching it later, my project disappeared from the project list.
    Apple Support told me to do this.
    1) quit IM
    2) with the finder, move the project out of the project directory
    3) launch IM
    4) quit IM
    5) with the finder, put the project back into the project directory
    6) launch IM
    My project re-appeared. He said these steps forces a project index to be rebuilt.
    Your symptoms are different but maybe the cure is the same --- good luck.

  • Help needed Regarding Project Server - 2013 Workflow

    Hi All,
    I am new to Project server 2013 Workflow, hence please help me regarding this. Pardon me if this question is too trivial. 
    I have created a project type associated with a workflow and my workflow is as follows :
    So I am not doing anything here, I am just testing the workflow as mentioned by technet site : http://technet.microsoft.com/en-us/library/dn458865(v=office.15).aspx
    But it is mentioned that, after a minute or 2, the workflow state will change, also they have mentioned to press the Submit button.
    But in my case, the workflow is not moving to next stage [It just says 'The workflow is still processing - which never changes after hours] or I am getting the submit button (Submit button is disabled on the ribbon). Below is the state of my workflow :
    PS : I have made the user added to Portfolio managers group as well. But still I am having this same issue. 
    The Workflow manager is installed properly, and it is working fine in case of List workflow. I am facing the issue only wrt Site workflow for Project server 2013.
    Please help me to solve this issue.
    Thanks,
    shanky

    Hi Kiran,
    I am now facing issue while assigning a task to a person in the workflow.
    I am having a person named say 'John' , who is included in Project Manager as well as Portfolio Manager.
    And I am using a workflow as :
    Stage : Conceptual
    Assign a task to John (Task outcome to Variable: Outcome5 | Task ID to Variable: TaskID3 )
    Transition to stage
    Go to Approval
    But this is again giving issue as :
    Workflow Internal status : Cancelled
    Details: System.ApplicationException: HTTP 401 {"error":{"code":"-2147024891, System.UnauthorizedAccessException","message":{"lang":"en-US","value":"Access denied. You do not have
    permission to perform this action or access this resource."}}}
    PS : I have used the same Sharepoint admin account for 'Account Name' in ‘User Profile Sync' , Is this causing the issue? Please let me know.
    Thanks,
    Shanky

  • Help needed with project

    Hello everyone. Some help would be appreciated. I have created a wildlife resort database with access.
    It has an animals table with 5 entries, a species table with 3 entries and a user table with 3 entries.
    I have set up a JDBC-ODBC bridge.
    The server side of this application when run gets stuck upon pressing connect the first time so I have to run the server again while the first server window is running in the background and press connect for it to start running. The server works just fine after that. I can add and remove from the tables using the server.
    When I run the client and try to connect it, it doesn't accept the hostname. I can't connect or log in.
    I think the problem is with the threads but I'm not sure what to do to fix it.
    Also I use java beans for coding.
    These are some errors I get when running the client:
    java.lang.IllegalThreadStateException
    at java.lang.ThreadGroup.add(ThreadGroup.java:856)
    at java.lang.Thread.start(Thread.java:573)
    at org.apache.tools.ant.taskdefs.ProcessDestroyer.removeShutdownHook(ProcessDestroyer.java:145)
    at org.apache.tools.ant.taskdefs.ProcessDestroyer.remove(ProcessDestroyer.java:198)
    at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:487)
    at org.apache.tools.ant.taskdefs.Java.fork(Java.java:746)
    at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:170)
    at org.apache.tools.ant.taskdefs.Java.execute(Java.java:83)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
    at org.apache.tools.ant.Task.perform(Task.java:364)
    at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:64)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
    at org.apache.tools.ant.Task.perform(Task.java:364)
    at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:377)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
    at org.apache.tools.ant.Task.perform(Task.java:364)
    at org.apache.tools.ant.Target.execute(Target.java:341)
    at org.apache.tools.ant.Target.performTasks(Target.java:369)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1214)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1062)
    at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:217)
    at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:236)
    at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:125)
    Exception in thread "Thread-7" java.lang.NullPointerException
    at Client.Connect.connecting(Connect.java:45)
    at Client.ClientGUI.run(ClientGUI.java:214)
    at java.lang.Thread.run(Thread.java:595)
    Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    at Client.Connect.userPass(Connect.java:206)
    at Client.ClientGUI.actionPerformed(ClientGUI.java:164)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
    at javax.swing.AbstractButton.doClick(AbstractButton.java:302)
    at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1000)
    at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1041)
    at java.awt.Component.processMouseEvent(Component.java:5488)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3093)
    at java.awt.Component.processEvent(Component.java:5253)
    at java.awt.Container.processEvent(Container.java:1966)
    at java.awt.Component.dispatchEventImpl(Component.java:3955)
    at java.awt.Container.dispatchEventImpl(Container.java:2024)
    at java.awt.Component.dispatchEvent(Component.java:3803)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
    at java.awt.Container.dispatchEventImpl(Container.java:2010)
    at java.awt.Window.dispatchEventImpl(Window.java:1766)
    at java.awt.Component.dispatchEvent(Component.java:3803)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:234)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
    These are the classes I have created:
    On the client side:
    //imports needed for the GUI and I/O Operations
    import java.awt.event.*;
    import java.awt.*;
    import javax.swing.*;
    import java.io.*;
    public class ClientGUI extends JFrame implements ActionListener, Runnable {
    JPanel pane = new JPanel();
    //Create the Menubar Items
    JMenuBar bar = new JMenuBar();
    JMenu jMenu1 = new JMenu();
    JMenu jMenu2 = new JMenu();
    JMenu jMenu3 = new JMenu();
    JMenuItem Exit = new JMenuItem();
    JMenuItem Open = new JMenuItem();
    JMenuItem Close = new JMenuItem();
    JMenuItem Find = new JMenuItem();
    static JMenuItem Add = new JMenuItem();
    static JMenuItem Remove = new JMenuItem();
    static JMenuItem Connect1 = new JMenuItem();
    static JMenuItem Disconnect = new JMenuItem();
    static JMenuItem Login = new JMenuItem();
    static JMenuItem Logout = new JMenuItem();
    static boolean check = true;
    static JLabel running = new JLabel("You are not Connected");
    //Creates the animal JTable and adds it to a scrollpane
    public static String[] animalH = {"Id" , "Name" , "Description" , "Species Id"};
    public static Object rows1 [] [] = new Object[40][4];
    public static JTable animal = new JTable(rows1 , animalH);
    JScrollPane animalP;
    //Creates the species JTable and adds it to a scrollpane
    public static String[] speciesH = {"Species Id" , "Species Name"};
    public static Object rows2 [] [] = new Object[40][2];
    public static JTable species = new JTable(rows2 , speciesH);
    JScrollPane speciesP;
    public static Thread runner;
    //Declares Globale variables
    static int currentT;
    int respones;
    static String hostname;
    static boolean connected = false;
    /** Creates a new instance of ClientGUI */
    public ClientGUI() {
    super("SA Wildlife -- Client");
    setSize(800 , 600);
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    getContentPane().add(running , BorderLayout.SOUTH);
    Add.setEnabled(false);
    Remove.setEnabled(false);
    Logout.setEnabled(false);
    Disconnect.setEnabled(false);
    try {
    jbInit();
    }catch(Exception e) {
    e.printStackTrace();
    addListener();
    setJMenuBar(bar);
    setVisible(true);
    //Add the actionListeners to the components
    public void addListener(){
    Open.addActionListener(this);
    Close.addActionListener(this);
    Exit.addActionListener(this);
    Connect1.addActionListener(this);
    Disconnect.addActionListener(this);
    Find.addActionListener(this);
    Login.addActionListener(this);
    Logout.addActionListener(this);
    Add.addActionListener(this);
    Remove.addActionListener(this);
    //Add the actions which the components must perform
    public void actionPerformed(ActionEvent evt){
    Object s = evt.getSource();
    if (s == Open){
    choice();
    Close();
    if (respones == 0){
    currentT = 1;
    clearTableAnimals();
    Connect.allAnimal();
    animal = new JTable(rows1, animalH);
    animalP = new JScrollPane(animal);
    getContentPane().add(animalP, BorderLayout.CENTER);
    setVisible(true);
    }else if (respones == 1 ){
    currentT = 2;
    clearTableSpecies();
    Connect.allSpecies();
    species = new JTable(rows2 , speciesH);
    speciesP = new JScrollPane(species);
    getContentPane().add(speciesP, BorderLayout.CENTER);
    setVisible(true);
    }else if (s == Close){
    Close();
    }else if (s == Exit){
    exit();
    }else if (s == Connect1){
    hostname = JOptionPane.showInputDialog(null , "Please enter Hostname");
    if (check = true){
    runner = new Thread(this);
    runner.start();
    Connect1.setEnabled(false);
    Disconnect.setEnabled(true);
    }else if (s == Disconnect){
    Connect.out.println("Bye");
    runner = null;
    try {
    Connect.out.close();
    Connect.in.close();
    Connect.clientSocket.close();
    } catch (IOException ioe) {
    JOptionPane.showMessageDialog(null,
    "Error " + ioe.toString(),
    "IO Exception",
    JOptionPane.ERROR_MESSAGE);
    System.exit(0);
    }else if (s == Find){
    choice();
    Close();
    if (respones == 0){
    currentT = 1;
    String Aname = JOptionPane.showInputDialog(null , "Enter Animal name to find ");
    clearTableAnimals();
    Connect.findAnimal(Aname);
    animal = new JTable(rows1, animalH);
    animalP = new JScrollPane(animal);
    getContentPane().add(animalP, BorderLayout.CENTER);
    setVisible(true);
    }else{
    currentT = 2;
    String Sname = JOptionPane.showInputDialog(null , "Enter Species name to find ");
    clearTableSpecies();
    Connect.findSpecies(Sname);
    species = new JTable(rows2 , speciesH);
    speciesP = new JScrollPane(species);
    getContentPane().add(speciesP, BorderLayout.CENTER);
    setVisible(true);
    }else if( s== Login){
    String name = JOptionPane.showInputDialog(null , "Please enter a UserName");
    String password = JOptionPane.showInputDialog(null , "Please enter a Password");
    Connect.userPass(name , password);
    }else if (s == Logout){
    Logout();
    }else if (s== Add){
    choice();
    Close();
    if(respones == 0){
    currentT = 1;
    String id = JOptionPane.showInputDialog(null , "Enter an Animal id");
    String name = JOptionPane.showInputDialog(null , "Enter an Animal Name");
    String desc = JOptionPane.showInputDialog(null , "Enter an Animal Description");
    String speciesid = JOptionPane.showInputDialog(null , "Enter an Animal species id");
    clearTableAnimals();
    Connect.toAddAnimal(id , name , desc , speciesid);
    Connect.allAnimal();
    animal = new JTable(rows1, animalH);
    animalP = new JScrollPane(animal);
    getContentPane().add(animalP, BorderLayout.CENTER);
    setVisible(true);
    }else{
    currentT = 2;
    String id = JOptionPane.showInputDialog(null , "Enter a Species id");
    String name = JOptionPane.showInputDialog(null , "Enter a Species name");
    clearTableSpecies();
    Connect.toAddSpecies(id , name);
    Connect.allSpecies();
    species = new JTable(rows2 , speciesH);
    speciesP = new JScrollPane(species);
    getContentPane().add(speciesP, BorderLayout.CENTER);
    setVisible(true);
    }else if (s == Remove){
    choice();
    Close();
    if(respones == 0){
    currentT = 1;
    String id = JOptionPane.showInputDialog(null , "Enter an Animal id to Remove");
    Connect.toRemoveAnimal(id);
    }else{
    currentT = 2;
    String id = JOptionPane.showInputDialog(null , "Enter a Species id to Remove");
    Connect.toRemoveSpecies(id);
    public void run() {
    Connect connect = new Connect();
    while (runner != null) {
    try {
    connect.connecting();
    catch (IOException ioe) {
    System.out.println("Error: " + ioe);
    ClientGUI.running.setText("You are now connected");
    //Method the creates the dialog box for the user to choose what he wants to do
    void exit(){
    String [] option = { "Exit" , "Minimize" , "Cancel" };
    int which = JOptionPane.showOptionDialog(null , "Sure you want to exit"
    , "Exiting" , 0 , JOptionPane.WARNING_MESSAGE ,
    null , option , option[2] );
    if (which == 0){
    System.exit(1);
    }else if (which == 1){
    setState(JFrame.ICONIFIED);
    }else{}
    //Closes the current table on the panel
    public void Close(){
    if(currentT == 1){
    animalP.setVisible(false);
    }else if (currentT == 2){
    speciesP.setVisible(false);
    }else{}
    //Method that give the user a choice on which table to perform actions on
    public void choice(){
    String[] choices = {"Animals" , "Species"};
    respones = JOptionPane.showOptionDialog(null ,
    "Please select Table" , "Table" , 0 , JOptionPane.INFORMATION_MESSAGE ,
    null , choices , choices[1] );
    //Clears the Species table
    public void clearTableSpecies(){
    for (int i = 0; i < 40; i++){
    rows2[0] = "";
    rows2[i][1] = "";
    //Clears the Animal table
    public void clearTableAnimals(){
    for (int i = 0; i < 40; i++){
    rows1[i][0] = "";
    rows1[i][1] = "";
    rows1[i][2] = "";
    rows1[i][3] = "";
    //Method for the Logout button
    public void Logout(){
    JOptionPane.showMessageDialog(null , "You are now logged out ");
    Login.setEnabled(true);
    Add.setEnabled(false);
    Remove.setEnabled(false);
    Logout.setEnabled(false);
    //Main Methof
    public static void main(String[] args) {
    ClientGUI GUI1 = new ClientGUI();
    // Adds all components to the panel
    private void jbInit() throws Exception {
    jMenu1.setText("File");
    Exit.setText("Exit");
    jMenu2.setText("Table Action");
    Open.setText("Open Table");
    Add.setText("Add to Table");
    Remove.setText("Remove from Table");
    Find.setText("Find In table");
    Close.setText("Close Current");
    jMenu3.setText("Client");
    Connect1.setText("Connect");
    Disconnect.setText("Disconnect");
    Login.setText("Login");
    Logout.setText("Logout");
    bar.add(jMenu1);
    bar.add(jMenu2);
    bar.add(jMenu3);
    jMenu1.add(Exit);
    jMenu2.add(Open);
    jMenu2.add(Add);
    jMenu2.add(Remove);
    jMenu2.add(Find);
    jMenu2.add(Close);
    jMenu3.add(Connect1);
    jMenu3.add(Disconnect);
    jMenu3.add(Login);
    jMenu3.add(Logout);
    package Client;
    import java.io.*;
    import java.net.*;
    import javax.swing.*;
    import java.util.*;
    public class Connect {
    static public Socket clientSocket = null;
    static public PrintWriter out = null;
    static public BufferedReader in = null;
    public void connecting() throws IOException {
    try{
    clientSocket = new Socket(ClientGUI.hostname , 1234);
    out = new PrintWriter(clientSocket.getOutputStream() , true);
    in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
    }catch (UnknownHostException e){
    JOptionPane.showMessageDialog(null , "Dont know about host");
    ClientGUI.check = false;
    ClientGUI.Connect1.setEnabled(true);
    ClientGUI.Disconnect.setEnabled(false);
    ClientGUI.runner = null;
    }catch(IOException i){
    ClientGUI.check = false;
    JOptionPane.showMessageDialog(null,"Couldnt get i/O for the connection to 127.0.0.0.1");
    ClientGUI.Connect1.setEnabled(true);
    ClientGUI.Disconnect.setEnabled(false);
    ClientGUI.runner = null;
    if (ClientGUI.check = true){
    String fromServer;
    StringTokenizer token1;
    String First;
    String Second;
    String Third;
    while ( (fromServer = in.readLine()) != null) {
    System.out.println("From SerVer ---------------> " + fromServer);
    token1 = new StringTokenizer(fromServer, "%");
    StringTokenizer token2;
    StringTokenizer token3;
    First = token1.nextToken();
    System.out.println("First ------- > " + First);
    if (First.equalsIgnoreCase("SelectedAnimal")) {
    System.out.println("IT's ON ");
    Second = token1.nextToken();
    System.out.println("Second ----> " + Second);
    int y = 0;
    int x = 0;
    System.out.println("In the 1while");
    token2 = new StringTokenizer(Second, "$");
    while (token2.hasMoreTokens()) {
    System.out.println("In the 2while");
    token3 = new StringTokenizer(token2.nextToken(), "@");
    x = 0;
    while (token3.hasMoreTokens()) {
    ClientGUI.rows1[y][x] = token3.nextToken();
    x++;
    y++;
    else if (First.equalsIgnoreCase("SelectedSpecies")) {
    System.out.println("IT's ON BITCH ");
    Second = token1.nextToken();
    System.out.println("Second ----> " + Second);
    int y = 0;
    int x = 0;
    System.out.println("In die 1while");
    token2 = new StringTokenizer(Second, "$");
    while (token2.hasMoreTokens()) {
    System.out.println("In die 2while");
    token3 = new StringTokenizer(token2.nextToken(), "@");
    x = 0;
    while (token3.hasMoreTokens()) {
    ClientGUI.rows2[y][x] = token3.nextToken();
    x++;
    y++;
    else if (First.equalsIgnoreCase("FoundAnimal")) {
    Second = token1.nextToken();
    if (! (Second.equalsIgnoreCase("NONE"))) {
    System.out.println("Second ----> " + Second);
    int y = 0;
    int x = 0;
    System.out.println("In the 1while");
    token2 = new StringTokenizer(Second, "$");
    while (token2.hasMoreTokens()) {
    System.out.println("In the 2while");
    token3 = new StringTokenizer(token2.nextToken(), "#@#");
    x = 0;
    while (token3.hasMoreTokens()) {
    ClientGUI.rows1[y][x] = token3.nextToken();
    x++;
    y++;
    else {
    JOptionPane.showMessageDialog(null,
    "Could not find Animal , Please try again");
    else if (First.equalsIgnoreCase("FoundSpecies")) {
    Second = token1.nextToken();
    if (! (Second.equalsIgnoreCase("NONE"))) {
    System.out.println("Second ----> " + Second);
    int y = 0;
    int x = 0;
    System.out.println("In die 1while");
    token2 = new StringTokenizer(Second, "$");
    while (token2.hasMoreTokens()) {
    System.out.println("In die 2while");
    token3 = new StringTokenizer(token2.nextToken(), "#@#");
    x = 0;
    while (token3.hasMoreTokens()) {
    ClientGUI.rows2[y][x] = token3.nextToken();
    x++;
    y++;
    else {
    JOptionPane.showMessageDialog(null,
    "Could not find Species , Please try again");
    else if (First.equalsIgnoreCase("FoundUser")) {
    System.out.println("From Server --- > " + First);
    String login = token1.nextToken();
    System.out.println("Find true or false ---- > " + login);
    if (login.equalsIgnoreCase("isUser")) {
    JOptionPane.showMessageDialog(null, "You are now logged in");
    ClientGUI.Add.setEnabled(true);
    ClientGUI.Remove.setEnabled(true);
    ClientGUI.Logout.setEnabled(true);
    ClientGUI.Login.setEnabled(false);
    else {
    JOptionPane.showMessageDialog(null,
    "Invalid Username or Password, Please try again");
    else if (First.equalsIgnoreCase("RecordAddedA")) {
    JOptionPane.showMessageDialog(null, "Record Added");
    else if (First.equalsIgnoreCase("RecordAddedS")) {
    JOptionPane.showMessageDialog(null, "Record Added");
    else if (First.equalsIgnoreCase("SQLE")) {
    System.out.println("ERROR SQL ERROR");
    else if (First.equalsIgnoreCase("Blah1")) {
    System.out.println("ERROR Ander ERROR");
    else if (First.equalsIgnoreCase("AnimalRemoved")) {
    JOptionPane.showMessageDialog(null, "Record Removed");
    else if (First.equalsIgnoreCase("SpeciesRemoved")) {
    JOptionPane.showMessageDialog(null, "Record Removed");
    }else{
    System.out.println("BLAAAAAAAAH");
    static public void Close() throws IOException{
    out.println("bye");
    ClientGUI.runner = null;
    ClientGUI.Disconnect.setEnabled(false);
    ClientGUI.Connect1.setEnabled(true);
    out.close();
    in.close();
    clientSocket.close();
    static public void allAnimal(){
    out.println("SELECTANIMALS");
    static public void allSpecies(){
    out.println("SELECTSPECIES");
    static public void findAnimal(String name){
    out.println("FINDANIMAL" + "@" + name);
    static public void findSpecies(String name){
    out.println("FINDSPECIES@" + name);
    static public void userPass(String name , String password){
    System.out.println("FINDUSER -----> " + name + " " + password);
    out.println("FINDUSER@" + name + "@" + password);
    static public void toAddAnimal(String id , String name , String desc , String species){
    out.println("toAddAnimal@" + id +"@" + name +"@" + desc +"@" + species );
    static public void toAddSpecies(String id , String name){
    out.println("toAddSpecies@" + id +"@" + name );
    static public void toRemoveAnimal(String id){
    out.println("toRemoveAnimal@" + id);
    static public void toRemoveSpecies(String id){
    out.println("toRemoveSpecies@" + id);
    On the server side:
    package Server;
    ////import everything necesary for the Database Connection
    import java.sql.*;
    import java.util.StringTokenizer;
    import javax.swing.*;
    import java.util.*;
    public class DatabaseConnect {
    //Declaration of Globale variables
    static int hoeveel = 0;
    static ResultSet rec ;
    static String bidData[] = new String[100];
    static String toSend[] = new String[100];
    //Connects the program to the database
    public DatabaseConnect() {
    try{
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    String source = "jdbc:odbc:Database";
    Connection dbconnect = DriverManager.getConnection(source);
    Statement st = dbconnect.createStatement();
    }catch(ClassNotFoundException cnf){
    System.out.println("classNotFound" + cnf);
    }catch(SQLException se) {
    System.out.println("SqlExeption" + se);
    //Selects the data from the databas and adds the data to the tables
    public void open(){
    try{
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    String source = "jdbc:odbc:Database";
    Connection dbconnect = DriverManager.getConnection(source);
    Statement st = dbconnect.createStatement();
    if (ServerGUI.currentT == 1){
    hoeveel = 0;
    rec = st.executeQuery("SELECT * FROM ANIMALS");
    while (rec.next()) {
    bidData[hoeveel++] = rec.getString(1) + "@#@" +
    rec.getString(2) + "@#@" +
    rec.getString(3) + "@#@" +
    rec.getString(4);
    readintoTable1();
    }else if (ServerGUI.currentT == 2){
    hoeveel = 0;
    rec = st.executeQuery("SELECT * FROM SPECIES");
    while (rec.next()) {
    bidData[hoeveel++] = rec.getString(1) + "@#@" + rec.getString(2);
    readintoTable2();
    }else if(ServerGUI.currentT == 3){
    hoeveel = 0;
    rec = st.executeQuery("SELECT * FROM USER");
    while (rec.next()) {
    bidData[hoeveel++] = rec.getString(1) + "@#@" + rec.getString(2)
    + "@#@" + rec.getString(3);
    readintoTable3();
    }catch(ClassNotFoundException cnf){
    System.out.println("classNotFound" + cnf);
    }catch(SQLException se) {
    System.out.println("SqlExeption" + se);
    //Clean the table and reads the data into the animal table
    public void readintoTable1(){
    for(int a = 0; a < 40; a++){
    ServerGUI.rows1[a][0] = "";
    ServerGUI.rows1[a][1] = "";
    ServerGUI.rows1[a][2] = "";
    ServerGUI.rows1[a][3] = "";
    for (int i = 0; i < hoeveel; i++) {
    StringTokenizer str = new StringTokenizer(bidData[i], "@#@");
    ServerGUI.rows1[i][0] = str.nextToken();
    ServerGUI.rows1[i][1] = str.nextToken();
    ServerGUI.rows1[i][2] = str.nextToken();
    ServerGUI.rows1[i][3] = str.nextToken();
    //Clean the table and reads the data into the Species table
    public void readintoTable2(){
    for(int a = 0; a < 40; a++){
    ServerGUI.rows2[a][0] = "";
    ServerGUI.rows2[a][1] = "";
    for (int i = 0; i < hoeveel; i++) {
    StringTokenizer str = new StringTokenizer(bidData[i], "@#@");
    ServerGUI.rows2[i][0] = str.nextToken();
    ServerGUI.rows2[i][1] = str.nextToken();
    //Clean the table and reads the data into the User table
    public void readintoTable3(){
    for(int a = 0; a < 40; a++){
    ServerGUI.rows3[a][0] = "";
    ServerGUI.rows3[a][1] = "";
    ServerGUI.rows3[a][2] = "";
    for (int b = 0; b < hoeveel; b++) {
    StringTokenizer str = new StringTokenizer(bidData, "@#@");
    ServerGUI.rows3[b][0] = str.nextToken();
    ServerGUI.rows3[b][1] = str.nextToken();
    ServerGUI.rows3[b][2] = str.nextToken();
    //add animal information to the Animal table in the database
    public void addAnimal(String id , String name , String desc , String species_id){
    try{
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    String source = "jdbc:odbc:Database";
    Connection dbconnect = DriverManager.getConnection(source);
    Statement st = dbconnect.createStatement();
    int toAdd;
    String sqlstm = "INSERT INTO animals" + "(animal_id, animal_Name , description , species_id)" +
    "VALUES (" + id + ", '" + name + "', '" + desc + "', " + species_id + ")";
    toAdd = st.executeUpdate(sqlstm);
    dbconnect.close();
    JOptionPane.showMessageDialog(null , "New Record Added");
    ServerGUI.refreshAnimal();
    ServerGUI.currentT = 1;
    open();
    }catch(ClassNotFoundException cnf){
    JOptionPane.showMessageDialog(null,
    "Class Not Found -> " + cnf.toString(),
    "Error!!",
    JOptionPane.ERROR_MESSAGE);
    System.out.println("classNotFound" + cnf);
    }catch(SQLException se) {
    JOptionPane.showMessageDialog(null,
    "SQL Exception -> " + se.toString()
    + "\n Please make sure all data is entered correctly ",
    "Error!!",
    JOptionPane.ERROR_MESSAGE);
    System.out.println("SqlExeption" + se);
    //add animal information to the Species table in the database
    public void addSpecies(String id1 , String name1){
    try{
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    String source = "jdbc:odbc:Database";
    Connection dbconnect = DriverManager.getConnection(source);
    Statement st = dbconnect.createStatement();
    int toAdd;
    String sqlstm = "INSERT INTO species" + "(species_id, species_name)" +
    "VALUES ( '" + id1 + "', '" + name1 + "')";
    toAdd = st.executeUpdate(sqlstm);
    dbconnect.close();
    JOptionPane.showMessageDialog(null , "New Record Added");
    ServerGUI.refreshSpecies();
    ServerGUI.currentT = 2;
    open();
    }catch(ClassNotFoundException cnf){
    JOptionPane.showMessageDialog(null,
    "Class Not Found -> " + cnf.toString(),
    "Error!!",
    JOptionPane.ERROR_MESSAGE);
    System.out.println("classNotFound" + cnf);
    }catch(SQLException se) {
    JOptionPane.showMessageDialog(null,
    "SQL Exception -> " + se.toString()
    + "\n Please make sure all data is entered correctly ",
    "Error!!",
    JOptionPane.ERROR_MESSAGE);
    System.out.println("SqlExeption" + se);
    //add animal information to the User table in the database
    public void addUser(String id2 , String user , String pass){
    try{
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    String source = "jdbc:odbc:Database";
    Connection dbconnect = DriverManager.getConnection(source);
    Statement st = dbconnect.createStatement();
    int toAdd;
    String sqlstm = "INSERT INTO user" + "(user_id, user_name ,user_password)" +
    "VALUES ( '" + id2 + "', '" + user + "', '"+ pass + "')";
    toAdd = st.executeUpdate(sqlstm);
    dbconnect.close();
    JOptionPane.showMessageDialog(null , "New Record Added");
    ServerGUI.refreshUser();
    ServerGUI.currentT = 3

    Your code is completely unreliable and it should be placed inside a code block when you add it. Also your question would be better off in the JDBC forum than the networking one.

  • Help needed on Creating SOAP message

    hi all
    i am trying to use the saaj from JWDP1.4 to manually create a soap message and send it to a .net webservice. when i run it, i keep getting error complaining the http header :
    com.sun.xml.messaging.saaj.SOAPExceptionImpl: Invalid Content-Type:text/html.here is the code, notice the part i use the message to add header information, but it didn't get added for some reason. any help would be much appreciated.
    import javax.xml.soap.SOAPConnectionFactory;
    import javax.xml.soap.SOAPConnection;
    import javax.xml.soap.MessageFactory;
    import javax.xml.soap.SOAPMessage;
    import javax.xml.soap.SOAPPart;
    import javax.xml.soap.SOAPEnvelope;
    import javax.xml.soap.SOAPBody;
    import javax.xml.soap.SOAPElement;
    import java.io.FileInputStream;
    import javax.xml.transform.stream.StreamSource;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.transform.Transformer;
    import javax.xml.transform.Source;
    import javax.xml.transform.stream.StreamResult;
    import java.net.URL;
    public class JWTest {
       public static void main(String args[]) {
          try {
             //First create the connection
             SOAPConnectionFactory soapConnFactory =
                                SOAPConnectionFactory.newInstance();
             SOAPConnection connection =
                                 soapConnFactory.createConnection();
             //Next, create the actual message
             MessageFactory messageFactory = MessageFactory.newInstance();
             SOAPMessage message = messageFactory.createMessage();
              //  Add the HTTP headers.
              message.getMimeHeaders().addHeader("User-Agent", "Mozilla/4.0 [en] (WinNT; I)");
              message.getMimeHeaders().addHeader("Host", "m25385");
              message.getMimeHeaders().addHeader("Content-type", "text/xml");
              message.getMimeHeaders().addHeader("SOAPAction", "TELUS.Geomatics.WebServices.AdslAvailability.GetAdslAvailability/GetAvailability");
              message.setProperty(SOAPMessage.CHARACTER_SET_ENCODING, "utf-8");
             //Create objects for the message parts           
             SOAPPart soapPart =     message.getSOAPPart();
             SOAPEnvelope envelope = soapPart.getEnvelope();
              envelope.addNamespaceDeclaration("xsd", "http://www.w3.org/2001/XMLSchema");
              envelope.addNamespaceDeclaration("xsi", "http://www.w3.org/2001/XMLSchema-instance");
             SOAPBody body =         message.getSOAPBody();
            //Populate the body
            //Create the main element and namespace
            SOAPElement bodyElement =
                      body.addChildElement(envelope.createName("GetAvailability" ,
                                              "TELUS.Geomatics.WebServices.AdslAvailability.GetAdslAvailability"));
            //Add content
            bodyElement.addChildElement("postalCode").addTextNode("T6J2S4");
              bodyElement.addChildElement("phoneNumber").addTextNode("7057211380");
              bodyElement.addChildElement("callingSystem").addTextNode("MyTelus");
            //Save the message
            //message.saveChanges();
            //Check the input
            System.out.println("\nREQUEST:\n");
            message.writeTo(System.out);
            System.out.println();
            //Send the message and get a reply  
            /*Set the destination
            String destination =
                "http://m25385/GeoExplorer/webservices/ADSLAvailability/GetADSLAvailability.asmx";
              URL endpoint = new URL("http://m25385/GeoExplorer/webservices/ADSLAvailability/GetADSLAvailability.asmx");
            //Send the message
            SOAPMessage reply = connection.call(message, endpoint);
            //Check the output
            System.out.println("\nRESPONSE:\n");
            //Create the transformer
            TransformerFactory transformerFactory =
                               TransformerFactory.newInstance();
            Transformer transformer =
                            transformerFactory.newTransformer();
            //Extract the content of the reply
            Source sourceContent = reply.getSOAPPart().getContent();
            //Set the output for the transformation
            StreamResult result = new StreamResult(System.out);
            transformer.transform(sourceContent, result);
            System.out.println();
             //Close the connection           
             connection.close();
            } catch(Exception e) {
                System.out.println(e.getMessage());
    }

    Can this be done in actionPerformed method If you want the user to have to hit enter after every character they type, yes. Most auto-complete implementations don't, and they'll hate you for it.
    Can anyone be more specific What is your specific problem? have you already implemented your combo-box model that will prune the available selections, or not? If not, start there.
    Also if is enter S in textfield wont the focus in the
    Dropdown be on the first choice starting with S ?Not if the combo is editable and the drop down is not showing.
    is it possible with JComboBox or someother Swing componentYes. Follow the steps in the previous post.
    Pete

  • Help needed with JSTL fmt:message encoding

    I'm using a greek resource bundle like
    <fmt:setLocale value="el"/>
    <fmt:setBundle basename="i18n.messages"/>
    I used UTF-8 for both the bundle file and JSP response encoding, but the values never prints out in the JSP response properly. If any non-english user can share some insight here, i'd really appreciate it...
    Thanks,
    Manos

    Have you considered using unicode for presentation. It might not be the prettiest way to do things, however, when I needed to present non-english characters. I would send them to JSP as a collection of unicode characters and than translate each one into character based on the desired locale.
    Hope it helps.

  • Help needed with coding error message

    I have a webpage in which I have inserted a mortgage calculator widget from zillow.  Everything looks good on browser view...but errors when validating. 
    This is where I downloaded the widget. 
    www.zillow.com/webtools/widgets/MortgageCalculatorWidget.htm
    Here is my html code for the page:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <!--[if lt IE 7]> <html class="ie6 oldie"> <![endif]-->
    <!--[if IE 7]>    <html class="ie7 oldie"> <![endif]-->
    <!--[if IE 8]>    <html class="ie8 oldie"> <![endif]-->
    <!--[if gt IE 8]><!-->
    <!--<![endif]-->
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>financing</title>
    <link href="../../boilerplate.css" rel="stylesheet" type="text/css">
    <link href="../../styles.css" rel="stylesheet" type="text/css">
    <style type="text/css">
    body {
              background-color: #F9F8F6;
    background-image: url(file:///C|/Users/Kim/Documents/Kim's_New_PQH_website/Assets/Images/background_texture _blue159.jpg);
    </style>
    <link href="../../SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css">
    <style type="text/css">
    a:hover {
              color: #009900;
    </style>
    <!--
    To learn more about the conditional comments around the html tags at the top of the file:
    paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/
    Do the following if you're using your customized build of modernizr (http://www.modernizr.com/):
    * insert the link to your js here
    * remove the link below to the html5shiv
    * add the "no-js" class to the html tags at the top
    * you can also remove the link to respond.min.js if you included the MQ Polyfill in your modernizr build
    -->
    <!--[if lt IE 9]>
    <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    <script src="../../respond.min.js" type="text/javascript"></script>
    <script src="../../SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
    </head>
    <body>
    <div class="gridContainer clearfix">
      <div id="LayoutDiv1"><img src="../Images/newbannernewlogo.jpg" alt="NewbannerNewLogo"></div>
      <div id="Navigation">
        <ul id="MenuBar1" class="MenuBarHorizontal">
          <li>
            <div><a href="#">Home</a> </div>
          </li>
          <li>
            <div><a href="#" class="MenuBarHorizontal">Home Plans</a></div>
          </li>
          <li>
            <div><a href="#">New Homes / Lots</a> </div>
          </li>
          <li>
            <div><a href="#">Gallery</a> </div>
          </li>
          <li>
            <div><a href="#">Financing</a> </div>
          </li>
          <li>
            <div><a href="#">About Us</a> </div>
          </li>
          <li>
            <div><a href="#">Contact Us</a> </div>
          </li>
        </ul>
      </div>
      <div id="finance_pic"><img src="../Images/finance pic.jpeg" alt="finance_pic" width="65%" height="282"></div>
      <div id="finance_info">
        <p>By using a mortgage calculator, you can save time by focusing on homes that fit your budget. There are many types of loans available including:  </p>
      </div>
      <div id="loan_choices">
        <ul type="square">
          <li><a href="http://homeguides.sfgate.com/conventional-loans-2669.html">Conventional FNMA</a></li>
          <li><a href="http://banking.about.com/od/mortgages/a/FHALoans.htm">FHA</a></li>
          <li><a href="http://www.benefits.va.gov/homeloans/">VA</a></li>
          <li>Little or no money down w.a.c.</li>
        </ul>
      </div>
      <div id="finance_into">
        <p>Finding the right financing to purchase your new home from pre-qualifying to close is as important, if not more important than finding your dream home itself.</p>
        <p> you have your own financing or you wish to utilize a Preferred Quality Homes lender, PQH will ensure that you have the best financing to meet your needs and make your dreem home become a reality.</p>
      </div>
      <div id="mortgage_cal"><div id="horizontalWidget" style="width:370px;overflow:hidden;text-align:center;font-family:verdana,arial,sans-serif ;font-size:8pt;line-height:13x;background-color:#3399cc;letter-spacing:0;text-transform:no ne;border-radius: 5px;webkit-border-radius:5px;"><div style="margin:6px 0;"><a href="http://www.zillow.com/mortgage-calculator/" target="_blank" title="Mortgage Calculators on Zillow" style="font-family:Arial;font-size:15px;text-decoration:none;font-weight:bold;color:#f0f2 f4;cursor: pointer;display: block;text-align: center;text-shadow: 0 1px #000;">Calculate Payment</a></div><div style="width:352px;margin:0 auto;background-color:#e3f2f9;text-align:left; font-size:8pt;border-radius: 5px; border: 1px solid;border-color:#2e84ae;webkit-border-radius: 5px;padding: 0 1px;"><iframe title="Mortgage Calculator" frameborder="0" height="235px" style="float:left;" scrolling="no" width="352px" src="http://www.zillow.com/mortgage/SmallMortgageLoanCalculatorWidget.htm?price=400000&wtype=sp c&rid=102001&wsize=small&textcolor=3399cc&backgroundColor=e3f2f9&advTabColor=5ba0c1&bgcolo r=3399cc&bgtextcolor=f0f2f4&headerTextShadow=000&widgetOrientationType=horizontalWidget"> Your browser doesn't support frames. Visit <a href="http://www.zillow.com/mortgage-calculator/" target="_blank" style="text-decoration:none; font-size:9pt; font-weight:bold;">Zillow Mortgage Calculators</a> to see this content. </iframe><diV style="clear:both;"></div></div><div style="height:20px;"><span style="display:block;margin:0 auto;font-size:7pt;height:15px;width:178px;color:#f0f2f4;padding-top:2px;"><a href="http://www.zillow.com/mortgage-rates/" target="_blank" title="Zillow Mortgage Marketplace" style="text-decoration:none;color:#3366bb;font-weight:normal;font-family:verdana,arial,sa ns-serif;font-size:7pt;color:#f0f2f4;">Zillow Home Loan Calculator</a></span></div></div></div>
    <div id="BottomNav">
      <div>
          <div>Home  |  Our Homes  |  Neighborhoods  |  Gallery  |  Financing  |  About Us  |  Contact Us </div>
        </div>
    </div>
      <div id="PriceAvail">
        <div>
          <div>Pricing and Availability are subject to change without notice</div>
        </div>
      </div>
      <div id="Footer">
        <div>
          <div>Copyright &copy; 2012 PreferredQualityHomes.com, pqualityhomes.com, pqhhomes.com, &amp; Preferred Quality Homes, L.L.C. All rights reserved. Last updated 10/31/12</div>
        </div>
      </div>
    </div>
    <script type="text/javascript">
    var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgDown:"SpryAssets/SpryMenuBarDownHover.gif", imgRight:"SpryAssets/SpryMenuBarRightHover.gif"});
    </script>
    </body>
    </html>
    ANY help would be appreciated!  
    Kim

    Can you tell me how to do that?
    On Jul 25, 2013 10:26 PM, "mytaxsite.co.uk" <[email protected]

  • Help needed to retrieve missing messages and folders; though items still present

    Something happened, but I am not sure what.
    TB had difficulty loading, and then afterwards one of my folders [ a sub-folder of Inbox ] was duplicated, and all of its sub-folders were missing.
    if I search for a keyword to locate a message w/in on of the sub,sub folders , I find the messages ARE listed in the results panel, and the filter dialogue on the left side lists the folder name [ that is missing ] that they were in. However if I click on the message to load it in a new tab, the tab is blank
    I tried the 'properties;repair folder' but I get only a 'busy' symbol [ spinning green circle ] and no eventual change.
    Help!

    Hi Essjay32,
    Welcome to Nokia Support Discussions!
    What you could do is to install the latest Nokia Suite beta, which can upload your contacts to Skydrive. When you get your Lumia 900, you can just use that Microsoft account as your main account and the contact data should be there waiting for you. Unfortunately, it is not possible to transfer your messages to a Lumia phone, you can however store your existing messages on Nokia Suite. 
    When connecting your phone to your computer (using a USB cable), press the menu button, as it will set up your phone in Nokia Suite mode. After this you should be able to access your phone data and upload it to Skydrive.
    Hope this helps!
    Puigchild
    If you find this post helpful, a click upon the white star at bottom would always be appreciated.
    If it also solves your problem, clicking ACCEPT AS SOLUTION below it will benefit other users!

  • Help needed with Lion Console message

    There is a process crashing every 10 seconds. I don't know what the message means, but this can't be right. The following is a short section of a very long Console log:
    7/26/11 12:43:45.079 PM com.apple.launchd: (com.aladdin.hasplmd) Throttling respawn: Will start in 10 seconds
    7/26/11 12:43:45.094 PM ReportCrash: Saved crash report for hasplmd[5594] version ??? (???) to /Library/Logs/DiagnosticReports/hasplmd_2011-07-26-124345_localhost.crash
    7/26/11 12:43:55.285 PM com.apple.launchd: (com.aladdin.hasplmd[5595]) Job appears to have crashed: Bus error: 10
    7/26/11 12:43:55.285 PM com.apple.launchd: (com.aladdin.hasplmd) Throttling respawn: Will start in 10 seconds
    7/26/11 12:43:55.299 PM ReportCrash: Saved crash report for hasplmd[5595] version ??? (???) to /Library/Logs/DiagnosticReports/hasplmd_2011-07-26-124355_localhost.crash
    7/26/11 12:44:05.491 PM com.apple.launchd: (com.aladdin.hasplmd[5596]) Job appears to have crashed: Bus error: 10
    7/26/11 12:44:05.491 PM com.apple.launchd: (com.aladdin.hasplmd) Throttling respawn: Will start in 10 seconds
    7/26/11 12:44:05.507 PM ReportCrash: Saved crash report for hasplmd[5596] version ??? (???) to /Library/Logs/DiagnosticReports/hasplmd_2011-07-26-124405_localhost.crash
    7/26/11 12:44:15.697 PM com.apple.launchd: (com.aladdin.hasplmd[5597]) Job appears to have crashed: Bus error: 10
    7/26/11 12:44:15.697 PM com.apple.launchd: (com.aladdin.hasplmd) Throttling respawn: Will start in 10 seconds
    7/26/11 12:44:15.711 PM ReportCrash: Saved crash report for hasplmd[5597] version ??? (???) to /Library/Logs/DiagnosticReports/hasplmd_2011-07-26-124415_localhost.crash
    7/26/11 12:44:25.902 PM com.apple.launchd: (com.aladdin.hasplmd[5598]) Job appears to have crashed: Bus error: 10
    7/26/11 12:44:25.902 PM com.apple.launchd: (com.aladdin.hasplmd) Throttling respawn: Will start in 10 seconds
    7/26/11 12:44:25.916 PM ReportCrash: Saved crash report for hasplmd[5598] version ??? (???) to /Library/Logs/DiagnosticReports/hasplmd_2011-07-26-124425_localhost.crash
    7/26/11 12:44:35.932 PM ReportCrash: DebugSymbols was unable to start a spotlight query: spotlight is not responding or disabled.
    7/26/11 12:44:36.125 PM com.apple.launchd: (com.aladdin.hasplmd[5599]) Job appears to have crashed: Bus error: 10
    7/26/11 12:44:36.125 PM com.apple.launchd: (com.aladdin.hasplmd) Throttling respawn: Will start in 10 seconds
    7/26/11 12:44:36.175 PM ReportCrash: Saved crash report for hasplmd[5599] version ??? (???) to /Library/Logs/DiagnosticReports/hasplmd_2011-07-26-124436_localhost.crash
    7/26/11 12:44:46.334 PM com.apple.launchd: (com.aladdin.hasplmd[5601]) Job appears to have crashed: Bus error: 10
    7/26/11 12:44:46.334 PM com.apple.launchd: (com.aladdin.hasplmd) Throttling respawn: Will start in 10 seconds

    I got the following feedback from X-Rite support:
    "please proceed as follows:
    Go to MacHD/Library/LaunchDaemons and delete the file “com.aladdin.hasplmd.plist”. (You will need administrative rights.)
    See if that eliminates the crash."
    It worked for me.
    JO

  • Help needed with project setting (640x480 30FPS)

    Hi
    I am sorry if this is a simple question, I am new to PE and video editing
    I have just purchased PE9 and working on a small project to put togather a family movie.
    The vide sources is from a Panasonic DMC-FZ28 camera, and looking at the file properties it is 640/480 (30 or 29.xx FPS depending how you look). the file is a .mov file.
    I keep reading about how important getting the project setting but I can not find anything suitable which is surprising as the format is not particulary odd.
    Having checked a few postings, I've seen recommendations to selects NTSC DSLR 480p 640x480, however, when I start a new project and look at projects settings avaiable under NTSC/DSLR there is a 480p 640x480 option but at 60 (or 59.94) FPS.
    Can you please recommend an appropropriate setting
    Many thanks

    Have a look at part 1 of my Basic Training for Premiere Elements tutorial series for Premiere Elements support site Muvipix.com.
    It will show you how to set up your project for NTSC 640x480p60 DSLR video (about as close as you can get to your specs).
    If that doesn't work, try experimenting by shooting in 1280x720 and using that DSLR setting.
    Also ensure that you have the latest version of Quicktime from Apple.

  • Help needed for project

    hi....i wanna ask anyone who can help tell me how you can put a .gif file such that the html file can show the .gif picture and a random number generator applet together UPON click on a button.
    u see....there are many .gif files and on the base of the html...there are buttons to click on such that when you click on different buttons...u will go into various .gif. so now now on one of the .gif files....i wanna add a random number java applet inside the .gif and add this to the whole html file.
    please help.thanks

    You can't put a random number generator is a gif. GIFs are images following a particular format (and using compression owned by an evil company which a few years ago anyway were threatening to sue everybody in the world), and is not executable. That doesn't really make sense.
    But don't try to describe problem in terms of a possible implementations; that just confuses the matter. It sounds like you want to display images, based on a static gif file, with additional random content added. Is that what you want to do?
    I'm pretty sure it's possible to:
    (1) load an image from a GIF file, into a buffer
    (2) filter that buffer through a routine that draws arbitrary stuff
    (3) that arbitrary stuff could include alphanumeric text produced by a random number generator
    (4) the output from the filter could then be used to create an image object
    (5) that image object could then be displayed.

Maybe you are looking for

  • How to wire up and use 256 points at a time on the PXI-2532

    I have a PXI chassis with a PXI-2532 512-Crosspoint Matrix Switch Module, a TB-2640 connected to it, and a PXI-4072 FlexDMM and LCR meter. I am trying to use the DMM to make measurements of something connected to the switch matrix.  What I can't seem

  • Motion tween with transitions

    Im trying to create and effect where a picture will move across the stage and I have done this. I have also been able to create transitions with little problems. The effect that i am looking for is to combine both motion tween and fade in fade out ef

  • Output should be in Text format from Back ground job

    Hi friends, I have scheduleda back ground job. In the receipent i ahve put my user mail ID. when the job was finished the output came as HTML file. where as my user wants a Text file or excel file. We are in ECC 5.0 and i am just scheduling standard

  • Advanced actions not working in project preview or publish

    I have a project with advanced actions which work fine in single slide preview but which don't work at all in project preview or when I publish.  To make it even worse a slide on the same project I did earlier works ok when previewed.  Very confused!

  • Lightroom failed to export

    I was running LR2 on a vista machine and everything was working  great. I moved over to WIN7 32 bit re installed/updates for PC and LR everything was fine until i came to export! All files are located on internal drives, no problems with missing file