NullPointerException when using JEditorPane

I use a JEditorPane to show html in an applet, when I try to load the JEditorPane from an InputStream I get a NullPointerException.
Stacktrace:
Exception occurred during event dispatching:
java.lang.NullPointerException
     at javax.swing.text.html.StyleSheet.getRule(StyleSheet.java:182)
     at javax.swing.text.html.StyleSheet$ViewAttributeSet.<init>(StyleSheet.java:2767)
     at javax.swing.text.html.StyleSheet.getViewAttributes(StyleSheet.java:285)
     at javax.swing.text.html.BlockView.setPropertiesFromAttributes(BlockView.java:314)
     at javax.swing.text.html.BlockView.setParent(BlockView.java:59)
     at javax.swing.plaf.basic.BasicTextUI$RootView.setView(BasicTextUI.java:1061)
     at javax.swing.plaf.basic.BasicTextUI.setView(BasicTextUI.java:480)
     at javax.swing.plaf.basic.BasicTextUI.modelChanged(BasicTextUI.java:468)
     at javax.swing.plaf.basic.BasicTextUI$UpdateHandler.propertyChange(BasicTextUI.java:1518)
     at javax.swing.event.SwingPropertyChangeSupport.firePropertyChange(SwingPropertyChangeSupport.java:153)
     at javax.swing.JComponent.firePropertyChange(JComponent.java:3721)
     at javax.swing.text.JTextComponent.setDocument(JTextComponent.java:660)
     at javax.swing.text.JTextComponent.read(JTextComponent.java:1384)
     at javax.swing.JEditorPane.read(JEditorPane.java:400)
The file I load just contains "<html><body>Test</body></html>", I am loading it using url.openStream();. The file is below the codebase and the url is correct.
Tell me if you need more information.

The HTML you say you are trying to use is not technically well-formed. I think you need to include the <head> tag here. All CSS information must be located there, and I am assuming that the parser is looking for this info since it is dying in javax.swing.text.html.StyleSheet.
Mitch Goldstein
Author, Hardcore JFC (Cambridge Univ Press)
[email protected]

