EJB / EE :: Java JAX-WS Client NullPointerException
Aug 26, 2014
I'm new to web services. Right now i'm trying to consume JAX-WS web service on IBM WebSphere Application Server 7. Sending SOAP message with security header[username, password] parameters. Getting NullPointerException..
Exception :
javax.xml.ws.WebServiceException: java.lang.NullPointerException
at org.apache.axis2.jaxws.ExceptionFactory.createWebServiceException(ExceptionFactory.java:175)
at org.apache.axis2.jaxws.ExceptionFactory.makeWebServiceException(ExceptionFactory.java:70)
at org.apache.axis2.jaxws.ExceptionFactory.makeWebServiceException(ExceptionFactory.java:128)
at org.apache.axis2.jaxws.marshaller.impl.alt.DocLitBareMinimalMethod
Marshaller.demarshalFaultResponse(DocLitBareMinimalMethodMarshaller.java:443)
at org.apache.axis2.jaxws.client.proxy.JAXWSProxyHandler.getFaultResponse(JAXWSProxyHandler.java:559)
at org.apache.axis2.jaxws.client.proxy.JAXWSProxyHandler.createResponse(JAXWSProxyHandler.java:497)
at org.apache.axis2.jaxws.client.proxy.JAXWSProxyHandler.invokeSEIMethod(JAXWSProxyHandler.java:404)
I have tried each and every thing in all the other answers. Like setting chunked to false, changing parameters, changing http1.1 -1.0. I am just writing a sample client to compare it with my real time client. Following is the code of client:
package com.webservicemart.ws; import java.rmi.RemoteException; import org.apache.axis2.AxisFault; import com.webservicemart.ws.USZipStub.ValidateZip; public class UsZipClient { public static void main(String[] args) {
[Code] ....
And Following is the error :
[INFO] Unable to sendViaPost to url[http://www.webservicemart.com/uszip.asmx] org.apache.axis2.AxisFault: Transport error: 404 Error: Not Found at org.apache.axis2.transport.http.HTTPSender.handleResponse(HTTPSender.java:310) at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:194) at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:75)
[Code] ....
I have tried with other geoIP service and weather forecast too. I get the same error.
I'm working on an assignment right now which involves passing a variable series of numbers to the Server to be sorted into the correct order and returned to the client.
So far I have it connecting to the server and asking for my numbers, and I am entering each number and pressing return, and it is accepting each number individually.
One (smaller I think) problem i'm having is with the client code, specifically the while loop.. I've tried to code it so that when I enter a full stop ('.') the program will stop asking me for more numbers and move on to sending them to the server.. but instead it just crashes giving an error.. heres an example
"Enter a number: 1 Enter a number: 3 Enter a number: 2 Enter a number: 1. java.lang.NumberFormatException: For input string: "1." at java.lang.NumberFormatException.forInputString(Num berFormatException.java:65)
[Code] ....
Here's the client code in full
package numberSortprogram; import java.io.*; import java.net.ServerSocket; public class NumSortClient { public static void main(String[] args) { InputStreamReader is = new InputStreamReader(System.in); [Code] ....
The big problem that I have is figuring out how to send the sorted array back to the client..
So, what im trying to get to happen is-
-Client is asked to enter numbers -Client enters series of numbers into an array -Array is converted to a string and sent to the server -String is then split into an array of strings and sorted using compareTo (don't know if this is the best way?) -Sorted array is sent back to client and displayed.
fyi this is making use of streamsockets..
All of the rest of my code is below:
package numberSortprogram; import java.io.IOException; import java.net.*; import java.util.regex.PatternSyntaxException; public class NumSortServer { public static void main(String[] args) { int serverPort = 4444; // default port if (args.length == 1 )
For a shool assignment i have to create a java irc client. which responds to commands. the !SENDMSG command has two parameters !SENDMSG <username> <the message>.
i can get the username and the message seperated, but i would like to create a check in case someone gives a bad command like: !SENDMSG" " <-- note te extra spaces, or if someone gives only 1 parameter.
I am currently writing two java classes (client and server). The client takes an input number form keyboard and sends it to the server. The server then multiplies this number by two and sends it back to the client. The numbers should also be printed to screen along the way, for example if I input the number 3 I should get
"From Client: 3" "From Server: 6"
They should continuously do this unless a negative number is received by the client, say for example the number -3 is sent to the server and it returns -6.
The code I have for the two classes so far is:
import java.io.*; import java.net.*; import java.nio.ByteBuffer; import java.util.Scanner; class Client { public static void main(String args[]) throws Exception { DatagramSocket clientSocket = new DatagramSocket();
[Code] .....
Currently, when I run the program all I get is an output of the number first entered. I am aware it requires a loop but I don't know where and what the condition should be.
Also if I wanted to adapt this so that it would take the integer from client and subtract two at the server and return to client who sends back to server to keep subtracting two unless it reaches a negative number at which point the client will terminate the program - how might I do this.
I do realise there needs to be a while loop in the above code, but I wanted to test it sent the number from client to server and its not doing it. All I get is a print screen of 'enter number' and then the number I enter.
I have created a sample java web service client using Apache Axis. It works well with basicHTTPbinding (without security and Basic authentication).I am not able to make a secured communication. How to make it work in a secured way using NTLM or any other security.
ejb. Using Eclipse and Jboss server. I've deployed an EJB and now want to invoke it using a standalone java program. I know that Eclipse and JBoss do some job to bind JNDI names. I just want to know that how to lookup EJB by which JNDI binding out of 6 options available (shown in deployment console) there.
Here I'm dropping all my java code and server/console logs...
public class CharCountingStudy { public static void main(String[] args) throws FileNotFoundException{ Set<FileExaminer> examiners = new LinkedHashSet<>(); examiners.add(new FileExaminer("raven.txt")); examiners.add(new FileExaminer("jabberwocky.txt"));
[Code] ....
I keep getting a NullPointerException at the "examiners.add(new FileExaminer("raven.txt"));", the "calculateCharCountAlpha();", and the "if (charCountAlpha.containsKey(w)){"and I don't know why it is doing that.
I worked on this simple client server chat app and it worked now for my project i needed to work on client server audio streaming broadcast but i dont really know much bout audio api and methods on java...
We are making a Rational Number class. After that we must create client code to test it out. The instructions-
•Create 3 instances of RationalNumber. Remember every time you say “new” you are creating an instance. oOne of them should use the default constructor oOne of them should use the constructor with one parameter oOne of them should use the concstructor with two parameters. •Print out the int and double value of each Rational Number •Print out the sum (as a double) of all the numbers. •Print out the sum (as an int) of all the numbers.
My rational number class :
public class RationalNumber{ private int numerator; private int denominator; public RationalNumber() { numerator =1; denominator = 4;
I have a doubt about how to design a web application which has their persistent objects in a service layer in a remote server, i mean a business application. So, once we have a web application as a client of this remote business application, how those persistent objects should be mapped in web front?
Should I either pack all jpa annotated classes into the web front application or there is another neat way to do this? I was intending in copy all persistent classes present in the remote business application into the web app package, i know it's not the best way to get what i need.
What is a more appropriate design for a web application which must get some objects from a remote business application and persist some other objects there?
I am using EJB (Stateless) without any web service. I simply need to send a String from Client to Server
I can connect any Java SE Client with this EJB. But how I can connect an Android Client with this EJB (i.e. Using EJBRemote Interface) directly? I am using :
How to get the client windows login name in server using JAVA those who access the site? I used the following code, but im getting only local machine name . getRemoteUser() is returning null value. I am using tomcat server. Is there anything to do with windows IIS configuration??
I am getting a NullPointerException Error and I cannot seem to figure out what is causing it. I am reading in a grades1.dat text file and putting the values into a 2D array. The error is occuring in my addGrade method, but I am not sure what the error is. Here are the values for my grades1.dat that I am running in through Run Arguments in JGRASP.
Student1 5 a Activities 0.05 q Quizzes 0.10 p Projects 0.25 e Exams 0.30 f Final 0.30 a100 a95 a100 a100 a100 q90 q80 q100 q80 q80 r90 p100 p95 p100 p85 p100 e77.5 e88 f92
Here are the errors that I am getting.
Exception in thread "main" java.lang.NullPointerException at GradeBook.addGrade(GradeBook.java:114) at GradeBookApp.main(GradeBookApp.java:55) import java.util.Arrays; /** * Stores students name, a char array of category codes, a String array of categories, a double array of category weights, and a two dimensional double array of grades where each row contains all the grades in a particular category.
I have been playing around with my code, but how to avoid NullPointerexception.. So my program's point is simple, use Jsoup to scrape html of certain webpage, then i search the things i want and print them out. Problem is, when scraped html doesnt contain even 1 thing on my search list, i get NullPointerException... i understand why, Heres part of my code:
Java Code:
//Things i need to search from html String[] MySearchArray = new String[]{"138","146","474"}; //Search things contained in MySearchArray and print them out for (String Ml : MySearchArray) { Element flights = doc.select(String.format("tr:contains(%s)", Ml)).first(); Elements flights2 = flights.select("td"); System.out.println(flights2.get(4).text() + " " + flights2.get(0).text()+ " " + flights2.get(3).text()); } mh_sh_highlight_all('java');
Firstly, my code is just a demo of my multiplayer game (2 or more players can play simultaneously) to demonstrate my problem without any extra things. I have successfully implemented peer-to-peer (P2P) communication in my game. Later, I decided to add support for client-server communication (ie a central server which is also a player) in my game. It should be much easier than P2P. Now here is the problem:
Suppose, I have 1 server and some clients (may be 1 or more clients). They all should give the following output:
Starting... A B C E F ... ... Done!
They all give the above output without using multi-thread. But using multi-threading, it gives the above output only when there're 1 server and 1 client. I'm using 2 threads (1 for sending, 1 for receiving) for each Socket. That means, each client has only 2 threads for communication but the server has (2 * totalClients) threads.
I've attached my full test project. So, here I'm only showing my 2 thread classes.
ReceiveThread class: class ReceiveThread extends Thread { private ObjectInputStream receiveStream; private BlockingQueue<Character> queue = new ArrayBlockingQueue<Character>(Common.totalClients);
[Code] ....
Since I've attached my full test project, I'm not showing the other 3 classes. They are ServerMain, ClientMain and Common. If I've 2 clients to be connected, then I get the following output:
Server: (Runs first)
Starting... A Client 1 (clientID is 1): (Runs after the server)
Starting... A B B Client 2 (clientID is 2): (Runs after Client 1)
Starting... A
They are stuck at there, even no exception. Actually, the server and the clients are stuck at the line try { ch = queue.take(); } if more than 1 client are connected. It seems that all are trying to receive data. But without using the dedicated threads, they all work as expected even for more than 1 client. Why is this behaviour? How to solve it? Note that I have used the same SendThread and ReceiveThread classes by which I have succcessfully implemented P2P communication.
About my attached test project file:
It has 5 small .java files for the classes as stated above. It is currently faulty when using additional threads. You have to change clientID variable for each client (they are described inside). But it works as expected without additional threads. To test it without the additional threads:
Comment " TODO" linesUncomment the single lines just after " TODO" linesComment the additional thread construction lines (4 lines)
Currently, for a workaround, I'm not using the dedicated threads for sending and receiving data only for client-server communication in my multi-player game. But I'm still using these threads for P2P communication. I don't know why it is and how to solve it.This is the attached test project file as described above.
/** * This method displays all winner names for a given year. * @param year is the integer parameter asked of the user. */ public void displayAllWinnersForYear (int year) { if (year >= 1993 || year <= 2009) { String[] winnersForTheYear = nobelPrizeWinners.get(year); for (int i = 0; i < winnersForTheYear.length; i++) {
[Code] ....
When year is outside the 1993-2009 range, I get a NullPointerException from line 10. Shouldn't it be skipped entirely since the conditions of its parent IF statement (line 7) is not met?
Am new to programming and am trying to create a system that is similar to a train timetable system.I want the user to be able to enter the stops between two stations ( from a preset list of 5 stations ) and this be saved as an array list, and this array list be saved accordingly within a 2D array so if they were to look in [1][2] there would be an arraylist of stops between station 1 and 2.I used this to initialise the array of arraylists (in a class i created called stops)
public void stops(){ for (int i = 0; i<5; i++){ for (int j=0; j<5; j++){ stopsArray[i][j]= new ArrayList<String>(); } } }
Then I use this code to set the stops
public void setNoStops(int stopsNo){ noOfStops = stopsNo; }
[code]...
The bottom written line of code is mentioned in the null pointer error I recieve. Then.Then in my main programme I declare the new object and use these methods the method options displays the list of five stations with a number reference
System.out.println("Please choose a start station :"); options(); place1 = scanner.nextInt(); System.out.println();
System.out.println("Please choose an end station :"); options(); place2 = scanner.nextInt(); System.out.println();
[code]...
mystops is the object I created to store the information.
when compiling I recieve no errors.when I run the program it runs smoothly, asks for the number of stops, allows the user to enter a number, then says enter stop 1, I enter a word and the program crashes giving the error java.lang.NullPointerException
I am having some problems with some code and I need an extra set of eyes. It appears I've missed something. I am getting a NullPointerException with a Hashtable object, which I can clearly see I've created. So I'm not quite sure why it is happening. I am pretty sure it is do with the code I've posted because I've tested everything else involved.Here is the code where it happens,
I recently switched some of code around to restructure how some things were working but now when I run the program I am getting a NullPointerException in multiple areas. I suspect it may have something to do with a constructor. I am very new to "object" - ish based programming.
I figured I should give a little background on the program, this program is reading from a text file of names and decade numbers(for each name) and storing each line into an object array. From there, there are menus and based on the users decision they can type a name and get a histogram, compare names with histograms, ect. Below this main method, I have provided the area where I have gotten the null pointer exception.
Here is the main method for the Client "nameApp"
Also excuse the formatting and curly braces for now!
And here is the method in the same Client that is getting the null pointer exception:
The pointer exception is on line 6 which is:
if (nameInput.equalsIgnoreCase(list[i].getName())){ private static int checkListArray(String nameInput, Name[] list){ int nameLocation = -1; int listLength = list.length;
I have an arraylist, list, that I need to take the size to declare an array, arr3, in another class. Problem 1: the size is giving me an error of "can not make static reference to non-static method getListSize() from the type FindItemInfo". I tried to change getListSize() to static and it gives me and error another place. I try to then fix that, and I get a new error... and so on.
I am using arr3 to store items the user can not afford. I have this next problem even when I input an integer for the arr3 size. I am getting a NullPointerException, and I can't figure out why the arr3[] is not loading. I tried debugging but can not figure out where I went wrong, especially since this code was working in the last assignment before I changed list[] to an arrayList. It always breaks at line 64, but I believe it has to be somewhere in the cashOut() method.
Relevant code is:
public class FindItemInfo implements InterfacePrint{ ArrayList <ItemAttribute> list = new ArrayList<ItemAttribute>(); //does stuff public void printPriority(){ TransactionCalc finish = new TransactionCalc();