How to pass Dynamic array to server in SOAP based webservice - java

im stuck in this terrible problem, I have a SOAP based webservice implemented in Java.The client besides other data is supposed to have "male" and "female" checkboxes so the user can either select one of them or both and the client is supposed to send it to the server to be stored in the database, where it is a multivalued entity, but it gives me Error 500, the failure on Server side, is the way i pass the array and then use it on server side correct? if not how could i pass and process it? here is the code for Client, Thanks in advance for your time:
private void salvaActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
disease=malattia.getText();
sexarra=new String[sexint];
if(sexint==1)
sexarra[0]=sexone;
else if(sexint==0)
JOptionPane.showMessageDialog(null, "Bisogna specificare almeno un valore del campo sesso", "Errore", JOptionPane.ERROR_MESSAGE);
else{
sexarra[0]=sexone;
sexarra[1]=sextwo;}
// System.out.print(sexarra[0]);
// System.out.println(sexarra[1]);
description=descrizione.getText();
agestr=eta.getText();
if(agestr.equalsIgnoreCase(""))
JOptionPane.showMessageDialog(null, "Il campo età non può essere vuoto", "Errore", JOptionPane.ERROR_MESSAGE);
age=Integer.parseInt(agestr);
if( age<=0 || age>=110){
JOptionPane.showMessageDialog(null, "Il valore inserito nel campo età non è giusto", "Errore", JOptionPane.ERROR_MESSAGE);
}
else{
try {
URL url = new URL("http://localhost:8080/soap/servlet/rpcrouter");
//costruzione della chiamata
Call chiamata = new Call();
chiamata.setTargetObjectURI("urn:ServerNeuro");
chiamata.setMethodName("aggiungi_malattia");
chiamata.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
SOAPMappingRegistry smr = new SOAPMappingRegistry();
StringDeserializer sd = new StringDeserializer ();
smr.mapTypes (Constants.NS_URI_SOAP_ENC, new QName ("", "return"), null, null, sd);
chiamata.setSOAPMappingRegistry(smr);
//creazione dei parametri
Vector parametri = new Vector();
parametri.addElement(new Parameter("malattia", String.class, disease, null));
parametri.addElement(new Parameter("eta", Integer.class, age, null));
parametri.addElement(new Parameter("descrizione", String.class, description, null));
parametri.addElement(new Parameter("sexarra",String[].class, sexarra, null));
chiamata.setParams(parametri);
try {
Response risp = chiamata.invoke(url, "");
if (risp.generatedFault()) {
Fault fault = risp.getFault();
System.err.println("Chimata Fallita");
System.err.println("Code: " + fault.getFaultCode());
System.err.println("descrizione: " + fault.getFaultString());
} else {
Parameter par = risp.getReturnValue();
msg = (String) par.getValue();
System.out.print(msg);
}
} catch (SOAPException e) {
System.out.println("Errore causata da: (" + e.getFaultCode() + ") :" + e.getMessage());
msg = "errore";
}
} catch (MalformedURLException ex) {
System.out.println("Exception: " + ex.getMessage());
}
System.out.println(msg);
if (msg.equals("si")) {
JOptionPane.showMessageDialog(null, "La registrazione è avvenuta con successo", "REGISTRAZIONE", JOptionPane.INFORMATION_MESSAGE);
}
else{
JOptionPane.showMessageDialog(null, "Attenzione il utente inserito è gia esistente nel database", "ATTENZIONE", JOptionPane.ERROR_MESSAGE);
}
}
}
private void femminaActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if(femmina.isSelected()){
if(sexint==0){
sexint++;
sexone=femmina.getText();
}
else if(sexint==1){
sexint++;
sextwo=femmina.getText();
}
else
sexint--;
System.out.println(sexint);
}
}
private void maschioActionPerformed(java.awt.event.ActionEvent evt) {
if(maschio.isSelected()){
if(sexint==0){
sexint++;
sexone=maschio.getText();
}
else if(sexint==1){
sexint++;
sextwo=maschio.getText();
}
else
sexint--;
System.out.println(sexint);
}
}
Here is the Server Code:
public String aggiungi_malattia(String malattia, Integer eta,String descrizione,String[] sexarra) {
String ris = "no";
String q = null, w = null;
String errore = connetti();
//inserimeto dei dati del utente dentro la tabella login
if(sexarra.length == 2){
q = "INSERT INTO malattia (nome, eta, descrizione, sesso) "
+ "VALUES ('" + malattia + "','" + eta + "','" + descrizione + "','" + sexarra[0] + "')";}
else{
q = "INSERT INTO malattia (nome, eta, descrizione, sesso) "
+ "VALUES ('" + malattia + "','" + eta + "','" + descrizione + "','" + sexarra[0] + "')";
w="INSERT INTO malattia (nome, eta, descrizione, sesso) "
+ "VALUES ('" + malattia + "','" + eta + "','" + descrizione + "','" + sexarra[1] + "')";
}
if (errore.equals("")) {
try {
Statement st = conn.createStatement();
if(sexarra.lenght == 2){
st.executeUpdate(q);
st.executeUpdate(w);
}
else
st.executeUpdate(q);
st.close();
conn.close();
ris = "si";
} catch (SQLException e) {
System.out.println("Errore: " + e.getMessage());
return ris;
}
}
return ris;
}
This is last lines of Catalina.out it doesn't make any sense to me.I suspect that the Array might be causing it since its determined at run-time, i couldn't find any other way to do it, hints here will be appreciated
Jul 20, 2011 11:35:22 PM org.apache.catalina.realm.CombinedRealm startInternal
SEVERE: Failed to start "org.apache.catalina.realm.UserDatabaseRealm/1.0" realm
org.apache.catalina.LifecycleException: No UserDatabase component found under key UserDatabase
at org.apache.catalina.realm.UserDatabaseRealm.startInternal(UserDatabaseRealm.java:264)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.realm.CombinedRealm.startInternal(CombinedRealm.java:201)
at org.apache.catalina.realm.LockOutRealm.startInternal(LockOutRealm.java:120)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1026)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:291)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:727)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.startup.Catalina.start(Catalina.java:620)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:303)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:431)
Jul 20, 2011 11:35:22 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive soap.war
Jul 20, 2011 11:35:23 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory manager
Jul 20, 2011 11:35:23 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory examples
Jul 20, 2011 11:35:24 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory ROOT
Jul 20, 2011 11:35:24 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory host-manager
Jul 20, 2011 11:35:25 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory docs
Jul 20, 2011 11:35:25 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory axis
- Unable to find config file. Creating new servlet engine config file: /WEB-INF/server-config.wsdd
Jul 20, 2011 11:35:26 PM org.apache.coyote.AbstractProtocolHandler start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Jul 20, 2011 11:35:26 PM org.apache.coyote.AbstractProtocolHandler start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Jul 20, 2011 11:35:26 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 3780
Unfortunately even after changing the code which i thought could be throwing NPE, it still hasnt changed anything. I changed from
if(sexarra[1]==null){....}
to
if(sexarra.lenght == 2){...}
I get the following error:
Errore causata da: (SOAP-ENV:Protocol) :Unsupported response content type "text/html; charset=utf-8", must be: "text/xml". Response was:
Apache Tomcat/7.0.14 - Error report HTTP Status 500 - type Exception reportmessage description The server encountered an internal error () that prevented it from fulfilling this request.exception javax.servlet.ServletException: Error building response envelope: java.lang.NullPointerException
org.apache.soap.server.http.RPCRouterServlet.doPost(RPCRouterServlet.java:418)
javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.14 logs.

