Guy Emerson

Ranch Hand
+ Follow
since Dec 14, 2010
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Guy Emerson

Hi All,

Could you help figure out how to better write the program to get rid of the problem given below and also in the subject line

"No mapping found for HTTP request with URI [/jsp/execLanding.jsp] in DispatcherServlet with name 'dispatcherServlet'



My program is done in the spring boot in STS IDE. Made a sample web mvc program using start.spring.io and importing the resultant maven project into STS workspace.

The following are the different components :--













What more do I have to do to get tomcat server make the DispatcherServlet to direct to the execLanding.jsp as sought by me.


Regards



6 years ago

Thanks Tushar for the suggestion.

I have a confusion understanding Spring configuration done using annotations. I read them but Is annotation based configuration is same as java based configuration as both use annotations if they are same why two different names.

And how different is Spring boot and spring roo from the existing annotation based Sping


Regards

Emerson
7 years ago
Hello All,

Would you please suggest what will be the best book to learn annotation based Spring 4.0 and spring boot.

if there is any web material to learn both of the above in details would be very good as well.

Whichever material I refer to online they all write about xml configuration which I know to a good extent..


Regards

Emerson
7 years ago
Thanks Paul,

With the stack trace I could see it was because of several jar files missing. Added them now arrived at a configuration problem showing Exception as below :--

[livecoding]C:\Users\humpa\Desktop\softcol\security-code-files\WSSecurityCodeFiles\ClientAFTER>start.bat C:\Users\humpa\Desktop\softcol\security-code-files\WSSecurityCodeFiles\ClientAFTER>echo off org.apache.axis2.deployment.DeploymentException: org.apache.axis2.transport.tcp.TCPServer at org.apache.axis2.deployment.AxisConfigBuilder.processTransportReceivers(AxisConfigBuilder.java:669) at org.apache.axis2.deployment.AxisConfigBuilder.populateConfig(AxisConfigBuilder.java:129) at org.apache.axis2.deployment.DeploymentEngine.populateAxisConfiguration(DeploymentEngine.java:629) at org.apache.axis2.deployment.FileSystemConfigurator.getAxisConfiguration(FileSystemConfigurator.java:116) at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContext(ConfigurationContextFactory.java:64) at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContextFromFileSystem(ConfigurationContextFactory.java:210) at ClassifiedClient.main(ClassifiedClient.java:33) Caused by: java.lang.InstantiationException: org.apache.axis2.transport.tcp.TCPServer at java.lang.Class.newInstance(Unknown Source) at org.apache.axis2.deployment.AxisConfigBuilder.processTransportReceivers(AxisConfigBuilder.java:653) ... 6 more[/livecoding]


I did a bit of research and added a few transport receivers as below in the axis2.xml file  :--


<parameter name="transport.tcp.port">6060</parameter>
As shown below. For transport receiver

<!-- Enable TCP message -->  
<transportReceiver name="tcp" class="org.apache.axis2.transport.tcp.TCPTransportListener">
   <parameter name="transport.tcp.port">6060</parameter>
</transportReceiver>
To add Transport Sender

<transportSender name="tcp" class="org.apache.axis2.transport.tcp.TCPTransportSender"/>



Modified axis2.xml looks like this

and the ClassifiedClient.java is remains same with a minor change to include the printStackTrace()  line number 33 shows the configuration problem..




Please advise..

Regards

Emerson




7 years ago
Hi Tim,

I have been reading through some website that tells me how to apply security Axis2 server with rampart framework. I have created service and clients as shown below. Could you please tell me why I am getting an error and the program fails


Service :-

import javax.xml.stream.XMLStreamException;
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.soap.SOAPFactory;

public class CMSService {
   public OMElement getNumberOfArticles(OMElement element) throws XMLStreamException {
       element.build();
       element.detach();
       String categoryValue = element.getFirstElement().getText();
       SOAPFactory factory = OMAbstractFactory.getSOAP12Factory();
       OMElement resultElem = factory.createOMElement("numberOfArcticles", factory.createOMNamespace("http://daily-moon.com/cms/", "resp"));
       resultElem.setText(articleCount(categoryValue).toString());
       System.out.println("Service method getNumberOfArticles done");
       return resultElem;
   }

