[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x

Java

99K

Solutions

33K

Contributors

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

Hi Guys,

I'm having good fun doing my first web services and learning java, but I need your help ( again ).

Just to recap what I've done so far
1. using eclipse java ee I created Dynamic Web Project
2. I imported  a wsdl file to the project and generated web services (Top down Java bean ones)
3. I can take parameters from received requests and loaded them to Oracle database, which connection details are stored in config.properties file ( this pretty much works :) )

I've just been asked if it would be possible to grab a SOAP body and load it to an oracle table.

This is my class where web services requests are being consumed

/**
 * BasicHttpBinding_MS_aaa_WMS_ServicesImpl.java
 *
 * This file was auto-generated from WSDL
 * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
 */

package com.bbb.WebServices;

import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.Statement;

import org.datacontract.schemas._2004._07.Dft_aaa_WebService.WMS_RequestData;
import org.datacontract.schemas._2004._07.Dft_aaa_WebService.WMS_RequestInfo;

public class BasicHttpBinding_MS_aaa_WMS_ServicesImpl implements com.bbb.WebServices.MS_aaa_WMS_Services{
    public com.bbb.WebServices.SendPing_WMSResponse sendPing_WMS(com.bbb.WebServices.SendPing_WMS parameters) throws java.rmi.RemoteException {
try {
			
			Connection con = null;
			

Open in new window

0
CompTIA Network+
LVL 12
CompTIA Network+

Prepare for the CompTIA Network+ exam by learning how to troubleshoot, configure, and manage both wired and wireless networks.

How do I move a JSONArray or JSONObject positionally within a jSONArray?

I started with the example in the link below, but that sorts and I just want to move an object or array to the first position or any arbitrary position.

I don't want to sort as shown in the example in the URL, but I just want to move a specific object to the top or first position.

https://stackoverflow.com/questions/4277715/how-to-sort-json-object-in-java
0
How do I give java more memory for issue with :

"ERROR resultset
Exception in processing the request (4) : java.la
ng.OutOfMemoryError: Java heap space"


I'm on a server that has 16GB memory and most of it is not being used at all.
I see that everytime the java.exe gets around 300MB the entire application will crash, the and tomcat says things like
"ERROR resultset
Exception in processing the request (4) : java.la
ng.OutOfMemoryError: Java heap space"

etc etc

How can this be expanded?
ada.jpg
0
Java version of this scala example

I need the java version of play framework with pagination...

Below is the scala version for reference

https://github.com/playframework/play-scala-anorm-example/blob/2.6.x/app/views/list.scala.html
can someone help me with the java version or converts this to java?

thanks.
0
Hello Sirs,
I am developing a JavaFx/Spring application. Can someone help understand this exception and how to avoid it?
Exception in thread "JavaFX Application Thread" java.lang.NullPointerException
	at javafx.stage.Window$TKBoundsConfigurator.apply(Window.java:1274)
	at javafx.stage.Window$TKBoundsConfigurator.pulse(Window.java:1290)
	at com.sun.javafx.tk.Toolkit.lambda$runPulse$30(Toolkit.java:355)
	at java.security.AccessController.doPrivileged(Native Method)
	at com.sun.javafx.tk.Toolkit.runPulse(Toolkit.java:354)
	at com.sun.javafx.tk.Toolkit.firePulse(Toolkit.java:378)
	at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:510)
	at com.sun.javafx.tk.quantum.PaintCollector.liveRepaintRenderJob(PaintCollector.java:320)
	at com.sun.javafx.tk.quantum.GlassViewEventHandler$ViewEventNotification.run(GlassViewEventHandler.java:788)
	at com.sun.javafx.tk.quantum.GlassViewEventHandler$ViewEventNotification.run(GlassViewEventHandler.java:749)
	at java.security.AccessController.doPrivileged(Native Method)
	at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleViewEvent$368(GlassViewEventHandler.java:828)
	at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:389)
	at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleViewEvent(GlassViewEventHandler.java:827)
	at com.sun.glass.ui.View.handleViewEvent(View.java:539)
	at com.sun.glass.ui.View.notifyResize(View.java:875)
	at 

Open in new window

0
I am looking for support to help me with Java coding questions. I need to create a private instance variable of type String called password and then edit a constructor so that it initialises the password instance variable to the string "Adminadmin1". Finally, I need to write a getter method for the password instance variable.

Is anyone able to provide support?
0
Hello there,

I want to restart my java application which is running on Ubuntu 16.04 as service. But the problem I have is on Ubuntu when I want to restart my java application service, I do as follows
sudo service myapp restart

Open in new window

and then Ubuntu asks for password. Now how can I tell Ubuntu to not ask password when I send this cmd from my application.

//Restart application server
		router.get("/restartAppService").handler(ctx -> {
			/* Build command: sudo service AooService stop */
			  final ArrayList<String> command = new ArrayList<String>();
			  command.add("sudo service TutisService restart");
			  System.out.println("CMD ----"+command.toString());
			  final ProcessBuilder builder = new ProcessBuilder(command);
			  	try {
			  		builder.start();
				} catch (IOException e) {
					System.out.println("EXCEPTION WHILE RESTARTING SERVICE----"+e.getMessage());
					e.printStackTrace();
				}
			  //System.exit(0);
		});

Open in new window


Any help will be appreciated!!

cheers
Zolf
0
Hi,
In java i see several places that the
line count++
is actually internally translated into three steps :
var tmp = count
tmp = tmp +1
count = tmp

So there is a posibility of race condition when updating a variable like this because the operation is not atomic.
I have the following question
1) At what step does it get translated into three steps ? Does it happen when we compile the code or at runtime ?
2) Are these operations like tmp = count assigning it and tmp = tmp + 1 atomic ? Can we surely say they are atomic or they may also be divided into further steps.