I'm not sure I understand why you're building SOAP requests by hand and not use some kind of automatic WSDL-to-class generator, one that comes with the JDK, Eclipse or NetBeans. This would give you type / structure safety, but I surely see problems in your code, for example
if(sexarra[1]== null) { ... }
could possibly throw a NPE or an ArrayIndexOutOfBoundsException. Unfortunately, Tomcat's output does not make sense to me either, at least not towards your question.

Related

Error in creating remedy ticket using java

i need a Java class to submit tickets to BMC Remedy's but i was getting error could anyone please help me how to resolve that error.
Find the below code:
public class RemedyCreateTicket {
public static void main(String args[]) {
ARServerUser arsServer = new ARServerUser();
Entry args1 = new Entry();
Entry incidentID;
String arForm = "HPD:IncidentInterface_Create";
String arForm1 = "HPD:IncidentInterface";
String IntEntryID = "";
String inciID = "";
try {
//Create Ticket Part
String strLastName = "radadiya";
String strFirstName ="pragnesh";
args1.put(new Integer("1000000076"),new Value("CREATE")); //ticket_action
args1.put(new Integer("1000000018"),new Value(strLastName)); //contact user first_name
args1.put(new Integer("1000000019"),new Value(strFirstName)); //contact user last_name
args1.put(new Integer("7"), new Value("1")); //ticket status
args1.put(new Integer("1000000099"),new Value("3")); //service type
//args1.put(new Integer("1000000163"),new Value("4000")); //impact
args1.put(new Integer("1000000162"),new Value("4000")); //urgency
args1.put(new Integer("1000000000"),new Value("Remedy 7.5 java api test")); //description
args1.put(new Integer("1000000215"),new Value("10000"));
arsServer.setServer("localhost");
arsServer.setUser("pragnesh");
arsServer.setPassword("password");
arsServer.setPort(3389);
arsServer.login();
//arsServer.setPort(3389);
IntEntryID = arsServer.createEntry(arForm, args1);
System.out.println("intEntryID="+IntEntryID);
int[] entryField = {1000000161};
incidentID = arsServer.getEntry(arForm,IntEntryID,entryField);
if(incidentID!=null){
System.out.println(incidentID);
}
System.out.println("------------");
for (Object o : incidentID.entrySet()) {
Map.Entry e = (Map.Entry) o;
System.out.println(e.getKey() + " => " + e.getValue().getClass() + " " + e.getValue());
if(e.getKey().toString().equalsIgnoreCase("1000000161")){
inciID=e.getValue().toString();
}
}
System.out.println("IncidentID = " + inciID);
arsServer.logout();
} catch (ARException e) {
e.printStackTrace();
arsServer.logout();
}
}
}
Here is the stacktrace:
Jun 20, 2017 4:11:55 PM java.util.prefs.WindowsPreferences openKey
WARNING: Could not open windows registry node Software\JavaSoft\Prefs at root 0x80000002. Windows RegOpenKey(...) returned error code 2.
Jun 20, 2017 4:11:55 PM java.util.prefs.WindowsPreferences closeKey
WARNING: Could not close windows registry node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCloseKey(...) returned error code 6.
**ERROR (91): RPC call failed; localhost:3389 Connection reset**
at com.bmc.arsys.apitransport.ApiProxyJRpcBase.convertException(ApiProxyJRpcBase.java:643)
at com.bmc.arsys.api.ProxyJRpc.getRpcClient(ProxyJRpc.java:135)
at com.bmc.arsys.api.ProxyJRpc.<init>(ProxyJRpc.java:67)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at com.bmc.arsys.apitransport.connection.ApiProxyFactory.createProxyInstance(ApiProxyFactory.java:89)
at com.bmc.arsys.apitransport.connection.ApiProxyFactory.createProxy(ApiProxyFactory.java:160)
at com.bmc.arsys.api.ProxyManager.createProxy(ProxyManager.java:602)
at com.bmc.arsys.api.ProxyPool.createProxy(ProxyPool.java:106)
at com.bmc.arsys.apitransport.connection.ApiProxyPool.get(ApiProxyPool.java:192)
at com.bmc.arsys.apitransport.connection.ApiProxyManager.getProxy(ApiProxyManager.java:210)
at com.bmc.arsys.api.PoolingProxyManager.getProxy(PoolingProxyManager.java:93)
at com.bmc.arsys.apitransport.connection.ApiProxyManager.getProxy(ApiProxyManager.java:164)
at com.bmc.arsys.api.ARServerUser.verifyUser(ARServerUser.java:1085)
at com.bmc.arsys.api.ARServerUser.login(ARServerUser.java:412)
at Remedi.RemedyCreateTicket.main(RemedyCreateTicket.java:46)
Thanks in advance.
This is old but for anyone looking at it after; the code looks fine. ARERROR 91 is typically a networking issue. Port 3389 is the default for Remote Desktop. Therefore, I wonder if you are tunneling to localhost and trying to connect to the Windows machine that you RDP to? Instead of the TCP port the AR Server is actually running on and let in through the Windows firewall?

