Java is a platform-independent, object-oriented programming language and run-time environment, designed to have as few implementation dependencies as possible such that developers can write one set of code across all platforms using libraries. Most devices will not run Java natively, and require a run-time component to be installed in order to execute a Java program.

Share tech news, updates, or what's on your mind.

Sign up to Post

I'm getting a 400 Bad Request Error after calling a Java web service through C#.  I'm using Visual Studio 2015.  I got the WSDL file from the client and I added the file as a service reference in my solution.

Here is my app.config settings:
      <source name="System.ServiceModel.MessageLogging">
          <add name="messages"
          initializeData="c:\logs\messages.xml" />

          <binding name="CoreSoapPortBinding">
            <security mode="Transport">  
              <transport clientCredentialType="Certificate"/>  
        <endpoint address="https://xxxxxxxxx/ESARWS/CORETransactionService"
            binding="wsHttpBinding" bindingConfiguration="CoreSoapPortBinding"
            contract="ESAR.CORETransaction" name="CoreSoapPort" behaviorConfiguration="endpointCredentialBehavior" />

Open in new window

Free Tool: Port Scanner
LVL 12
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 * Add your code in the space below the comment line that says:
 * "*** Add your code BELOW this line (do not change ANYTHING above this line"
 * Do not change ANYTHING in the main method give below.
 * Write a good javadoc comment for EVERY method that you write.  Include one
 * or two sentences that give a good overview of what the method does, plus
 * the @param and @return directives (when appropriate).
 * The output your program should be exactly the same output as shown in the
 * sample output, including the same spacing, same placement of commas and
 * periods, upper and lowercase, etc.
 * Use good, descriptive variable names where appropriate.
 * Your code will be run against the main method as shown below, and also
 * against a different main method that will test your code more completely.
 * You should therefore test your code as fully as possible.
 * You do not need to define "public static final" values for the constants
 * (not required, but you can practice defining those if you wish).
public class ManyMethods {