Thanks
0
HI,
What does @GuardedBy annotation means ?
Is it only for readability ?
Does java enforces it ?


import net.jcip.annotations.GuardedBy;
import net.jcip.annotations.ThreadSafe;

@ThreadSafe
public class Guarded {
  private Object lock = new Object();

  @GuardedBy("lock") private static int nextValue;

  public int getNextValue(){
    return nextValue;
  }


}

Open in new window

I wrote the above code in which the variable is GuardedBy the lock object...and then accessed without directly inside a getter.
It didnt show any error. Also it ran properly when writing or accessing the value inside the main method

Thanks
0
I need a server side pagination example with front end with datatable with play framework i.e controller and mode layer.

Please kindly help me with a correct reference or example or source code for the best practice ?
0
Introduction to R
LVL 12
Introduction to R

R is considered the predominant language for data scientist and statisticians. Learn how to use R for your own data science projects.

I have a dynamic web project ( SOAP web service), which takes parameters from a received message and inserts data to oracle db. This all works fine. However, db connection url, password and user are hardcoded.

This web app will be distributed to a number of servers with different db connection details, so it can't be hardcoded and generating a new app for each server is not an option.

I wonder if I could store needed info in an xml file and read from there. Is someone able to give me a nice simple example of how to do it?

Also, where such file would have to be placed, bearing in mind it would have to be possible to edit it after the deployment?
0
Please guide me to solve this problem. I'm setting up Zimbra Collaboration Open Source as service provider (SP) and simplesamlphp as Identity Provider (IdP). I have installed samlextn.jar in /opt/zimbra/lib/ext/saml/ and configured SAML authentication for Zimbra server.

Zimbra server environment:

[zimbra@devzimbra ~]$ zmcontrol -v
Release 7.2.0_GA_2669.RHEL6_64_20120410002025 CentOS6_64 FOSS edition.
[zimbra@devzimbra ~]$ java -version
java version "1.6.0_31"
Java(TM) SE Runtime Environment (build 1.6.0_31-b04)
Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01, mixed mode)