Web service method called once, but executed multiple times

I'm developing a web service in Java EE 6, with only one method called E1CreateAccount.
It happens that for each call I do to the method, the execution of the method fires multiple times (at least 2 times). The executions are consecutive, so the next start when the previous ends.
The code of the method is the following:
#WebMethod
public Object E1CreateAccount(#WebParam(name = "arg0") InboundAccountF56101IB newAccount) {
Object ret = "KO";
MyAction action = MyAction.CREATE;
MyLogger.getLogger().info("Integration WebService called to Create new Account in E1, name " +
newAccount.getCRMAccountName());
E1AccountClientThread runner = new E1AccountClientThread();
runner.initialize(newAccount, action);
Thread thread = new Thread(runner);
MyLogger.getLogger().info(thread.getId() + ": Created thread to " + action.name() +
" Account. Account Name: " + newAccount.getCRMAccountName() + "...");
try {
MyLogger.getLogger().info(thread.getId() +
": Starting thread to call E1 Account web service, Action: " +
action.name());
thread.start();
ret = "OK";
} catch(Exception e) {
String str = "Exception calling the thread delegate to call E1 Account web service (Action " +
action.name() + ". Message: " + e.getMessage().toString();
MyLogger.getLogger().severe(str);
ret="KO " + str;
}
return ret;
}
It receive the call, it logs the fact that the service has been called, and then create a separated thread which will do the task. Then it always return the string "OK".
The method works well, the only problem is the multiple execution, which is undesired for the software purposes.
This is what I see from the logs:
Jul 06, 2015 3:17:57 PM integration.services.e1.account.E1AccountService E1CreateAccount
INFO: Integration WebService called to Create new Account in E1, name THIS_IS_THE_COMPANY_NAME
Jul 06, 2015 3:17:57 PM integration.services.e1.account.E1AccountService E1CreateAccount
INFO: 1026: Created thread to CREATE Account. Account Name: THIS_IS_THE_COMPANY_NAME...
Jul 06, 2015 3:17:57 PM integration.services.e1.account.E1AccountService E1CreateAccount
INFO: 1026: Starting thread to call E1 Account web service, Action: CREATE
[...]
Jul 06, 2015 3:18:00 PM integration.services.e1.account.E1AccountService E1CreateAccount
INFO: Integration WebService called to Create new Account in E1, name THIS_IS_THE_COMPANY_NAME
Jul 06, 2015 3:18:00 PM integration.services.e1.account.E1AccountService E1CreateAccount
INFO: 1027: Created thread to CREATE Account. Account Name: THIS_IS_THE_COMPANY_NAME...
Jul 06, 2015 3:18:00 PM integration.services.e1.account.E1AccountService E1CreateAccount
INFO: 1027: Starting thread to call E1 Account web service, Action: CREATE
[...]
(I substituted with [...] the logs related to what the threads actually do because I think it is not relevant)
The web service has been deployed on WebLogic 12.1.3, and I used the ide JDeveloper 12.1.3