   private Integer articleCount(String catId) {
       return new Integer(42);
   }
}


callback class

import java.io.IOException;
import javax.security.auth.callback.Callback;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.callback.UnsupportedCallbackException;
import org.apache.ws.security.WSPasswordCallback;

public class PWCallback implements CallbackHandler {
   public void handle(Callback[] callbackArr) throws IOException, UnsupportedCallbackException {
       int i = 0;
       while (i < callbackArr.length) {
           if (callbackArr[i] instanceof WSPasswordCallback) {
               WSPasswordCallback wSPasswordCallback = (WSPasswordCallback) callbackArr[i];
               if (wSPasswordCallback.getIdentifer().equals("bob")) {
                   wSPasswordCallback.setPassword("password");
               } else if (wSPasswordCallback.getIdentifer().equals("alice")) {
                   wSPasswordCallback.setPassword("password");
               } else {
                   throw new UnsupportedCallbackException(callbackArr[i], "Unknown user");
               }
               i++;
           } else {
               throw new UnsupportedCallbackException(callbackArr[i], "Unrecognized Callback");
           }
       }
   }
}



services.xml

<service name="CMSService">

   <description>
       This is a sample Web Service for the newspaper's Content Managment System.
   </description>

   <parameter name="ServiceClass" locked="false">CMSService</parameter>

   <parameter name="InflowSecurity">
      <action>
           <items>Timestamp Signature</items>
           <passwordCallbackClass>PWCallback</passwordCallbackClass>
           <signaturePropFile>security.properties</signaturePropFile>
      </action>
   </parameter>

   <parameter name="OutflowSecurity">
     <action>
       <items>Timestamp Signature Encrypt</items>
       <user>alice</user>
       <passwordCallbackClass>PWCallback</passwordCallbackClass>
       <signaturePropFile>security.properties</signaturePropFile>
       <signatureKeyIdentifier>SKIKeyIdentifier</signatureKeyIdentifier>
       <encryptionKeyIdentifier>SKIKeyIdentifier</encryptionKeyIdentifier>
       <encryptionUser>bob</encryptionUser>
       <signatureParts>{Element}{http://schemas.xmlsoap.org/soap/envelope/}Body</signatureParts>
       <optimizeParts>//xenc:EncryptedData/xenc:CipherValue/xenc:CipherData</optimizeParts>
      </action>
   </parameter>

   <operation name="getNumberOfArticles">
       <messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
   </operation>

</service>


security.properties

org.apache.ws.security.crypto.provider=org.apache.ws.security.components.crypto.Merlin
org.apache.ws.security.crypto.merlin.keystore.type=jks
org.apache.ws.security.crypto.merlin.keystore.password=password
org.apache.ws.security.crypto.merlin.file=sec.jks






Client side :--

axis2.xml



client class



callback class




security.properties

org.apache.ws.security.crypto.provider=org.apache.ws.security.components.crypto.Merlin
org.apache.ws.security.crypto.merlin.keystore.type=jks
org.apache.ws.security.crypto.merlin.keystore.password=password
org.apache.ws.security.crypto.merlin.file=sec.jks


start.bat





I deployed CMSService.aar in axis2 server in the axis2-1.7.3\repository\services folder



I was expecting to execute the start.bat file to get a response from the axis2 server.

But instead I got an error on the command prompt


C:\Users\humpa\Desktop\softcol\security-code-files\WSSecurityCodeFiles\ClientAFTER>start.bat

C:\Users\humpa\Desktop\softcol\security-code-files\WSSecurityCodeFiles\ClientAFTER>echo off
org.apache.axis2.deployment.DeploymentException: org.apache.axis2.transport.tcp.TCPTransportSender

C:\Users\humpa\Desktop\softcol\security-code-files\WSSecurityCodeFiles\ClientAFTER>



Could you please figure what is creating this Error is ?


Regards

Emerson





7 years ago
Thanks Tim or the answer..

Maven seems to be the best resort...Will do that using maven

Regards
Emerson
7 years ago
Hello All,

Not sure if this sounds a little weird but I need a way to figure out a standard way to create a webservice (in the form of war or ear) and deploy across different servers without making any change to the war or ear file

I have not seen any document on google that gives a single way of doing that. This will save me a lot of time.

Please correct me if I am wrong

regards

Emerson
7 years ago
Hi again,

I was going through the WS-security implementation by Apache which seems to be very good. I am yet to be too sure as to whether its meant only to be used with Apache Axis2 servers as most of the materials I am getting on google tell me that its used with Apache Axes2 framework.. My requirement is WSS4J use in Weblogic server

I am a little lost to distinguish between Apache CXF and Apache WSS4J. If both are meant to provide implementation of WS-Security then why two different implementations.

Thanks a lot to anybody who help me understand these nuances

Regards

Emerson

7 years ago

Thanks a lot Tim for your quick response.

I will come up with questions on WS-security and implementations as I read along..Please do answer to my queries..

Regards

Emerson

7 years ago
Hello All,

In one of the interview questions I was asked "What are the APIs  available to provide security to Webservices in SOAP and which one did you use."

I dont remember using any particular api for webservice security . I searched google and did not find any api for sole use in Webservice..  I saw use of https secured protocol , certificates for authentication but not any java api to use..

Would you please help me broaden my knowledge in webservices security . Or am I missing out on something ?


Thanks and Regards

Emerson
7 years ago
Thanks Henry for your insights.

Was the word "transaction" actually used in the question?



Yes it was asked the way I narrated in my post.

Additionally, since two different systems that support transactions, was mentioned, the interview probably wanted you to discuss the concept of "two phase commit".



Would you help explain how one would apply a Two phase commit in a method that involves a JMS message sending and a DB insert. if the DB insert fails the JMS message should also be rollbacked. This would be great insight for me as well as a lot of others to better their comprehension on this topic.

Regards

Guy
Hello All,

I went to an interview with a reputed investment bank I was asked a question on transaction as below

' Your transaction involves two parts : a JMS message generation and a DB operation. you have sent the message to the JMS provider and Database insert fails then how you are going to manage transaction?'

Please help find an answer to this question..

Regards

Guy
Hello All,

I am new to webservice .. learning JAX-WS using Weblogic as a middle-ware.

I have seen in examples that there are two ways of deployment :---

1. using Endpoint.publish() method eg..



2. using a build.xml file eg..



I want to know if we can use Endpoint.publish() for realtime projects.. What is the compelling reason to use this method of deployment why is better or worse to use Endpoint.publish over deployment through a build.xml script.


Is there another way of deployment by creating a war/ear file and then deploying it using the weblogic console

Is there a server independent deployment technique so that if I move the webservice code from one server to the other I dont have to follow server specific deployment processes as given in the above build.xml spefic for weblogic server



I have been surfing through many examples and articles in google.. but could not find a coherent answer to my questions... If I am being naive please excuse me but I need to clear these doubtful niggles that are pinching my comprehension of the Webservice concept..

Regards

Guy
7 years ago
Hello Ladies and Gents,

In a recently held interview I was given a situation where I was asked how would I do the transaction management using hibernate when I need to book a flight ticket from New Delhi to New York in the following format
1) New Delhi to London ,
2) London to New York

Would you please tell me what are the different ways of achieving this transaction management.


Regards

Guy
Hello Ranchers,
I am new to using webservices , the examples and tutorial I get in google all use Axis2 server .. I need to know how to write , deploy, publish and call the webservice in a weblogic server..

Would you kindly show me an easy example jax-ws webservice program and the steps to deploy the services in weblogic environment and run the service from a client program..

I know this would be a silly request but need to get an example to understand as soon as possible rather than do R&D google .. Any help would be highly appreciated !!!

Regards

Guy
8 years ago