The problem is after successfully authenticate in IdP and redirected to http://devzimbra/service/extension/samlreceiver, I'm getting this error in browser:

HTTP ERROR 500
Problem accessing /service/extension/samlreceiver. Reason:

    Unparseable date: "2018-12-13T09:48:09Z"



In /opt/zimbra/log/mailbox.log:
---------------------------
2018-12-14 10:51:31,149 INFO  [btpool0-13://devzimbra/service/extension/samlreceiver] [] extensions - Error in validating SAML response
java.text.ParseException: Unparseable date: "2018-12-14T02:51:14Z"
    at java.text.DateFormat.parse(DateFormat.java:337)
    at com.zimbra.cs.security.saml.SamlResponseHandler.validateSamlAssertion(SamlResponseHandler.java:231)
    at com.zimbra.cs.security.saml.SamlResponseHandler.validateSamlResponse(SamlResponseHandler.java:186)
    at …
0
A high school student needs help learning Java.  I first looked at books by PeachPit Press, but they are all 16+ years old.

Can somebody recommend a great visual guide for a beginner, or some links?

I am going to try and help.  I've been programming for a  L  O  N  G  time.  My latest was PHP.  I figure I could learn along with the student - at least i have the coding mentality.


Thanks.
0
Hi Team,

This is a very simple question related t strings in JAVA .  I know String Objects are immutable and JVM maintains  a copy of the string literal in String constant pool.

But my question is with respect to this context..

String str =" Hello"   ;    --> It is stored in SCP
String str1 = str + "Wellome to Strings"  ;


When  I issue this statement , does the java compiler stores the string Welcome to Srings in SCP and at the runtime , create a String Object  in heap after concatenating Wellcome to Strings with value stored in the variable str and make a copy of this string in SCP.
0
Is it possible in Java to connect to the bitcoin.de websocket?
Here is Python 2.7 / Twisted
https://raw.githubusercontent.com/matthiaslinden/bitcoinDE_API/master/bitcoinDEws.py

It is hard to understand what exactly should be sent to bitcoin.de to make it upgrade to WebSocket.
0
Dear Sirs,
I am trying to include a module to change password in my application, and stay logged in with the new password.
This is my code, after successful password update in the table
....
Authentication oldAuth = SecurityContextHolder.getContext().getAuthentication();

		ApiAuthUserInfo userInfo = appUtilHandler.getApiAuthUserInfo(request);
		
		ApiEntity apiEntity = restService.doChangePassword(userInfo, apiBeanUser);
		success = (apiEntity != null && apiEntity.isSuccess());
		if (!success) {
			result.addError(this.doHandleFieldError("oldPassword", apiEntity.getMessage()));
		}
		
		// Validity Test
		if (result.hasErrors()) {
			return this.doHandleInitFormView(model, entity, success, 
					this.getViewTitle(request), AppViewHandler.VIEW_CHANGE_PASSWORD_FORM_ENTRY);
		}
		
		//Security
		final  UserDetails userDetails = new ApiAuthUser(
				apiBeanUser.getCode(), apiBeanUser.getNewPassword(), oldAuth.getAuthorities(),
				userInfo
				);
		Authentication newAuth = new UsernamePasswordAuthenticationToken(userDetails,
				apiBeanUser.getNewPassword(), oldAuth.getAuthorities());
		SecurityContextHolder.getContext().setAuthentication(newAuth);

Open in new window


After I do this, the next page refresh or even the next log out, gives an UNAUTHORIZED ERROR Message, until I manually reset the password to the former one.
The impression I have is that the new password didn't get updated in the Authentication.
What am I doing wrong?

Any help will be appreciated.
0
Hi,
I have to create the following table in postgreSQL :
create table rbl_kyc_profile (
  id int8 not null,
  userid varchar(50) not null,
  kyctype enum ('PAPER','E_KYC','MINIMAL','SHORTFALL')
)

Open in new window


I got an error : SQL Error [42704]: ERROR: type "enum" does not exist
 
I saw on postgreSQL documentation page : https://www.postgresql.org/docs/9.2/datatype-enum.html
That one first needs to create an enum type in postgreSQL.
This is very different from MYSQL where you can just create a column of enum type by specifying the values...
I have the following questions..

1) Since the kycType in my java classes is an enum. And it has a fixed set of values should i create an ENUM in postgre for it or just create a varchar for it ?
2) Because postgreSQL uses enum types in a different way than MySQL does what impact it has if i create the above kycType as an enum type and then use it in the table ?