Similar Messages

  • Weblogic throws NullPointerException when using ServiceControl.setTimeout

    We are invoking a SOAP service via a com.bea.control.ServiceControl that was generated from a WSDL (right click WSDL, Generate Service Control) using Weblogic 8.1.6.
    SOAP service execution is successful using an http and https endpoint. However, when setting a timeout via ServiceControl.setTimeout(int millisecods) method, the Weblogic API is throwing a NullPointerException when using an https endpoint. When using an http endpoint with the setTimeout method execution is successful.
    DEBUG com.bea.wlw.runtime.jws.call.SoapHttpCall [ExecuteThread: '10' for queue: 'weblogic.kernel.Default']: opening connection to https://[... edit removed ...]
    DEBUG com.bea.wlw.runtime.jws.call.SoapHttpCall [ExecuteThread: '10' for queue: 'weblogic.kernel.Default']: Response generation exception
    Throwable: java.lang.NullPointerException
    Stack Trace:
    java.lang.NullPointerException
         at weblogic.net.http.HttpsClient.openWrappedSSLSocket(HttpsClient.java:455)
         at weblogic.net.http.HttpsClient.openServer(HttpsClient.java:235)
         at weblogic.net.http.HttpsClient.openServer(HttpsClient.java:389)
         at weblogic.net.http.HttpsClient.<init>(HttpsClient.java:209)
         at weblogic.net.http.HttpClient.New(HttpClient.java:228)
         at weblogic.net.http.HttpsURLConnection.getHttpClient(HttpsURLConnection.java:246)
         at weblogic.net.http.HttpsURLConnection.connect(HttpsURLConnection.java:217)
         at weblogic.net.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:189)
         at com.bea.wlw.runtime.jws.call.SoapHttpCall.invoke(SoapHttpCall.java:179)
         at com.bea.wlw.runtime.jws.call.SoapHttpCall.invoke(SoapHttpCall.java:80)
         at com.bea.wlw.runtime.core.control.ServiceControlImpl.invoke(ServiceControlImpl.jcs:1288)
         at com.bea.wlw.runtime.core.control.ServiceControlImpl.invoke(ServiceControlImpl.jcs:1155)
         at com.bea.wlw.runtime.core.dispatcher.DispMethod.invoke(DispMethod.java:377)
         at com.bea.wlw.runtime.core.container.Invocable.invoke(Invocable.java:433)
         at com.bea.wlw.runtime.core.container.Invocable.invoke(Invocable.java:406)
         at com.bea.wlw.runtime.jcs.container.JcsProxy.invoke(JcsProxy.java:388)
    DEBUG com.bea.wlw.runtime.jws.call.SoapFault [ExecuteThread: '10' for queue: 'weblogic.kernel.Default']: SoapFault exception throwable e
    DEBUG com.bea.wlw.runtime.jws.call.SoapHttpCall [ExecuteThread: '10' for queue: 'weblogic.kernel.Default']: response code=0, responseMsg=null
    DEBUG com.bea.wlw.runtime.jws.call.SoapHttpCall [ExecuteThread: '10' for queue: 'weblogic.kernel.Default']: closed connection to https://[... edit removed ...]
    WARN WLW.INVOKE.[... edit removed ...] [ExecuteThread: '10' for queue: 'weblogic.kernel.Default']: Id=[... edit removed id ...] Method=[... edit removed method ...]; Failure=com.bea.control.ServiceControlException: SERVICE FAULT:
    Code:java.lang.NullPointerException
    String:null
    Detail:
    END SERVICE FAULT
    ERROR [... edit removed ...]
    [ExecuteThread: '10' for queue: 'weblogic.kernel.Default']: ServiceControlException
    com.bea.control.ServiceControlException: SERVICE FAULT:
    Code:java.lang.NullPointerException
    String:null
    Detail:
    END SERVICE FAULT
         at com.bea.wlw.runtime.core.control.ServiceControlImpl.invoke(ServiceControlImpl.jcs:1268)
         at com.bea.wlw.runtime.core.dispatcher.DispMethod.invoke(DispMethod.java:377)
         at com.bea.wlw.runtime.core.container.Invocable.invoke(Invocable.java:433)
         at com.bea.wlw.runtime.core.container.Invocable.invoke(Invocable.java:406)
         at com.bea.wlw.runtime.jcs.container.JcsProxy.invoke(JcsProxy.java:388)

    Thanks for the suggestion. But with -DUseSunHttpHandler=true the Weblogic API is throwing a ClassCastException with or without the timeout value set.
    Failure=com.bea.control.ServiceControlException: SERVICE FAULT:
    Code:java.lang.ClassCastException
    String:null
    Detail:
    END SERVICE FAULT
    ERROR: ServiceControlException
    com.bea.control.ServiceControlException: SERVICE FAULT:
    Code:java.lang.ClassCastException
    String:null
    Detail:
    END SERVICE FAULT
         at com.bea.wlw.runtime.core.control.ServiceControlImpl.invoke(ServiceControlImpl.jcs:1268)
         at com.bea.wlw.runtime.core.dispatcher.DispMethod.invoke(DispMethod.java:377)
         at com.bea.wlw.runtime.core.container.Invocable.invoke(Invocable.java:433)
         at com.bea.wlw.runtime.core.container.Invocable.invoke(Invocable.java:406)
         at com.bea.wlw.runtime.jcs.container.JcsProxy.invoke(JcsProxy.java:388)

  • NullPointerException when using sharedNode in XML menu (jdev 11.1.1.3)

    I am using Jdeveloper 11.1.1.3 and when I use a sharedNode in my ADF XMLMenu, I get a NullPointerException when I start the application for the first time. I know it's the sharedNode because when I remove it i don't get the exception.
    Apparently something is not propertly initialized at startup, when I reload the page everything is fine. How can I fix this?
    java.lang.NullPointerException
         at org.apache.myfaces.trinidad.model.XMLMenuModel.getFocusRowKey(XMLMenuModel.java:302)
         at org.apache.myfaces.trinidad.component.UIXNavigationHierarchy.getFocusRowKey(UIXNavigationHierarchy.java:79)
         at oracle.adfinternal.view.faces.renderkit.rich.BreadCrumbsRenderer._getItemCount(BreadCrumbsRenderer.java:403)
         at oracle.adfinternal.view.faces.renderkit.rich.BreadCrumbsRenderer.encodeAll(BreadCrumbsRenderer.java:130)

    Hm I got it. I also have nested templates and in the outer template I had a breadcrumb referencing the sharedNode menu. Somehow this caused a NullPointerException. The breadcrumb was never meant to reference that menu in the first place so I changed it, but it is still a weird situation, maybe worth a testcase...

  • Java.lang.NullpointerException when use source table as a mapping component

    Hi all,
    I am new to owb and I got NullPointerException when I try to drag a table to my mapping.
    The table is imported and it's from a windows oracle database. The mapping is located on my linux oracle database.
    By the way, I can even deploy the table.
    What have I done wrong and why this happen?
    thanks in advance.
    帖子经 953800编辑过

    Hi Timo,
    Thanks for the reply,
    If I understand correctly I need to apply to the weblogic server 10.3.5 + Sherman patch UPDATE1 patch #12979653 and patch #12917525. After this the ADF Runtime 11.1.1.5 installed in the Production environments will allow me to run my application that is running in ADF Runtime 11.1.2.1. right?
    I'm working on getting this patches installed. Thank you very much for your help.
    I run the test on my local server as a test class and as a web service, it worked perfect, nevertheless in the Production environment I got a interesting answer:
    Production 1 and 2:
    Request:
    <?xml version="1.0" encoding="UTF-8"?>
    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://model/">
    <env:Header/>
    <env:Body>
    <ns1:getVersion/>
    </env:Body>
    </env:Envelope>
    Response
    <?xml version='1.0' encoding='UTF-8'?>
    <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
    <S:Body>
    <S:Fault xmlns:ns4="http://www.w3.org/2003/05/soap-envelope">
    <faultcode>S:Server</faultcode>
    <faultstring>oracle/jbo/Version</faultstring>
    </S:Fault>
    </S:Body>
    </S:Envelope>
    Request:
    <?xml version="1.0" encoding="UTF-8"?>
    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://model/">
    <env:Header/>
    <env:Body>
    <ns1:getBuildLabel/>
    </env:Body>
    </env:Envelope>
    Response:
    <?xml version='1.0' encoding='UTF-8'?>
    <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
    <S:Body>
    <ns2:getBuildLabelResponse xmlns:ns2="http://model/">
    <return>oracle.jbo.Version</return>
    </ns2:getBuildLabelResponse>
    </S:Body>
    </S:Envelope>
    Edited by: 917852 on Jul 12, 2012 11:31 AM

  • "java.lang.NullPointerException" when use doFinal(byte[])

    My code here:
    KeyFactory kf = null;
    Cipher cipher = null;
    PrivateKey pk = null;
    byte[] symKey = null;
    try {
    Security.addProvider(new BouncyCastleProvider());
    catch (Exception e) {
    System.err.println("Error loading security provider (" +
    e.getMessage() + ")");
    try {
    kf = KeyFactory.getInstance("RSA");
    catch (NoSuchAlgorithmException ex1) {
    try {
    pk = kf.generatePrivate(priServer);
    catch (InvalidKeySpecException ex3) {
    try {
    cipher = Cipher.getInstance("RSA");
    catch (NoSuchAlgorithmException ex2) {
    catch (NoSuchPaddingException ex2) {
    try {
    cipher.init(Cipher.DECRYPT_MODE, pk);
    catch (InvalidKeyException ex4) {
    try {
    symKey = cipher.doFinal(CEK); //get encode of symmetric key
    when CEK is byte[].
    I got exception :
    java.lang.NullPointerException
         at java.math.BigInteger.remainder(BigInteger.java:1239)
         at org.bouncycastle.crypto.engines.RSAEngine.processBlock(RSAEngine.java:133)
         at org.bouncycastle.jce.provider.JCERSACipher.engineDoFinal(JCERSACipher.java:288)
    where my code wrong? Please help me!
    Note : I use bouncycastle provider.
    Thanks

    bla bla bla
    kf = KeyFactory.getInstance("RSA");
    pk = kf.generatePrivate(priServer);
    cipher = Cipher.getInstance("RSA");
    cipher.init(Cipher.DECRYPT_MODE, pk);IMHO RSA is 2-keys algorithm => you cannot use it in cipher class
    If u need encrypt use PBE for example
    PBEKeySpec pbeKeySpec;
    PBEParameterSpec pbeParamSpec;
    SecretKeyFactory keyFac;
    // Salt
    byte[] salt = ...;
    // Iteration count
    int count = 20;
    // Create PBE parameter set
    pbeParamSpec = new PBEParameterSpec(salt, count);
    // Prompt user for encryption password.
    pbeKeySpec = new PBEKeySpec(pass); //String with
    keyFac = SecretKeyFactory.getInstance("PBEWithMD5AndDES");
    SecretKey pbeKey = keyFac.generateSecret(pbeKeySpec);
    // Create PBE Cipher
    Cipher pbeCipher = Cipher.getInstance("PBEWithMD5AndDES");
    // Initialize PBE Cipher with key and parameters
    pbeCipher.init(Cipher.ENCRYPT_MODE, pbeKey, pbeParamSpec);
    // Our cleartext
    byte[] cleartext = "This is another example".getBytes();
    // Encrypt the cleartext
    byte[] ciphertext = pbeCipher.doFinal(cleartext);

  • NullPointerException when using Scanner

    Hey people,
    I've made this little class for interacting with the user via the console:
    package dyreleg;
    import java.util.Scanner;
    * Communicates with the user via the command line
    * @author majs
    public class ConsoleUI implements UserInteraction {
        private Scanner input;
        public void ConsoleUI() {
            this.input = new Scanner(System.in);
         * Asks the user a given question and returns the answer as a string
         * @param question     the question to ask the user
         * @return          the users full answer
        public String getAnswer(String question) {
            System.out.println(question);
            String answer = this.input.next("\n");
            input.nextLine();
            return answer;
         * Asks the user a given question and forces him/her to answer with either y
         * for yes or n for no.
         * @param question     question the question to ask the user
         * @return          the users answer, true for yes and false for no
        public boolean getAnswerYesNo(String question) {
            System.out.println(question+" (y or n");
            while (true) {
                String answer = this.input.next();
                answer = answer.toLowerCase();
                if (answer.equals("y")) {
                    return true;
                } else if (answer.equals("n")) {
                    return false;
                } else {
                    System.out.println("You must answer y for yes or n for no to the given question");
    }My problem is that when i try to use any of the member functions, (getAnswer and getAnswerYesNo) i get a NullPointerException, and i can't understand why. I know that NullPointerExceptions indicate that the variable isn't set to an object, but as far as i can see that does'nt seem to be the problem here. I've used the Scanner class without problems in the rest of my application before making this class without problems.
    Any kind of help is appreciated.

    Meinertz,
    I've been using / extending this one for a while... I find it's handy for console based user interfaces... which are (lets face it) just soooo seventies.
    package krc.utilz.io;
    // usage:
    // import krc.utilz.io.Console;
    // String name = Console.readLine("Enter your name : ");
    // while ( (score=Console.readInteger("Enter a score between 0 and 100 (enter to quit) : ", 0, 100, -1)) != -1) { ... }
    import java.util.Date;
    import java.text.DateFormat;
    import java.text.SimpleDateFormat;
    public abstract class Console
      private static final java.io.Console theConsole = System.console();
      private static final DateFormat dateFormatter = new SimpleDateFormat("dd/MM/yyyy");
      public static String readLine(String prompt) {
        while(true) {
          try {
            System.out.print(prompt);
            return theConsole.readLine();
          } catch (Exception e) {
            System.out.println("Oops: "+e);
      public static Date readDate(String prompt) {
        while(true) {
          try {
            String response = readWord(prompt+" (dd/mm/yyyy) : ");
            return dateFormatter.parse(response);
          } catch (Exception e) {
            System.out.println("Oops: "+e);
      public static String readWord(String prompt) {
        String response = null;
        while(true) {
          try {
            response = readLine(prompt);
            if( response!=null && response.length()>0 && response.indexOf(' ')<0 ) break;
            System.out.println("Oops: A single word is required. No spaces.");
          } catch (Exception e) {
            System.out.println("Oops: "+e);
        return(response);
      public static char readLetter(String prompt) {
        char result = '\0';
        while(true) {
          try {
            String response = readLine(prompt);
            if ( response!=null && response.length()==1 ) {
              result = response.charAt(0);
              if(Character.isLetter(result)) break;
            System.out.println("Oops: A single letter is required!");
          } catch (Exception e) {
            System.out.println("Oops: "+e);
        return(result);
      public static int readInteger(String prompt) {
        int result = 0;
        String response = null;
        while(true) {
          try {
            response = readLine(prompt);
            if ( response!=null && response.length()>0 ) {
              result = Integer.parseInt(response);
              break;
            System.out.println("An integer is required.");
          } catch (NumberFormatException e) {
            System.out.println("Oops \""+response+"\" is not an integer!");
          } catch (Exception e) {
            System.out.println("Oops: "+e);
        return(result);
      public static int readInteger(String prompt, int lowerBound, int upperBound) {
        int result = 0;
        while(true) {
          result = readInteger(prompt);
          if ( result>=lowerBound && result<=upperBound ) break;
          System.out.println("An integer between "+lowerBound+" and "+upperBound+" (inclusive) is required.");
        return(result);
      public static int readInteger(String prompt, int defualt) {
        String response = null;
        while(true) {
          try {
            response = readLine(prompt);
            return (response!=null && response.trim().length()>0
              ? Integer.parseInt(response)
              : defualt
          } catch (NumberFormatException e) {
            System.out.println("Oops: \""+response+"\" is not an integer!");
          } catch (Exception e) {
            System.out.println("Oops: "+e);
      public static int readInteger(String prompt, int lowerBound, int upperBound, int defualt) {
        int result = 0;
        while(true) {
          result = readInteger(prompt, defualt);
          if ( result==defualt || result>=lowerBound && result<=upperBound ) break;
          System.out.println("An integer between "+lowerBound+" and "+upperBound+" (inclusive) is required.");
        return(result);
      public static double readDouble(String prompt) {
        double result = 0;
        String response = null;
        while(true) {
          try {
            response = readLine(prompt);
            if ( response!=null && response.length()>0 ) {
              result = Double.parseDouble(response);
              break;
            System.out.println("A number is required.");
          } catch (NumberFormatException e) {
            System.out.println("\""+response+"\" cannot be interpreted as a number!");
          } catch (Exception e) {
            System.out.println("Oops: "+e);
        return(result);
      public static double readDouble(String prompt, double lowerBound, double upperBound) {
        while(true) {
          double result = readDouble(prompt);
          if ( result>=lowerBound && result<=upperBound ) return(result);
          System.out.println("A number between "+lowerBound+" and "+upperBound+" (inclusive) is required.");
      public static boolean readBoolean(String prompt) {
        while(true) {
          try {
            String response = readWord(prompt+" (Y/N) : ");
            return response.trim().equalsIgnoreCase("Y");
          } catch (Exception e) {
            System.out.println("Oops: "+e);
    }This software is provided, as is, where is. Feel free to use/abuse/improve it however you wish, unless you are Military or a military contractor, or a manufacturer of guns/bombs/any-other-impliment-of-murder; in which case please go f&#117;ck yourself. If you are George Bush then please consider suicide.
    Cheers. Keith.

  • Nullpointerexception when using servlet with Mysql on a cobalt Raq3 Server

    I'm a student and i have to use servlets and Mysql to make a Database application. Our school has a Cobalt Raq3 server and has installed Java Dev Kit 1.3a.
    First problem they can't tell me their driver manager for Mysql.
    Second problem when i try my servlet it gives a NullpointerException
    import java.sql.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    public class Testingo2 extends HttpServlet {
    // Hier word een Statement en Connectie object aangemaakt die later zullen worden gebruikt om een database aan te spreken
    Statement stm;
    Connection con;
         // Hier word de servlet geinitialiseerd
    public void init() throws ServletException {
         try {
              // Hier wordt de database driver geladen
              Class.forName("org.gjt.mm.mysql.Driver");
              /** Hier gaan we gebruik maken van het Connection Object om verbinding te maken met de database CFP door een           * jdbc.odbc bridge en dit zonder username en passwoord
              con = DriverManager.getConnection("jdbc:mysql://cfp.ehsal.be:3306/cfp","bjorn","disaronno");
              // Hier zorgen we ervoor dat als er een zich een fout voordoet dat deze getoond wordt
                   catch (ClassNotFoundException cnfe ) {
                   System.out.println(cnfe.toString());
                   catch (SQLException e) {
                   System.out.println(e.toString());
    // Als de servlet het einde van zijn levenscyclus heeft bereikt gaat het connectie object worden afgesloten
    public void destroy() {
         try { con.close();}
         catch (SQLException e) {}
    public void doGet (HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
    try {
         /** Hier gaat men met het Connectie object een statement aanmaken,welk dan later zal worden gebruikt voor het           * uitvoeren van query's
         stm = con.createStatement();
         /** Hier gaat men de query "selecteer alles van de tabel projecten" uitvoeren op de cfp database dankzij het      * statement en connection object. Deze gegevens worden dan opgeslagen in de Resultset rs.
         ResultSet rs = stm.executeQuery("SELECT project,land,titel,omschrijving,budget,informatie FROM PROJECTEN ");
         /** Hier gaat men informatie, over de gegevens die in de ResultSet rs zijn opgeslagen, opslaan in ResultSetMetaData      * meta.
         ResultSetMetaData meta = rs.getMetaData();
         // Hiergaat men het aantal kolommen van de tabel tellen en opslagen in de Integer kolom
         int kolom;
         kolom = meta.getColumnCount();
         // Hier declareerd men welk soort meta type we naar browser sturen, hier dus HTML tekst
         res.setContentType("text/html");
         // Hier gaan we een PrintWriter object out aanmaken dat gebruikt zal worden om de html tekst naar de client te sturen
         PrintWriter out = res.getWriter();
         // De basis html code voor deze pagina
         out.println("<HTML >");
         out.println("<BODY BGCOLOR =fd8017>");
         out.println("<H1> <B><CENTER><FONT COLOR='#00008b'> Overzicht van de projecten </FONT></CENTER></B></H1>");
         /** Hier defini�ren we een tabel die van de hoogte en breedte van het scherm volledig gebruik maakt, waarvan de boord      * van de tabel een dikte van 1 heeft, de ruimte tussen de cellen in de tabel en tussen de randen van een cel en de      * inhoud is gelijk aan 2 (in pixels) en een achtergrondkleur fd8017
         out.println("<TABLE HEIGHT='100%' WIDTH='100%' BORDER=1 CELLPADDING = 2 CELLSPACING = 2 BGCOLOR =fd8017>");
              // begintag voor een nieuwe rij
              out.println("<TR>");
              /** Hier creeren we een lus om de kolom hoofden naar de client te sturen. Deze lus begint als j=1 en gaat           * door tot j = aantal kolommen en na elke loop wordt j verhoogd met 1. Normaal werden alle kolom hoofden           * uit de database opgehaald en afgebeeld, maar vermits MySQL geen kolom hoofden aanvaard waar spaties           * inzitten heb ik gekozen om hier de kolom hoofden die uit meer dan 1 woord bestaan op te halen en aan te           * passen. Dit voor estetische redenen, voor het functioneren van de servlet heeft dit echter geen belang
    for(int j=1;j<=kolom;j++){
              if (meta.getColumnName(j).equals("project")) {
              out.println("<TH><FONT COLOR='#00008b'> project nr </TH>");
              else if (meta.getColumnName(j).equals("budget")) {
              out.println("<TH><FONT COLOR='#00008b'> budget (in 1000 �) </TH>");
              else if (meta.getColumnName(j).equals("informatie")) {
              out.println("<TH><FONT COLOR='#00008b'> meer informatie ? </TH>");
              else {
              out.println("<TH><FONT COLOR='#00008b'>");     
              out.println(meta.getColumnName(j)+" ");
              out.println("</TH>");
              // Hier wordt de tag voor een nieuwe rij afgesloten
              out.println("</TR>");
              // Hier initialiseren we een Integer en String die later zullen worden gebruikt
              int k = 0;
              String nummer ="";
    // Dit deel van de programma code gaan we uitvoeren zolang er nog een volgende rij in de database bestaat
    while (rs.next()) {
              // Voor elke nieuwe rij wordt k verhoogd met 1
              k =k +1;
              // De tag voor een nieuwe rij
              out.println("<TR>");
         // Dit deel van de code wordt uitgevoerd zolang Integer i kleiner is dan het aantal kolommen
         for(int i=1;i <= kolom;i++) {
              // Een nieuwe cel waarin de data worden afgebeeld in de kleur #00008b
              out.println("<TD ALIGN='left' VALIGN ='top'>");
              out.println("<FONT COLOR='#00008b'> ");
              /** Hier halen we de kolomnaam op van kolom i en slagen we deze op in de String kolomnaam. Dan gaan we van           * deze naam de overtollige spaties (links en rechts van de naam) wegwerken.
              String kolomnaam = meta.getColumnName(i);
              kolomnaam = kolomnaam.trim();
              /** Als de kolomnaam gelijk is aan "project" dan gaan we de data van deze cel opslagen in de String nummer en           * deze dan doorsturen naar de client. Anders gaan we voort in onze programma code.
              if (kolomnaam.equals("project")) {
              nummer = rs.getString(i);
              out.println(nummer);
              /** Als het vorige niet waar is dan gaan we zien of de kolomnaam gelijk is aan "informatie", als dat zo is           * dan gaan we de data van de cel opslaan in de String celwaarde.
              else if ( kolomnaam.equals("informatie")) {
                   String celwaarde = rs.getString(i);
                   char punt = '.';
                   char under ='_';
                   nummer = nummer.replace(punt,under);               
                   /** Als deze String celwaade gelijk is aan "Y" dan gaan we een hyperlink afbeelden die opgebouwd is                * uit drie delen : de naam "project", de String nummer (de data uit de cel van project waar het                * "." is vervangen door "_" ) en de extensie ".html"
                   if (celwaarde.equals("Y") ){
                   out.println("<A HREF=project" + nummer + ".html> Project" +" "+ k +" </A>");     
                   /** Als de celwaarde niet gelijk is aan "Y" dan gaan we gewoon de naam "Project" en de Integer k                * afbeelden
                   else {
                   out.println("Project" +" " + k);
              else {
              out.println(rs.getString(i));
              out.println("</FONT>");
              out.println("</TD>");
              out.println("</TR>");
         out.println(" </TABLE>");
         out.println("</BODY>");
         out.println("</HTML>");
         // Hier wordt het object Satement afgesloten vermts we het niet meer nodig hebben
         stm.close();
    // Als er bij het uitvoeren van de programma code een fout zich voordoet dan wordt er een foutmelding weergegeven
    catch (SQLException e) {
    System.out.println(e.toString());

    The exception is thrown in the Doget method namely stm = con.createStatement();
    But i think that when i run my servlet that the init method is not used. I believe the problem is the access to the database.
    Thanks for the answer because i'm beginning to hate the cobalt server at my school

  • Help needed to handle vbscript when using JEditorPane

    Dear ppl,
    Reading about JEditorPane and rhino it seems like that javascript in a html file rendered on a jeditorpane can be handled using rhino. Now is there any out to do the same thing for vbscript?
    Thanks in advance.

    Hi
    You can use Modification groups while declaring the buttons. Assume we assign group1 as B1 for button1 and B2 for button 2.
    fcode for button1 as BUT1 and fcode for button2 as BUT2.
    at pbo
    if sy-ucomm = 'BUT1'.
    loop at screen.
    case screen-group1.
      when 'B1'.
         screen-active = '0'.
         modify screen.
    when 'B2'.
         screen-active = '1'.
         modify screen.
    endcase.
    endloop.
    else.
    loop at screen.
    case screen-group1.
      when 'B2'.
         screen-active = '0'.
         modify screen.
    when 'B1'.
         screen-active = '1'.
         modify screen.
    endcase.
    endloop.
    endif.
    Regards,
    Navneet

  • NullPointerException when using setBindingContext

    Hello,
    I'm having some trouble instantiating a JFrame that has data binding.
    When i instantiate the JFrame in an other class in the same project as the JFrame it works.
    But when i try to instantiate it in a class in an other project (still in the same workspace) it doens't work.
    I get a NullPointerException where ever setBindingContext is called, because panelBinding.getBindingContext() returns null from some reason.
    Can someone explain me why this is?
    Thanks in advance
    Johan Smolders

    Hi Jan,
    First off all thanks for responding.
    The bootstrap code is called before the other elements do there method calls to setBindingContext.
    So the context of panelBinding shouldn't be empty.
    All calls are preformed in the same order as they would be called when you start the JFrame itself.
    Now your second remark made me think.
    When i instantiate my JFrame in the other projects class does it use the wrong Databinding.cpx?
    So the best solution would be: Join all the file's in one project?
    Or can i explicitly tell the JFrame which Databindings it should use?
    Edit:
    As a test i copied my Databindings.cpx file in the project containing the JFrame and named it Databindings2.cpx
    I then edited the JFrame class to use this Databindings2.cpx (so i was sure is wasn't using the Databindings.cpx file of the other project)
    but the same error accured.
    Thx again
    Johan
    Message was edited by:
    Johan Smolders

  • Java.lang.NullPointerException when using DataSource connection and executing CallableStatement

    Hi Guys
    I am having some problem as I am using a DataSource for connections and randomly
    the CallableStatements and PreparedStatements created from this DataSource becomes
    null and everytime I get NullPointerException with this message.
    java.sql.SQLException: java.lang.NullPointerException
         at weblogic.jdbc.rmi.SerialPreparedStatement.setString(SerialPreparedStatement.java:210)
         at .........
    Help will be appreciated..

    Hi Guys
    I am having some problem as I am using a DataSource for connections and randomly
    the CallableStatements and PreparedStatements created from this DataSource becomes
    null and everytime I get NullPointerException with this message.
    java.sql.SQLException: java.lang.NullPointerException
         at weblogic.jdbc.rmi.SerialPreparedStatement.setString(SerialPreparedStatement.java:210)
         at .........
    Help will be appreciated..

  • Java.lang.NullPointerException when using readTemplate with WLST offline

    I imported WLST offline as a module in to jython script and tried
    wlstOffline.readTemplate('../wls.jar')
    It gives me a java.lang.NullPointerException.
    Here is the entire stack trace
    Traceback (innermost last):
      File "testOffline.py", line 3, in ?
      File "E:\wlst\wlstOffline.py", line 78, in readDomain
    java.lang.NullPointerException
            at com.bea.plateng.domain.script.jython.WLScriptContext.handleException(
    Ljava/lang/Exception;Ljava/lang/String;)V(WLScriptContext.java:897)
            at com.bea.plateng.domain.script.jython.WLScriptContext.readDomain(Ljava
    /lang/String;)V(WLScriptContext.java:244)
            at jrockit.reflect.NativeMethodInvoker.invoke0(Ljava/lang/Object;ILjava/
    lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;(Unknown Source)
            at jrockit.reflect.NativeMethodInvoker.invoke(Ljava/lang/Object;[Ljava/l
    ang/Object;)Ljava/lang/Object;(Unknown Source)
            at jrockit.reflect.VirtualNativeMethodInvoker.invoke(Ljava/lang/Object;[
    Ljava/lang/Object;)Ljava/lang/Object;(Unknown Source)
            at java.lang.reflect.Method.invoke(Ljava/lang/Object;[Ljava/lang/Object;
    I)Ljava/lang/Object;(Unknown Source)
            at org.python.core.PyReflectedFunction.__call__(Lorg/python/core/PyObjec
    t;[Lorg/python/core/PyObject;[Ljava/lang/String;)Lorg/python/core/PyObject;(PyRe
    flectedFunction.java:???)
            at org.python.core.PyMethod.__call__([Lorg/python/core/PyObject;[Ljava/l
    ang/String;)Lorg/python/core/PyObject;(PyMethod.java:???)
            at org.python.core.PyObject.__call__(Lorg/python/core/PyObject;)Lorg/pyt
    hon/core/PyObject;(PyObject.java:???)
            at org.python.core.PyInstance.invoke(Ljava/lang/String;Lorg/python/core/
    PyObject;)Lorg/python/core/PyObject;(PyInstance.java:???)
            at wlstOffline$py.readDomain$16(Lorg/python/core/PyFrame;)Lorg/python/co
    re/PyObject;(E:\wlst\wlstOffline.py:78)
            at wlstOffline$py.call_function(ILorg/python/core/PyFrame;)Lorg/python/c
    ore/PyObject;(E:\wlst\wlstOffline.py:???)
            at org.python.core.PyTableCode.call(Lorg/python/core/PyFrame;Lorg/python
    /core/PyObject;)Lorg/python/core/PyObject;(PyTableCode.java:???)
            at org.python.core.PyTableCode.call(Lorg/python/core/PyObject;Lorg/pytho
    n/core/PyObject;[Lorg/python/core/PyObject;Lorg/python/core/PyObject;)Lorg/pytho
    n/core/PyObject;(PyTableCode.java:???)
            at org.python.core.PyFunction.__call__(Lorg/python/core/PyObject;)Lorg/p
    ython/core/PyObject;(PyFunction.java:???)
            at org.python.core.PyObject.invoke(Ljava/lang/String;Lorg/python/core/Py
    Object;)Lorg/python/core/PyObject;(PyObject.java:???)
            at org.python.pycode._pyx0.f$0(Lorg/python/core/PyFrame;)Lorg/python/cor
    e/PyObject;(testOffline.py:3)
            at org.python.pycode._pyx0.call_function(ILorg/python/core/PyFrame;)Lorg
    /python/core/PyObject;(testOffline.py:???)
            at org.python.core.PyTableCode.call(Lorg/python/core/PyFrame;Lorg/python
    /core/PyObject;)Lorg/python/core/PyObject;(PyTableCode.java:???)
            at org.python.core.PyCode.call(Lorg/python/core/PyFrame;)Lorg/python/cor
    e/PyObject;(PyCode.java:???)
            at org.python.core.Py.runCode(Lorg/python/core/PyCode;Lorg/python/core/P
    yObject;Lorg/python/core/PyObject;)Lorg/python/core/PyObject;(Py.java:???)
            at org.python.core.__builtin__.execfile_flags(Ljava/lang/String;Lorg/pyt
    hon/core/PyObject;Lorg/python/core/PyObject;Lorg/python/core/CompilerFlags;)V(__
    builtin__.java:???)
            at org.python.util.PythonInterpreter.execfile(Ljava/lang/String;)V(Pytho
    nInterpreter.java:???)
            at org.python.util.jython.main([Ljava/lang/String;)V(jython.java:???)
    java.lang.NullPointerException: java.lang.NullPointerException
    [/pre]
    Can any one tell me what might be the problem.
    Thanks                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    The domain exists.
    And the line 78 in wlstOffline.py is as follows
    77 def readDomain(domainDir):
    78 WLS.readDomain(domainDir)
    79 updateCmo()
    80 updatePrompt()

  • Exception is thrown when using JEditorPane to display html

    Hello,
    I have this basic browser to display some pages from our intranet. Here's the code for it:
    import java.awt.BorderLayout;
    import javax.swing.JPanel;
    import javax.swing.JEditorPane;
    import javax.swing.JScrollPane;
    import java.net.MalformedURLException;
    import java.net.URL;
    import java.io.IOException;
    public class BrowserPanel extends JPanel {
    private JEditorPane pane = null;
    // Constructors
    public BrowserPanel() {
    pane = new JEditorPane();
    pane.setEditable(false);
    JScrollPane sp = new JScrollPane(pane);
    sp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    setLayout(new BorderLayout());
    add(sp, BorderLayout.CENTER);
    // Methods
    public void setContent(String str) {
    StringBuffer sb = new StringBuffer(500);
    sb.append("http://local.com/cgi-bin/search.pl?arg=");
    sb.append(str);
    try {
    URL url = new URL(sb.toString());
    pane.setPage(url);
    } catch (MalformedURLException e) {
    System.err.println("Malformed URL: " + e);
    } catch (IOException e) {
    System.err.println("IOException: " + e);
    On some of the pages I get text all scrambled and the following exception comes up:
    java.lang.ArrayIndexOutOfBoundsException
    at javax.swing.text.html.TableView$RowView.layoutMajorAxis(TableView.java:1393)
    at javax.swing.text.BoxView.layout(BoxView.java:580)
    at javax.swing.text.BoxView.setSize(BoxView.java:265)
    at javax.swing.text.BoxView.paint(BoxView.java:283)
    at javax.swing.text.html.TableView$RowView.paint(TableView.java:1315)
    at javax.swing.text.html.TableView.paint(TableView.java:740)
    at javax.swing.text.BoxView.paintChild(BoxView.java:104)
    at javax.swing.text.BoxView.paint(BoxView.java:294)
    at javax.swing.text.html.BlockView.paint(BlockView.java:240)
    at javax.swing.text.BoxView.paintChild(BoxView.java:104)
    at javax.swing.text.BoxView.paint(BoxView.java:294)
    at javax.swing.text.html.BlockView.paint(BlockView.java:240)
    at javax.swing.plaf.basic.BasicTextUI$RootView.paint(BasicTextUI.java:1170)
    at javax.swing.plaf.basic.BasicTextUI.paintSafely(BasicTextUI.java:523)
    at javax.swing.plaf.basic.BasicTextUI.paint(BasicTextUI.java:657)
    at javax.swing.plaf.basic.BasicTextUI.update(BasicTextUI.java:636)
    at javax.swing.JComponent.paintComponent(JComponent.java:395)
    at javax.swing.JComponent.paint(JComponent.java:687)
    at javax.swing.JComponent.paintChildren(JComponent.java:498)
    at javax.swing.JComponent.paint(JComponent.java:696)
    at javax.swing.JViewport.paint(JViewport.java:668)
    at javax.swing.JComponent.paintWithBuffer(JComponent.java:3878)
    at javax.swing.JComponent._paintImmediately(JComponent.java:3821)
    at javax.swing.JComponent.paintImmediately(JComponent.java:3672)
    at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:370)
    at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:124)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:154)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:337)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:131)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:98)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:85)
    Many thanks for any clues on how to make it work.
    cheers,
    --JavanT                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    you should specify that this is an HTML veiwer explicitly, by writting something similar to this,
    editor.setContentType("text/html");
    kit = (HTMLEditorKit) editor.getEditorKit();
    editor.setEditorKit(kit);
    doc = (HTMLDocument) kit.createDefaultDocument();
    editor.setDocument(doc);

  • NullPointerException when using getMetaData

    Hi!
    My code :
      try {
        Class.forName("com.sybase.jdbc2.jdbc.SybDriver");
        Connection myConnection = DriverManager.getConnection("jdbc:sybase:Tds:gandalf:4100", "foo", "foo");
        PreparedStatement myStatement = myConnection.prepareStatement("SELECT ID, NAME FROM MYSMALLTABLE");
        myStatement.executeQuery();
        ResultSetMetaData metaData = myStatement.getMetaData();
        int nbCols = metaData.getColumnCount();
      } catch (Exception e) {
        e.printStackTrace();
      }My questions are : why does the getMetaData method return null? Are the 4 SQL files in the sp directory usefull for this problem?
    I use jConnect5.5 driver, Sybase 11, and jdk1.3
    Thanks for help
    Simon Pierre NOLIN

    Hi,
    There are 2 types of MetaData
    1) ResultSetMetaData -->
    ResultSetMetaData rsmd = <resultset>.getMetaData();
    2) DataBaseMetaData -->
    DataBaseMetaData dbmd = <connection>.getMetaData();
    As u r willing to get the columncount u must use ResultSetMetaData and it is got from
    ResultSet not Statement.
    Change the code like this:
    Connection myConnection = DriverManager.getConnection("jdbc:sybase:Tds:gandalf:4100", "foo", "foo"); PreparedStatement myStatement = myConnection.prepareStatement("SELECT ID, NAME FROM MYSMALLTABLE");
    ResultSet rs =myStatement.executeQuery();
    ResultSetMetaData metaData = rs.getMetaData();
    int nbCols = metaData.getColumnCount();
    With Warm Regards
    Sesh

  • Jax-ws 2.2.8 and ws-addressing: Client throwing java.lang.NullPointerException on receipt of HTTP 202 when using non-anonymous ReplyTo address

    Server: JBoss EAP 6.2.0
    Client: JDK 1.7.0_51 x64
    JAX-WS: RI 2.2.8 ( via -Djava.endorsed.dirs )
    I am getting a java.lang.NullPointerException when calling the operation on the WS endpoint from the client when using non-anonymous replyTo address.
    I have simplified the scenario into a small test case that hopefully others can replicate. Since the exception is happening on the client instead of the server, I would think that the container used is irrelevant, but I have specified it nonetheless.
    1) WebService:
    package test.webservice;
    import java.util.Random;
    import javax.jws.WebMethod;
    import javax.jws.WebParam;
    import javax.jws.WebService;
    import javax.jws.soap.SOAPBinding;
    import javax.xml.ws.soap.Addressing;
    @WebService(targetNamespace="http://services.nowhere.org/")
    @Addressing(required=true)
    @SOAPBinding(style = SOAPBinding.Style.DOCUMENT)
    public class RandomTest {
        @WebMethod
        public long nextRandom(@WebParam boolean forceException) throws Exception {
            if( forceException ) {
                throw new Exception("Some exception");
            Random rand = new Random();
            return rand.nextLong();
    2) Generated WSDL by JBossEAP 6.2.2:
    <?xml version='1.0' encoding='UTF-8'?><wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:tns="http://webservice.test/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:ns1="http://schemas.xmlsoap.org/soap/http" name="RandomTestService" targetNamespace="http://webservice.test/">
      <wsdl:types>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://webservice.test/" elementFormDefault="unqualified" targetNamespace="http://webservice.test/" version="1.0">
      <xs:element name="nextRandom" type="tns:nextRandom"/>
      <xs:element name="nextRandomResponse" type="tns:nextRandomResponse"/>
      <xs:complexType name="nextRandom">
        <xs:sequence/>
      </xs:complexType>
      <xs:complexType name="nextRandomResponse">
        <xs:sequence>
          <xs:element name="return" type="xs:long"/>
        </xs:sequence>
      </xs:complexType>
    </xs:schema>
      </wsdl:types>
      <wsdl:message name="nextRandom">
        <wsdl:part element="tns:nextRandom" name="parameters">
        </wsdl:part>
      </wsdl:message>
      <wsdl:message name="nextRandomResponse">
        <wsdl:part element="tns:nextRandomResponse" name="parameters">
        </wsdl:part>
      </wsdl:message>
      <wsdl:portType name="RandomTest">
        <wsdl:operation name="nextRandom">
          <wsdl:input message="tns:nextRandom" name="nextRandom" wsam:Action="http://webservice.test/RandomTest/nextRandomRequest" wsaw:Action="http://webservice.test/RandomTest/nextRandomRequest">
        </wsdl:input>
          <wsdl:output message="tns:nextRandomResponse" name="nextRandomResponse" wsam:Action="http://webservice.test/RandomTest/nextRandomResponse" wsaw:Action="http://webservice.test/RandomTest/nextRandomResponse">
        </wsdl:output>
        </wsdl:operation>
      </wsdl:portType>
      <wsdl:binding name="RandomTestServiceSoapBinding" type="tns:RandomTest">
        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
        <wsaw:UsingAddressing wsdl:required="true"/>
        <wsp:PolicyReference URI="#RandomTestServiceSoapBinding_WSAM_Addressing_Policy"/>
        <wsdl:operation name="nextRandom">
          <soap:operation soapAction="" style="document"/>
          <wsdl:input name="nextRandom">
            <soap:body use="literal"/>
          </wsdl:input>
          <wsdl:output name="nextRandomResponse">
            <soap:body use="literal"/>
          </wsdl:output>
        </wsdl:operation>
      </wsdl:binding>
      <wsdl:service name="RandomTestService">
        <wsdl:port binding="tns:RandomTestServiceSoapBinding" name="RandomTestPort">
          <soap:address location="http://localhost:8080/servertest/RandomTest"/>
        </wsdl:port>
      </wsdl:service>
        <wsp:Policy xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="RandomTestServiceSoapBinding_WSAM_Addressing_Policy"><wsam:Addressing><wsp:Policy/></wsam:Addressing></wsp:Policy>
    </wsdl:definitions>
    3) ant build.xml to generate the client code from WSDL
    <?xml version="1.0" encoding="UTF-8"?>
    <project default="build" basedir="..">
        <property name="jaxws.classpath" location="C://jaxws-2.2.8/jaxws-ri/lib/*.jar"/>
        <taskdef name="wsimport" classname="com.sun.tools.ws.ant.WsImport">
               <classpath path="${jaxws.classpath}"/>
        </taskdef>
        <target name="build" >
            <!-- For these to work, the JAR files in tools/jaxws-ri must be included in Ant's classpath -->
            <wsimport wsdl="http://localhost:8080/servertest/RandomTest?wsdl"
                   verbose="true"
                   sourcedestdir="src"
                   destdir="bin"
                   keep="true">
                   <xjcarg value="-enableIntrospection"/>
            </wsimport>
        </target>
    </project>
    4) Client code
    4a) ClientTest.java - Actual client run from client
    package test.wsclient;
    import java.util.ArrayList;
    import java.util.List;
    import javax.xml.ws.BindingProvider;
    import javax.xml.ws.Endpoint;
    import javax.xml.ws.handler.Handler;
    import javax.xml.ws.soap.AddressingFeature;
    import org.nowhere.services.RandomTest;
    import org.nowhere.services.RandomTestService;
    public class ClientTest {
        public static void main(String args[]) throws Exception {
            ClientTest app = new ClientTest();
            app.testAddressing();
        public void testAddressing() throws Exception {
            String REPLY_TO_ADDRESS = "http://localhost:8082/servertest/RandomCallback";
            String FAULT_TO_ADDRESS = "http://localhost:8082/servertest/RandomCallbackFault";
            RandomTestService service = new RandomTestService();
            RandomTest port = service.getRandomTestPort(new AddressingFeature());
            BindingProvider provider = (BindingProvider) port;
            // pass the replyTo address to the handler
            provider.getRequestContext().put("ReplyTo", REPLY_TO_ADDRESS);
            provider.getRequestContext().put("FaultTo", FAULT_TO_ADDRESS);
            // Register handlers to set the ReplyTo and FaultTo on the SOAP request sent to the WS endpoint
            List<Handler> handlerChain = new ArrayList<Handler>();
            handlerChain.add(new ClientHandler());
            provider.getBinding().setHandlerChain(handlerChain);
            // Start endpoint to receive callbacks from WS
            Endpoint endpoint = Endpoint.publish(REPLY_TO_ADDRESS, new CallbackSEI());
            try {
                port.nextRandom(false);
            } catch( Exception ex ) {
                ex.printStackTrace();
            } finally {
                Thread.sleep(10000);
            endpoint.stop();
            System.exit(0);
    4b) ClientHandler.java - Used to set the wsa ReplyTo address and FaultTo address when sending SOAP request from client to server
    package test.wsclient;
    import java.util.Set;
    import javax.xml.namespace.QName;
    import javax.xml.soap.SOAPEnvelope;
    import javax.xml.soap.SOAPHeader;
    import javax.xml.ws.handler.MessageContext;
    import javax.xml.ws.handler.MessageContext.Scope;
    import javax.xml.ws.handler.soap.SOAPHandler;
    import javax.xml.ws.handler.soap.SOAPMessageContext;
    import org.w3c.dom.Node;
    import org.w3c.dom.NodeList;
    public class ClientHandler implements SOAPHandler<SOAPMessageContext> {
        public ClientHandler() {};
        @Override
        public Set<QName> getHeaders() {
            return null;
        @Override
        public void close(MessageContext arg0) {
        @Override
        public boolean handleFault(SOAPMessageContext context) {
            return true;
        protected void setAnAddress(SOAPHeader header, String tagName, String address) {
            NodeList nodeListReplyTo = header.getElementsByTagName(tagName);
            NodeList nodeListAddress = nodeListReplyTo.item(0).getChildNodes();
            for (int i = 0; i < nodeListAddress.getLength(); i++) {
                Node node = nodeListAddress.item(i);
                if ("Address".equals(node.getLocalName())) {
                    node.setTextContent(address);
                    break;
        protected String getMessageID(SOAPHeader header) {
            NodeList nodeListMessageId = header.getElementsByTagName("MessageID");
            return nodeListMessageId.item(0).getTextContent();
        @Override
        public boolean handleMessage(SOAPMessageContext context) {
            Boolean isOutbound = (Boolean) context.get(SOAPMessageContext.MESSAGE_OUTBOUND_PROPERTY);
            if (isOutbound) {
                try {
                    SOAPEnvelope envelope = context.getMessage().getSOAPPart().getEnvelope();
                    SOAPHeader header = envelope.getHeader();
                    /* extract the generated MessageID */
                    String messageID = getMessageID(header);
                    context.put("MessageID", messageID);
                    context.setScope("MessageID", Scope.APPLICATION);
                    /* change ReplyTo address */
                    setAnAddress(header, "ReplyTo", (String) context.get("ReplyTo"));
                    setAnAddress(header, "FaultTo", (String) context.get("FaultTo"));
                } catch (Exception ex) {
                    throw new RuntimeException(ex);
            return true;
    4c) CallbackSEI.java - endpoint on the client for server to send the SOAP response back to the client
    package test.wsclient;
    import javax.annotation.Resource;
    import javax.jws.Oneway;
    import javax.jws.WebParam;
    import javax.jws.WebService;
    import javax.xml.ws.Action;
    import javax.xml.ws.RequestWrapper;
    import javax.xml.ws.WebServiceContext;
    import javax.xml.ws.soap.Addressing;
    @WebService
    @Addressing
    //@HandlerChain(file = "/handler-chain.xml")
    public class CallbackSEI {
        @Resource
        private WebServiceContext context;
         * If there is no namespace specified in the method below, then the CallbackSEI needs to be in the same package as the
         * WS endpoint.
        @Oneway
        @Action(input="http://services.nowhere.org/RandomTest/nextRandomResponse")
        @RequestWrapper(localName="nextRandomResponse", targetNamespace="http://services.nowhere.org/")
        public void handleNotification(@WebParam(name="return")long random) {
            System.out.println("Asynch response received");
            System.out.println( random );
            //System.out.println("This response relates to the message ID: "+ getMessageID());
    In summary:
    Server is listening on port 8080
    Client will listen in port 8082 for the callback from the server for the SOAP response
    Now when I run the client, I see that the proper behaviour as far as ws-addressing is concerned. That is:
    client  -- SOAP request ( on port 8080 ) --> server
    client <-- HTTP 202 ( empty HTTP body )  --- server
    client <-- SOAP response ( on port 8082 )  --- server
    All well and good, except that I am getting a NullPointerException on the client side when I call the operation.
    With debugging of the SOAP request and responses, I get the following output:
    ---[HTTP request - http://localhost:8080/servertest/RandomTest]---
    Accept: text/xml, multipart/related
    Content-Type: text/xml; charset=utf-8
    SOAPAction: "http://services.nowhere.org/RandomTest/nextRandomRequest"
    User-Agent: JAX-WS RI 2.2.8 svn-revision#13980
    <?xml version='1.0' encoding='UTF-8'?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><S:Header><To xmlns="http://www.w3.org/2005/08/addressing">http://localhost:8080/servertest/RandomTest</To><Action xmlns="http://www.w3.org/2005/08/addressing">http://services.nowhere.org/RandomTest/nextRandomRequest</Action><ReplyTo xmlns="http://www.w3.org/2005/08/addressing">
        <Address>http://localhost:8082/servertest/RandomCallback</Address>
    </ReplyTo><FaultTo xmlns="http://www.w3.org/2005/08/addressing">
        <Address>http://localhost:8082/servertest/RandomCallbackFault</Address>
    </FaultTo><MessageID xmlns="http://www.w3.org/2005/08/addressing">uuid:bcd2f6ef-3034-49e8-b837-dbd6a772fb93</MessageID></S:Header><S:Body><ns2:nextRandom xmlns:ns2="http://services.nowhere.org/"><arg0>false</arg0></ns2:nextRandom></S:Body></S:Envelope>--------------------
    ---[HTTP response - http://localhost:8080/servertest/RandomTest - 202]---
    null: HTTP/1.1 202 Accepted
    Content-Length: 0
    Content-Type: text/xml;charset=UTF-8
    Date: Fri, 18 Jul 2014 08:34:36 GMT
    Server: Apache-Coyote/1.1
    java.lang.NullPointerException
        at com.sun.proxy.$Proxy38.nextRandom(Unknown Source)
        at test.wsclient.ClientTest.testAddressing(ClientTest.java:43)
        at test.wsclient.ClientTest.main(ClientTest.java:18)
    ---[HTTP request]---
    Cache-control: no-cache
    Host: localhost:8082
    Content-type: text/xml; charset=UTF-8
    Content-length: 704
    Connection: keep-alive
    Pragma: no-cache
    User-agent: Apache CXF 2.7.7.redhat-1
    Accept: */*
    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Header><Action xmlns="http://www.w3.org/2005/08/addressing">http://services.nowhere.org/RandomTest/nextRandomResponse</Action><MessageID xmlns="http://www.w3.org/2005/08/addressing">urn:uuid:65d8d7fc-09e4-494a-a9c5-0a01faf4d7e6</MessageID><To xmlns="http://www.w3.org/2005/08/addressing">http://localhost:8082/servertest/RandomCallback</To><RelatesTo xmlns="http://www.w3.org/2005/08/addressing">uuid:bcd2f6ef-3034-49e8-b837-dbd6a772fb93</RelatesTo></soap:Header><soap:Body><ns2:nextRandomResponse xmlns:ns2="http://services.nowhere.org/"><return>2870062781194370669</return></ns2:nextRandomResponse></soap:Body></soap:Envelope>--------------------
    Asynch response received
    2870062781194370669
    As you can see from the output above, the proxy is throwing an Exception when it receives the HTTP 202 response.
    Any ideas ?

    I think I have found when I get this error and probably I have found a bug. I will appreciate if someone can confirm this.
    In my BPEL project setup, my BPEL process's wsdl file imports another wsdl from different namespace. Here is sample snippet -
    <wsdl:definitions targetNamespace="http://namespace/1">
    <wsdl:import namespace="http://namespace/2" location="resources/another.wsdl"/>
    <plnk:partnerLinkType....../>
    </wsdl:definitions>
    Please let me know. I checked the bundled samples with Oracle BPEL PM and did not find any similar case where process wsdl imports another wsdl.
    Thank you.
    Meghana

  • NullPointerException when validating module *.jar using WebLogic Builder

    Hi,
    When using WebLogic Builder to validate module ceiba.jar, it shows the following errors. How to fix it? Thanks a lot. Attachment is the deployment descriptors.
    Validating module ceiba.jar
    Compiling input jar D:\gzdswebproject\gzdsweb\ceiba.jar
    Processing input descriptor
    ERROR: Error processing input descriptor
    ERROR: Error from ejbc: null
    java.lang.NullPointerException     at weblogic.ejb20.deployer.SessionBeanInfoImpl.assignDefaultTXAttributesIfNecessary(SessionBeanInfoImpl.java:291)     at weblogic.ejb20.deployer.MBeanDeploymentInfoImpl.initializeTransactionAttribute(MBeanDeploymentInfoImpl.java:807)     at weblogic.ejb20.deployer.MBeanDeploymentInfoImpl.<init>(MBeanDeploymentInfoImpl.java:240)     at weblogic.ejb20.ejbc.EJBCompiler.setupEJB(EJBCompiler.java:155)     at weblogic.ejb20.ejbc.EJBCompiler.compileEJB(EJBCompiler.java:415)     at weblogic.ejb20.ejbc.EJBCompiler.compileEJB(EJBCompiler.java:397)     at weblogic.ejbc20.runBody(ejbc20.java:517)     at weblogic.utils.compiler.Tool.run(Tool.java:146)     at weblogic.utils.compiler.Tool.run(Tool.java:103)     at weblogic.marathon.tasks.EJBCTask.runBackground(EJBCTask.java:140)     at weblogic.tools.jellybeans.core.task.TaskThread.execute(TaskThread.java:127)     at weblogic.tools.jellybeans.core.task.TaskThread.run(TaskThread.java:64)

    following is the ejb-jar.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
    <ejb-jar>
    <enterprise-beans>
    <session>
    <display-name>Bblm</display-name>
    <ejb-name>Bblm</ejb-name>
    <home>com.foresee.ceiba.bbxz.BblmHome</home>
    <remote>com.foresee.ceiba.bbxz.Bblm</remote>
    <ejb-class>com.foresee.ceiba.bbxz.BblmBean</ejb-class>
    <session-type>Stateless</session-type>
    <transaction-type>Container</transaction-type>
    </session>
    <session>
    <display-name>Bbnr</display-name>
    <ejb-name>Bbnr</ejb-name>
    <home>com.foresee.ceiba.bbxz.BbnrHome</home>
    <remote>com.foresee.ceiba.bbxz.Bbnr</remote>
    <ejb-class>com.foresee.ceiba.bbxz.BbnrBean</ejb-class>
    <session-type>Stateless</session-type>
    <transaction-type>Container</transaction-type>
    </session>
    <session>
    <display-name>Fjxx</display-name>
    <ejb-name>Fjxx</ejb-name>
    <home>com.foresee.ceiba.comm.FjxxHome</home>
    <remote>com.foresee.ceiba.comm.Fjxx</remote>
    <ejb-class>com.foresee.ceiba.comm.FjxxBean</ejb-class>
    <session-type>Stateless</session-type>
    <transaction-type>Container</transaction-type>
    </session>
    <session>
    <display-name>Yhzxx</display-name>
    <ejb-name>Yhzxx</ejb-name>
    <home>com.foresee.ceiba.comm.YhzxxHome</home>
    <remote>com.foresee.ceiba.comm.Yhzxx</remote>
    <ejb-class>com.foresee.ceiba.comm.YhzxxBean</ejb-class>
    <session-type>Stateless</session-type>
    <transaction-type>Container</transaction-type>
    </session>
    <session>
    <display-name>GsbsProcess</display-name>
    <ejb-name>GsbsProcess</ejb-name>
    <home>com.foresee.ceiba.gsbs.ejb.GsbsProcessHome</home>
    <remote>com.foresee.ceiba.gsbs.ejb.GsbsProcess</remote>
    <ejb-class>com.foresee.ceiba.gsbs.ejb.ejb.GsbsProcessBean</ejb-class>
    <session-type>Stateless</session-type>
    <transaction-type>Container</transaction-type>
    </session>
    <session>
    <display-name>BGDJ</display-name>
    <ejb-name>BGDJ</ejb-name>
    <home>com.foresee.ceiba.swdj.bg.BGDJHome</home>
    <remote>com.foresee.ceiba.swdj.bg.BGDJ</remote>
    <ejb-class>com.foresee.ceiba.swdj.bg.BGDJBean</ejb-class>
    <session-type>Stateless</session-type>
    <transaction-type>Container</transaction-type>
    </session>
    <session>
    <display-name>PersonalRegister</display-name>
    <ejb-name>PersonalRegister</ejb-name>
    <home>com.foresee.ceiba.swdj.gr.PersonalRegisterHome</home>
    <remote>com.foresee.ceiba.swdj.gr.PersonalRegister</remote>
    <ejb-class>com.foresee.ceiba.swdj.gr.PersonalRegisterBean</ejb-class>
    <session-type>Stateless</session-type>
    <transaction-type>Container</transaction-type>
    </session>
    <session>
    <display-name>ProjectRegister</display-name>
    <ejb-name>ProjectRegister</ejb-name>
    <home>com.foresee.ceiba.swdj.xm.ProjectRegisterHome</home>
    <remote>com.foresee.ceiba.swdj.xm.ProjectRegister</remote>
    <ejb-class>com.foresee.ceiba.swdj.xm.ProjectRegisterBean</ejb-class>
    <session-type>Stateless</session-type>
    <transaction-type>Container</transaction-type>
    </session>
    <session>
    <display-name>SqjlCjwtLm</display-name>
    <ejb-name>SqjlCjwtLm</ejb-name>
    <home>com.foresee.ceiba.sqjl.SqjlCjwtLmHome</home>
    <remote>com.foresee.ceiba.sqjl.SqjlCjwtLm</remote>
    <ejb-class>com.foresee.ceiba.sqjl.SqjlCjwtLmBean</ejb-class>
    <session-type>Stateless</session-type>
    <transaction-type>Container</transaction-type>
    </session>
    <session>
    <display-name>SqjlCjwtNr</display-name>
    <ejb-name>SqjlCjwtNr</ejb-name>
    <home>com.foresee.ceiba.sqjl.SqjlCjwtNrHome</home>
    <remote>com.foresee.ceiba.sqjl.SqjlCjwtNr</remote>
    <ejb-class>com.foresee.ceiba.sqjl.SqjlCjwtNrBean</ejb-class>
    <session-type>Stateless</session-type>
    <transaction-type>Container</transaction-type>
    </session>
    <session>
    <display-name>Xxlm</display-name>
    <ejb-name>Xxlm</ejb-name>
    <home>com.foresee.ceiba.xxfb.XxlmHome</home>
    <remote>com.foresee.ceiba.xxfb.Xxlm</remote>
    <ejb-class>com.foresee.ceiba.xxfb.XxlmBean</ejb-class>
    <session-type>Stateless</session-type>
    <transaction-type>Container</transaction-type>
    </session>
    <session>
    <display-name>Xxnr</display-name>
    <ejb-name>Xxnr</ejb-name>
    <home>com.foresee.ceiba.xxfb.XxnrHome</home>
    <remote>com.foresee.ceiba.xxfb.Xxnr</remote>
    <ejb-class>com.foresee.ceiba.xxfb.XxnrBean</ejb-class>
    <session-type>Stateless</session-type>
    <transaction-type>Container</transaction-type>
    </session>
    <session>
    <display-name>ZCDJ</display-name>
    <ejb-name>ZCDJ</ejb-name>
    <home>com.foresee.ceiba.swdj.zc.ZCDJHome</home>
    <remote>com.foresee.ceiba.swdj.zc.ZCDJ</remote>
    <ejb-class>com.foresee.ceiba.swdj.zc.ZCDJBean</ejb-class>
    <session-type>Stateless</session-type>
    <transaction-type>Container</transaction-type>
    </session>
    </enterprise-beans>
    <assembly-descriptor>
    <container-transaction>
    <method>
    <ejb-name>Bblm</ejb-name>
    <method-name>*</method-name>
    </method>
    <trans-attribute>Required</trans-attribute>
    </container-transaction>
    <container-transaction>
    <method>
    <ejb-name>Bbnr</ejb-name>
    <method-name>*</method-name>
    </method>
    <trans-attribute>Required</trans-attribute>
    </container-transaction>
    <container-transaction>
    <method>
    <ejb-name>Fjxx</ejb-name>
    <method-name>*</method-name>
    </method>
    <trans-attribute>Required</trans-attribute>
    </container-transaction>
    <container-transaction>
    <method>
    <ejb-name>Yhzxx</ejb-name>
    <method-name>*</method-name>
    </method>
    <trans-attribute>Required</trans-attribute>
    </container-transaction>
    <container-transaction>
    <method>
    <ejb-name>GsbsProcess</ejb-name>
    <method-name>*</method-name>
    </method>
    <trans-attribute>Required</trans-attribute>
    </container-transaction>
    <container-transaction>
    <method>
    <ejb-name>BGDJ</ejb-name>
    <method-name>*</method-name>
    </method>
    <trans-attribute>Required</trans-attribute>
    </container-transaction>
    <container-transaction>
    <method>
    <ejb-name>PersonalRegister</ejb-name>
    <method-name>*</method-name>
    </method>
    <trans-attribute>Required</trans-attribute>
    </container-transaction>
    <container-transaction>
    <method>
    <ejb-name>ProjectRegister</ejb-name>
    <method-name>*</method-name>
    </method>
    <trans-attribute>Required</trans-attribute>
    </container-transaction>
    <container-transaction>
    <method>
    <ejb-name>SqjlCjwtLm</ejb-name>
    <method-name>*</method-name>
    </method>
    <trans-attribute>Required</trans-attribute>
    </container-transaction>
    <container-transaction>
    <method>
    <ejb-name>SqjlCjwtNr</ejb-name>
    <method-name>*</method-name>
    </method>
    <trans-attribute>Required</trans-attribute>
    </container-transaction>
    <container-transaction>
    <method>
    <ejb-name>Xxlm</ejb-name>
    <method-name>*</method-name>
    </method>
    <trans-attribute>Required</trans-attribute>
    </container-transaction>
    <container-transaction>
    <method>
    <ejb-name>Xxnr</ejb-name>
    <method-name>*</method-name>
    </method>
    <trans-attribute>Required</trans-attribute>
    </container-transaction>
    <container-transaction>
    <method>
    <ejb-name>ZCDJ</ejb-name>
    <method-name>*</method-name>
    </method>
    <trans-attribute>Required</trans-attribute>
    </container-transaction>
    </assembly-descriptor>
    </ejb-jar>

Maybe you are looking for

  • Custom report generation

    The program I'm working on has to create a test report. I use an Office-XP word document, provided by my client, as pattern for this report, in which strings, tables and graphs from my program are to be inserted. My program is made using LabWindows/C

  • Oracle Cluster Best Practice

    Is there a "Best Practice" to follow concerning Oracle and clustering. Currently we are using VCS trying to cluster a box running one Oracle engine and multiple instances. This is not working well. Is it best to cluster a box running one Oracle engin

  • NI ELVISmx Instrument Launcher Error in Windows 7

    I am using windows 7. I have LabView 2011 installed. I also installed NI ELVISmx  4.2.2 but when i try running the Instrument Launcher i get the following error : Description: Stopped working Problem signature: Problem Event Name: CLR20r3 Problem Sig

  • 01_2008_Welcome_01.png error

    When using iWeb on my MacBook Pro, I get a... PUBLISH ERROR Can't create the file "01_2008_Welcome_01.png." The disk may be damaged or full, or you may not have sufficient access privileges. Any suggestions?  I've tried redoing all pages w/ no luck y

  • Mail[355]*** Assertion failure

    Have just noticed a bunch of these in my console and not sure what (if anything) I can do ? Thoughts ? 19/05/2010 20:39:26 Mail[355] * Assertion failure in -[IMAPToDoStoreReconciliationAgent prepareToReconcileForMailboxID:], /SourceCache/Message/Mess