     * Students should write method definitions for the all of the
     * methods called in this main method.  The code in the main method
     * should be left EXACTLY as it is.
     * @param args the command line arguments (not used in this program)
    public static void main(String[] args) {
        // The add method takes in two integers and returns …
I am working on a signature app that needs to save a copy of the signature as an image on the server. I am using and visual studio. The javascript I am using will give me a dataurl, but I need to be able to save this as an image on the server. I want to capture the current date and time of the signature as the filename, and be able to save a record of this filename to a column of one of my SQLtables so that I can associate the image with the customer in question. What is the best way to accomplish this? I am still somewhat new to javascript so a step-by-step or an example would be very helpful. If I get the dataurl to a serverside control then I do know how to save it, but because it is javascript/ client side I am stuck. Below is part of the script I am using which shows where I have gotten so far in getting the dataurl:

<script type="text/javascript">
$(document).ready(function() {
    var signaturePad = new SignaturePad(document.getElementById('signature-pad'), {
        backgroundColor: 'rgba(255, 255, 255, 0)',
        penColor: 'rgb(0, 0, 0)'
    var saveButton = document.getElementById('save');
    var cancelButton = document.getElementById('clear');

    saveButton.addEventListener('click', function (event) {
        var dataurl = signaturePad.toDataURL('image/png');

        // Save image to server or pass dataurl to server-side control.

    cancelButton.addEventListener('click', function (event) {
I have A xml File Where I have to Search <correspondenceTo>(.*?)</correspondenceTo>,if This tag is There Then we have to find in bettween <email> tag and cheak <Email> have in this format or not,<email>:&#x000A0;<email>,if not throw error

public void checkEntityTag(XMLContext xmlContext)throws Exception

                       System.out.println("journal name is"+CheckContent1.getFilePath());
                       File file=new File(CheckContent1.getFilePath());
                       BufferedReader b=new BufferedReader(new FileReader(file));
                       String readLine = "";
                        System.out.println("Testing checkEntityTag ");
                          Pattern  pat= Pattern.compile("<correspondenceTo>(.*?)</correspondenceTo>",Pattern.DOTALL);
                         while ((readLine = b.readLine()) != null) {
                                Matcher m=pat.matcher(readLine);
                	System.out.println(" Non Breakable Entity is missing in between Word \"+\"\\\"email\\\"\"+ \"and tag\" +\"\\\"&lt;email&gt;\\");

Open in new window

I'm using C# to call a Java Web Service.  I'm using Visual Studio 2015 The company gave me wsdl file and I generated the proxy class for wse 3.  I don't know WCF so I did it in wse 3

Here is my  app.config file

<?xml version="1.0" encoding="utf-8" ?>
		<section name="microsoft.web.services3" type="Microsoft.Web.Services3.Configuration.WebServicesConfiguration, Microsoft.Web.Services3, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
				<add valueType="">
					<sessionKeyAlgorithm name="AES128" />
					<keyAlgorithm name="RSAOAEP" />
			<x509 storeLocation="CurrentUser" />
				<add type="Microsoft.Web.Services3.Security.Tokens.EncryptedKeyTokenManager, Microsoft.Web.Services3, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35" namespace="" localName="EncryptedKey">
					<keyAlgorithm name="SHA2" />
			<trace enabled="true" input="InputTrace.webinfo" output="OutputTrace.webinfo" />
			<detailedErrors enabled="true" />
		<policy fileName="wse3policyCache.config" />
			<mtom clientMode="On" serverMode="always" />

Open in new window

Create an EmployeeException class whose constructor receives a String that consists of an Employee’s ID and pay rate.  Create an Employee class with two fields, IDNum and hourlyWage.  The Employee constructor requires values for both fields.  Upon construction, throw an EmployeeEception if the hourlyWage is less than 6.00 or over 50.00.  Write a test program (containing main method) that establishes at least three employees with hourlyWages that are above, below, and within the allowed range.
Tomcat 6 TLS1.2 enabled but still using SSL2 when opening an HTTP connection

Greetings, newbie here, so I might need help formatting the question properly.

I have a application running under Tomcat 6 that needs to run TLSv1.2.
I have install the JAVA runtime edition 6.0.181 which supports TLSv1.2.
I have configured the server.xml file to use TLSv1.2 with connections to clients and wireshark shows TLSv1.2 connections to the client when they are loading pages. But one of the pages makes an API call by opening a HttpURLConnection which also needs to use TLSv1.2 and I am unable to make that work. Wireshark shows that outgoing API call as SSLv2 and the Tomcat log show an "Connection reset" error.

This is the server.xml connector that comes so close.

                                port=”443” maxThreads=”200”
                                scheme=”https” secure=”true” SSLEnabled=”true”
                                SSLVerifyClient=”optional” sslEnabledProtocols=”TLSv1.2”/>

Here is the httpconnection code that needs to use tlsv1.2 to work:

String url = " https://www.tlsv12testsite/ ";  

            String agent = "Mozilla/4.0";
            String type = "application/x-www-form-urlencoded";
Any help would be greatly appreciated.  I'm attempting to compile sample code provided by Chase Paymentech.

The command that I'm running is "javac -classpath /home/danp/JPMC_MSDK_1.0.0/src".  I receive a bunch of errors saying that a bunch of packages don't exist.

The missing package messages include "error: org.apache.log4j does not exist".  I do have log4j, but it's located elsewhere on my server (not in org.apache).  

How can I point the compiler to  use log4j in the directory where it's already residing?

I'm calculating values (based on input from one JSP) in a method in my Controller class and trying to pass it to another different JSP page using ModelAndView but I'm getting a weird `NumberFormatException` that I think refers to the value at line 249 from error below, ` 249:    <c:out value="${housepricesList.housePrice}"/>`:
    java.lang.NumberFormatException: For input string: "housePrice"

Open in new window

as well as another exception:
    2018-03-19 12:39:14.439 ERROR 2452 --- [nio-8080-exec-9] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [An exception occurred processing JSP page /houseprice.jsp at line 249

    248: <c:forEach items="${housepricesList}" var="HousePrice">     
    249:    <c:out value="${housepricesList.housePrice}"/>
    250:    <c:out value="${housepricesList.number_of_houses}"/>
    251: </c:forEach>

Open in new window

I'm getting a latitude and longitude from one JSP page, passing it to a method in my Controller where I use the lat & long values to query a database to return house prices within a 1km radius of initial latitude and longitude. I want to pass this returned information (`housePrice` and `number_of_houses`) to another JSP page. However the page won't load and the errors above are displayed in the console.

Controller Class
    	@RequestMapping(value = "/parseHousePrice", method = RequestMethod.POST)

Open in new window

I ran across some python code that allows continuous, live plotting of twitter stream data and sentiment rating. When the author of the code demonstrated it on Youtube, he was able to plot the twitter in a graph, and the graph updated  with each tweet. However, when I run the same code, I get one graph for each tweet and the plot points do not form a continuous line--instead the output consists of one graph, one plot point for each tweet. I would like to  get the graph to show the plotted point for all tweets in one chart in a continuous line.

BTW I am not the  only person who ran into this same problem with the code.  FYI I am currently running python 2.7,  in a Spyder 3.2.8 development environment on Mac.  I have attached the code (without access key information) and it has not been altered form the author's version. Any assistance would be greatly appreciated.

Train for your Pen Testing Engineer Certification
LVL 12
Train for your Pen Testing Engineer Certification

Enroll today in this bundle of courses to gain experience in the logistics of pen testing, Linux fundamentals, vulnerability assessments, detecting live systems, and more! This series, valued at $3,000, is free for Premium members, Team Accounts, and Qualified Experts.

I had this question after viewing mapAB Challlenge.

after execution of the above code i am getting the following error
java uses unchecked or unsafe operations.

Note: Recompile with -Xlint:unchecked for details.
Writing a small GUI programme, and coming across a Warning (which I have suppressed / got rid of but ) which I don't understand :

warning: [path] bad path element "C:\EE_Q_CODE\packg": no such file or directory

I'm not referencing anything requiring resources in that non-existent folder, neither are there any jars or classes that are missing. So where is the idea coming from that this folder is required? Never seen such a phenomenon before.

As I say, I have got rid of the warning, (presently by adding an empty dir "packg" into the directory structure), but I'd very much like to know where the requirement for this is coming from. Any ideas please?
I need to read any type of file
encode it using huffman
decode it using huffman
MD5  Sum should match after decoding

only condition is the encoded file should have less size than original file
can anyone help me with that it can be done in java or C++
how to convert ArrayList Object in to byte[] ?
facade project has manager class calling a below adapter.createRequest method on Adapter class

Class MAnager{
adapter.createRequest(arg1, arg2)


Class Adaptert

createRequest(arg1, arg2){


when i did "call hierarchy by doing control+alt+H on createRequest of Class Adapter i get error
The resource is not on the build path of a java project

facade project is included in one other high level project called XYZ under that there is facade, data, client, webservice etc sub projects there.

IF I do "call hierarchy by doing control+alt+H" itr does show below method in Call Hierarchy view Class MAnager{

I wonder why i got that error in above case not in below case?

Please advise
i'm trying to reload user privileges dynamically.

i'm trying to achieve custom authorization mechanism via MethodSecurityExpressionOperations or GrantedAuthority to secure the URL and authorize the URL based on the conditions.

i come across two flavours of Spring to handle this one is via MethodSecurityExpressionOperations and the other is via GrantedAuthority - createAuthorityList

i am not sure which one is better and which one to be used in the case of dynamic reloading of user privileges where one user privilege has been updated by another user dynamically while the user is working on...

Difference between Servlet Filter vs Spring Security Filter ?

Some says security filter just authenticates the user, where as servlet filter authorizes the request

Need code snippet to understand the structure of both and the differences.
i have entities like below


how to find corresponding  foreign special character.

Please advise

I am a coldfusion developer.  I have a probably dumb question.  If we want to create some JAVA we apps, would we be able to run those on our coldfusion server?

I know that CF runs on Java, so I am guessing the answer is yes, but am unsure.

Are there java web servers?  Or do people run java on IIS, APache, etc?

Thanks for any info.

Free Tool: Subnet Calculator
LVL 12
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Can I use a JDbC Type 4 driver to allow the  'Application' to fail over to the standby DB if the connection has been lost to the Primary

Can I use the this JDBC Type 4 driver with a Oracle Data Guard with a Primary / Standby (not a RAC) for versions 11.2 and higher ?

Spring Boot Version: 2.0
Spring Version: 5.0.4

Facing the following issues on trying to implement AccessDecisionManager

1. When used

public class WebConfig implements WebMvcConfigurer

Issue:  uanble to override protected void configure(HttpSecurity http) throws Exception {

2. When used

public class WebConfig extends WebSecurityConfigurerAdapter {

Issue: unable to override the following

a. public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) {
b. public void addResourceHandlers(ResourceHandlerRegistry registry) {
c. public void addInterceptors(InterceptorRegistry registry) {

3. Throws error "java.lang.IllegalStateException: No ServletContext set" when used as below

public class WebConfig extends WebSecurityConfigurerAdapter implements WebMvcConfigurer {

URL for reference:

public AccessDecisionManager accessDecisionManager() {
    List<AccessDecisionVoter<? extends Object>> decisionVoters
      = Arrays.asList(
        new WebExpressionVoter(),
        new RoleVoter(),
        new AuthenticatedVoter(),
        new MinuteBasedVoter());
    return new UnanimousBased(decisionVoters);

protected void configure(HttpSecurity http) throws Exception {
Can an application use a JDBC driver that can contain the IP to both a primary and Standby instnace, so that the client can switch to standby if the primary IP is no longer reachable.

Or is there some other way an application can perform this

We are using an Oracle DB (Data Guard, primary and standby), but I am asking this from a client application failover to the correct DB instance, as opposed to a db failover
i want to write a file to log the json request details with every registration request .File name should be today date.txt .if file name alreay exists append the json request with next line with same file if file name is not there  it will create a new file could you please give me a pseudo code for that
Hey everyone. I've got about an hour left to finish this project so If you can help me I'd appreciate it. I need a solution to this. The problem starts at the area marked with the <<<<<<<<<<<<< on the code below close to the bottom. I'm trying to make an array that allows me to enter names. The amount of names I enter should be the same amount of students there are. Basically, the students, the grades, and the names all have to be the same amount. When ever I run this program, I get to the enter name portion and I have to enter 25 names. How do I make it so that I only have to enter the amount of names that correlates with the amount of students and grades.

The error I get is                     "Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 2
                                                                         at Lab5Start.main("

public static void main(String[] args) {
            Scanner input = new Scanner(;
            //enter student amount                                                                Enter student amount
            System.out.println("Enter number of students: ");                          
            //check if only numbers were entered (done)
            while (!input.hasNextInt()) {
                  System.out.println("Invalid number. Please enter only digits.");
            //student = number of students
            int student = input.nextInt();
            //check if more than 25 students
            if (student > 25) {
Here's what I'm trying to do and I'll explain it as best as I can.

1. input a number that represents the total number of students (Done)
2. take that number, send it to the "enterGrade" method (NOT DONE)

In my code below the "enterGrade" portion i'm stuck at is represented by <<<<<<<<<<<<<<<<<<<<<<<

Any suggestions and help are appreciated.

public static void main(String[] args) {
            Scanner input = new Scanner(;
            //enter student amount
            System.out.println("Enter number of students: ");
            int student = input.nextInt();
            //check if more than 25 students
            if (student > 25) {
                  System.out.println("Cannot have more than 25 students, try again.");
                //Send number of students to enter grade method <<<<<<<<<<<<<<<<<<<<<<<<<<<<<
            int grade = enterGrade(int[] student);
      public static void enterGrade(int[] student) {
            Scanner input = new Scanner(;
            System.out.println("Enter student's grades");
            int grades = 0;
            while( grades < student.length) {
                  student[grades] = input.nextInt();
      public static void studentName() {






Java is a platform-independent, object-oriented programming language and run-time environment, designed to have as few implementation dependencies as possible such that developers can write one set of code across all platforms using libraries. Most devices will not run Java natively, and require a run-time component to be installed in order to execute a Java program.