Thanks
0
How do you build a distributed system in Java? I want to distribute a stream on multiple nodes.

I've started with Java RMI. It works, but rmiregistry is an unwanted complication. Is there something better in Java, without rmiregistry?

I figured the system needs a dynamic leader election, so now I have the bully algorithm implemented with RMI. When multiple instances are executed to represent nodes, they correctly vote and elects the leader, including handling of reelection when some of the nodes fails or disconnects.

Now, I'm not sure how to distribute stream processing on multiple nodes.
I can have one or more streams, and one or more operations to be performed on the streams.

I want he leader to be the central task allocator. The leader node should distribute tasks on nodes and monitor the progress.
Distributed systems typically use some partitioning of data.

I'd expect distributed stream processing to have some well-known architecture, but somehow I can't find it. It's probably going to use the same components as every other distributed system. (Well, a scheduler - that's the central task allocator,  a partitioner - to partitoin the data perhaps using some hashing function, leader election - done, ...)

With your answer, it should be clearer how to distribute an event stream on multiple nodes.
0
Spring Boot Project Conversion To Web Project - External Tomcat

We have a project developed using Spring Boot. Basically developed the back-end code developed and tested via Rest API.

Now, we have done the front end html and other pages separately.

Now we are not sure how to integrate this project as web application and deploy automatically via Maven in Tomcat

  1. Need to know the project structure for web application project for Spring Boot
  2. Where to place the jsp, javascript, html, css, log4.properties file in spring boot
  3. How to automatically bundle the project and deploy as a war so that we can deploy in any tomcat externally instead of going for a Spring Boot Embedded tomcat.

Current issue: when we deploy the html files manually  the controllers are not recognized

What are the configurations needs to be done when we hit a page via html. Ex: login.html

Please advise.
0
OWASP: Forgery and Phishing
LVL 12
OWASP: Forgery and Phishing

Learn the techniques to avoid forgery and phishing attacks and the types of attacks an application or network may face.

Hello

I am having issues getting Browser print working with Zebra label printer.  I am able to access the printer and it is printing however,  using IE 11 on the website 3PL Warehouse Management it will not print.  I know silverlight and java play a part in this however I believe it's the browser print software that is causing the issues.  We cannot use chrome or Firefox.  Has anyone ran into a fix for this?  3PL stated it might be a firewall issue however, it is not.  Please advise if you can thank you
0
0
Spring Boot - Ethereum Sample Maven Project

I'm looking for a Spring Boot with ethereum Sample Maven Project.

Looking for a good reference?

Thanks.
0
Assume application should have excel kind of grid. Assume 30 columns. Out of which 10 columns will have ranges to filter like in excel we can create greater than or less than or equal etc.,

We need to build an application for the above.

How to do that in Java? Do we have a good open source third party already available in java for the above to integrate with an application?

Thanks.
0
HI,
Is there any website where one can post there understanding of computer science concepts or explain them and then user can ask questions. Although expert exchange also has article section.
But i want to specifically do it for Java concepts Java 8 features etc.
The idea is to feel motivated to study it... as it helps learning the material in a quicker way
Any alternative suggestions
Thanks
0
Java Control Panel not showing up in Windows 10 64 bit.

Was looking for a solution within Windows 10, or is the solution downloading Java.

The latest version of Java is loaded as indicated by its appearance in Programs and features.

Java 8 something somethning....
0

Java

99K

Solutions

33K

Contributors

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.