Ice4J: Ice State Failed on 4G network

Does anyone know how to do the TURN portion of Ice4j? I've managed to code it so that it works when the phone is on WiFi, but not when its on the mobile network.
I'm sending agent info via TCP and then building the connection manually instead of using a signalling process. The TCP connection already works fine, so I don't think its the TCP issue. Maybe I'm building the agent wrong?
I know that you're supposed to use a TURN server if STUN doesn't work, and I provided a large list of public TURN servers, but I might be missing something. Maybe the packets aren't being sent out properly?
Error: (Mostly Failed to send ALLOCATE-REQUEST(0X3))
Sep 11, 2014 3:36:09 PM org.ice4j.ice.Agent createMediaStream
INFO: Create media stream for data
Sep 11, 2014 3:36:09 PM org.ice4j.ice.Agent createComponent
INFO: Create component data.1
Sep 11, 2014 3:36:09 PM org.ice4j.ice.Agent gatherCandidates
INFO: Gather candidates for component data.1
Sep 11, 2014 3:36:09 PM org.ice4j.ice.harvest.HostCandidateHarvester harvest
INFO: End candidate harvest within 160 ms, for org.ice4j.ice.harvest.HostCandidateHarvester, component: 1
Sep 11, 2014 3:36:09 PM org.ice4j.ice.harvest.StunCandidateHarvest sendRequest
INFO: Failed to send ALLOCATE-REQUEST(0x3)[attrib.count=3 len=32 tranID=0x9909DC6648016A67FDD4B2D8] through /192.168.0.8:5001/udp to stun2.l.google.com:19302:5001/udp
Sep 11, 2014 3:36:12 PM org.ice4j.ice.ConnectivityCheckClient processTimeout
INFO: timeout for pair: /fe80:0:0:0:c8ce:5a17:c339:cc40%4:5001/udp -> /fe80:0:0:0:14e8:f3ff:fef3:6a21:6001/udp (data.1), failing.
Sep 11, 2014 3:36:12 PM org.ice4j.ice.ConnectivityCheckClient processTimeout
INFO: timeout for pair: /fe80:0:0:0:380d:2a4c:b350:eea8%8:5001/udp -> /fe80:0:0:0:14e8:f3ff:fef3:6a21:6001/udp (data.1), failing.
Sep 11, 2014 3:36:12 PM org.ice4j.ice.ConnectivityCheckClient processTimeout
INFO: timeout for pair: /192.168.0.8:5001/udp -> /100.64.74.58:6001/udp (data.1), failing.
Sep 11, 2014 3:36:12 PM org.ice4j.ice.ConnectivityCheckClient processTimeout
INFO: timeout for pair: /192.168.0.8:5001/udp -> /100.64.74.58:6001/udp (data.1), failing.
Sep 11, 2014 3:36:12 PM org.ice4j.ice.ConnectivityCheckClient updateCheckListAndTimerStates
INFO: CheckList will failed in a few seconds if nosucceeded checks come
Sep 11, 2014 3:36:17 PM org.ice4j.ice.ConnectivityCheckClient$1 run
INFO: CheckList for stream data FAILED
Sep 11, 2014 3:36:17 PM org.ice4j.ice.Agent checkListStatesUpdated
INFO: ICE state is FAILED
Script (Both the server and the client sides have similar codes to this one):
Agent agent = new Agent();
agent.setControlling(false);
StunCandidateHarvester stunHarv = new StunCandidateHarvester(new TransportAddress("sip-communicator.net", port, Transport.UDP));
StunCandidateHarvester stun6Harv = new StunCandidateHarvester(new TransportAddress("ipv6.sip-communicator.net", port, Transport.UDP));
agent.addCandidateHarvester(stunHarv);
agent.addCandidateHarvester(stun6Harv);
String[] hostnames = new String[] { "130.79.90.150",
"2001:660:4701:1001:230:5ff:fe1a:805f",
"jitsi.org",
"numb.viagenie.ca",
"stun01.sipphone.com",
"stun.ekiga.net",
"stun.fwdnet.net",
"stun.ideasip.com",
"stun.iptel.org",
"stun.rixtelecom.se",
"stun.schlund.de",
"stun.l.google.com:19302",
"stun1.l.google.com:19302",
"stun2.l.google.com:19302",
"stun3.l.google.com:19302",
"stun4.l.google.com:19302",
"stunserver.org",
"stun.softjoys.com",
"stun.voiparound.com",
"stun.voipbuster.com",
"stun.voipstunt.com",
"stun.voxgratia.org",
"stun.xten.com",};
LongTermCredential longTermCredential = new LongTermCredential("guest", "anon");
for (String hostname : hostnames)
agent.addCandidateHarvester(new TurnCandidateHarvester(new TransportAddress(hostname, port, Transport.UDP), longTermCredential));
//Build a stream for agent
IceMediaStream stream = agent.createMediaStream("data");
try {
Component c = agent.createComponent(stream, Transport.UDP, port, port, port+100 );
String response = "";
List<LocalCandidate> remoteCandidates = c.getLocalCandidates();
for(Candidate<?> can : remoteCandidates) {
response += "||" + can.toString();
}
response = "Video||" + agent.getLocalUfrag() + "||" + agent.getLocalPassword() + "||" + c.getDefaultCandidate().toString() + response;
System.out.println("Server >>> " + response);
DataOutputStream outStream = new DataOutputStream(client.getOutputStream());
outStream.write(response.getBytes("UTF-8"));
outStream.flush();
List<IceMediaStream> streams = agent.getStreams();
for(IceMediaStream localStream : streams) {
List<Component> localComponents = localStream.getComponents();
for(Component localComponent : localComponents) {
for(int i = 3; i < info.length; i++) {
String[] detail = info[i].split(" "); //0: Foundation
//1: Component ID
//2: Transport
//3: Priority #
//4: Address (Needed with Port # to create Transport Address)
//5: Port # (Needed with Address to create Transport Address)
//6: -filler: "Type" is next field-
//7: Candidate Type
String[] foundation = detail[0].split(":"); //Turn "Candidate:#" -> "Candidate" and "#". We use "#"
localComponent.addRemoteCandidate(new RemoteCandidate(new TransportAddress(detail[4], Integer.valueOf(detail[5]), Transport.UDP), c, CandidateType.HOST_CANDIDATE, foundation[1], Long.valueOf(detail[3]), null));
}
String[] defaultDetail = info[3].split(" ");
String[] defaultFoundation = defaultDetail[0].split(":");
localComponent.setDefaultRemoteCandidate(new RemoteCandidate(new TransportAddress(defaultDetail[4], Integer.valueOf(defaultDetail[5]), Transport.UDP), c, CandidateType.HOST_CANDIDATE, defaultFoundation[1], Long.valueOf(defaultDetail[3]), null));
}
localStream.setRemoteUfrag(info[1]);
localStream.setRemotePassword(info[2]);
}
agent.startConnectivityEstablishment();
System.out.println("ICEServer <><><> Completed");
I realize now that your list of TURN servers seem to mostly actually be STUN servers (not sure about the first two). They should be added as STUN servers if anything:
agent.addCandidateHarvester(
new StunCandidateHarvester(
new TransportAddress(
InetAddress.getByName('stun.l.google.com'),
19302,
Transport.UDP)));

Getting Null results for query on DB2 using Spring

If i run the query through Quantum DB i do get the desired result. But when same query is used in the code no error is thrown and i get no result.
Query:
final String RECORD_LIST_QUERY = "SELECT COUNT(*) FROM A.abc AS WEU WHERE WEU.ZZAA_AUFT_NR = '?'";
final String FZEG_NR_QUERY="SELECT WEU.FZEG_NR, WEU.ZZAA_AUFT_NR FROM A.abc AS WEU WHERE WEU.ZZAA_AUFT_NR = '?'";
Method:
public OrderDetailsDto FetchOrderData(OrderDetailsDto orderDetailsDto) {
System.out.println("DAO:through DTO: Order Nr before running query " + orderDetailsDto.getOrderNr());
Object args = orderDetailsDto.getOrderNr();
OrderDetailsDto orderDetailsDtoCopy = new OrderDetailsDto();
System.out.println("Data source is " + getDataSource());
try {
List<Map<String, Object>> result = getJdbcTemplate().queryForList(IOrderDao.FZEG_NR_QUERY, args);
if (result.listIterator().hasNext()) {
System.out.println("DAO:through DTO: Order Nr before running query " + args);
System.out.println("Result to check query is fired " + result.get(result.listIterator().nextIndex()));
} else {
System.out.println("DAO:through DTO: Order Nr before running query " + args);
int cnt = getJdbcTemplate().queryForInt(IOrderDao.RECORD_LIST_QUERY, args);
System.out.println("count of record is " + cnt);
}
for (Map<String, Object> record : result) {
System.out.println("In Dao FOR Loop");
orderDetailsDtoCopy.setOrderNr("" + record.get("ZZAA_AUFT_NR"));
orderDetailsDtoCopy.setFZEGNr("" + record.get("FZEG_NR"));
}
System.out.println("In dao order number is set as " + orderDetailsDtoCopy.getOrderNr());
System.out.println("In dao FZEG number is set as " + orderDetailsDtoCopy.getFZEGNr());
} catch (DataAccessException e) {
e.printStackTrace();
}
return orderDetailsDtoCopy;
}
Output:
Executing D:\Users\rpashank\Documents\GOorderInfo\dist\run388364612\GOorderInfo.jar using platform C:\Program Files\Java\jdk1.7.0_51\jre/bin/java
Jun 11, 2014 11:49:54 AM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing org.springframework.context.support.FileSystemXmlApplicationContext#367dd4d9: startup date [Wed Jun 11 11:49:54 IST 2014]; root of context hierarchy
Jun 11, 2014 11:49:54 AM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from file [D:\Users\rpashank\Documents\GOorderInfo\src\main\resources\spring-config.xml]
Jun 11, 2014 11:49:54 AM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory#690d76d5: defining beans [dataSource,jdbcTemplate,transactionManager,transactionTemplate,orderService,orderDao]; root of factory hierarchy
Jun 11, 2014 11:49:54 AM org.springframework.jdbc.datasource.DriverManagerDataSource setDriverClassName
INFO: Loaded JDBC driver: com.ibm.db2.jcc.DB2Driver
OrderController orderNr before calling query 0729100528
Jun 11, 2014 11:49:54 AM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing org.springframework.context.support.FileSystemXmlApplicationContext#40da178f: startup date [Wed Jun 11 11:49:54 IST 2014]; root of context hierarchy
Jun 11, 2014 11:49:54 AM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from file [D:\Users\rpashank\Documents\GOorderInfo\src\main\resources\spring-config.xml]
Jun 11, 2014 11:49:54 AM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory#162292fd: defining beans [dataSource,jdbcTemplate,transactionManager,transactionTemplate,orderService,orderDao]; root of factory hierarchy
Jun 11, 2014 11:49:54 AM org.springframework.jdbc.datasource.DriverManagerDataSource setDriverClassName
INFO: Loaded JDBC driver: com.ibm.db2.jcc.DB2Driver
DAO:through DTO: Order Nr before running query 0729100528
Data source is org.springframework.jdbc.datasource.DriverManagerDataSource#997f31b
DAO:through DTO: Order Nr before running query 0729100528
count of record is 0
In dao order number is set as null
In dao FZEG number is set as null
Order Controller ORDER Nr. through DTO after query null
OrderController FZEG through DTO after query null

sending SMS via a commercial API (trendoo) : nullPointerException

I ask for help because I have a nullpointerexception that I don't understand.
here is the code:
try {
sr = application.launcher.getSmstrend().getConnexion()
.sendSMS(this);
}
} catch (Exception e) {
launcher.append(launcher.format_log.format(new Date())
+ " RDV.envoi : ERREUR d'envoi du message, " + e);
}
to be noted : the getConnexion() method returns a valid object (not null), and the this parameter is also not null. Smstrend is not "trendoo", a site which sends SMS via a java API. The error is :
sam. 11 janv. 2014 22-08-54 RDV.envoi : ERREUR d'envoi du message, java.lang.NullPointerException
can you explain me where to search?where is the null reference?

Categories

Resources