Sunday, July 30, 2017

Amazon Web Services - Getting started

Registration:

  • After filling basic information, you need to fill billing information (Credit card details) during the registration process.
  • After entering billing information, Transaction of Rs. 2 will be initiated to verify your Billing details (Transaction will be cancelled later by Amazon automatically).
  • Verification of Phone/Mobile with Automated Call.
  • Post verification, your account will be created.

Getting Started with Amazon Web Service Cloud:
  • On AWS dashboard, there are different options to start with, Choose - Launch a Virtual Machine option

  • Type Name for your instance.
  • There will be option to download private key to connect to instance.
  • Download private key(*.pem format)
  • After you submit, your instance will be launched successfully.
  • You can view the instance from Instances option of EC2 Dashboard.


Connecting to Virtual Machine using Putty:
  • You need to generate private key using PuttyGen application.
  • Load your_key.pem in PuttyGen by clicking Load button.
  • Click on generate private key button. (It will warning message to save key without passcode. Select Yes).
  • Save the private key (format *.ppk)
  • Open Putty terminal window.
  • Default user for VM is "ec2-user".
  • Check Public DNS of your Virtual machine on EC2 dashboard. Format of DNS is like ëc2-*-2.compute.amazonaws.com
  • Enter hostname as : ec2-user@public-DNS of your VM. - ec2-user@ec2-*-us-east-2.compute.amazonaws.com
  • Enter port as 22.
  • Open SSH tab on left and on Auth tab - Select private key file as *.ppk file which is generated using PuttyGen tool.
  • Click on Open. You should be able to connect to Virtual Machine.
TroubleShooting while connecting to VM:
  • By default, IP address for Inbound connections on VM is the one from which you have created Virtual Machine and it is managed by Security Groups.
  • Check which Security Group is assigned to your VM in Description at the bottom.
  • View Inbound Rules - Set source IP as 0.0.0.0/0 for Port 22 if it is not already set as 0.0.0.0/0
  • Now you should be able to connect.
You will see Terminal console with following message:

Using username "ec2-user".
Authenticating with public key "imported-openssh-key"
       __|  __|_  )
       _|  (     /   Amazon Linux AMI
      ___|\___|___|
https://aws.amazon.com/amazon-linux-ami/2017.03-release-notes/
1 package(s) needed for security, out of 3 available
Run "sudo yum update" to apply all updates.
[machine-info/] $


Note:
By default, JDK version .7 is installed on VM. You can change it to JDK version 8

Friday, August 14, 2015

Error on JBoss 6.2 while calling webservice when wsdl:binding tag is before wsdl:portType in WSDL

Exception while calling webservice call Jboss server when wsdl:binding tag is before wsdl:portType tag  in wsdl. 

Stack trace for error :
13:29:59,406 INFO  [stdout] (http-localhost/127.0.0.1:8080-1) Caused by: java.lang.NullPointerException
13:29:59,406 INFO  [stdout] (http-localhost/127.0.0.1:8080-1) at com.ibm.wsdl.xml.WSDLReaderImpl.parseExtensibilityAttributes(WSDLReaderImpl.java:1334)
13:29:59,407 INFO  [stdout] (http-localhost/127.0.0.1:8080-1) at com.ibm.wsdl.xml.WSDLReaderImpl.parseOperation(WSDLReaderImpl.java:1684)
13:29:59,407 INFO  [stdout] (http-localhost/127.0.0.1:8080-1) at com.ibm.wsdl.xml.WSDLReaderImpl.parsePortType(WSDLReaderImpl.java:1474)
13:29:59,407 INFO  [stdout] (http-localhost/127.0.0.1:8080-1) at com.ibm.wsdl.xml.WSDLReaderImpl.parseDefinitions(WSDLReaderImpl.java:313)
13:29:59,407 INFO  [stdout] (http-localhost/127.0.0.1:8080-1) at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(WSDLReaderImpl.java:2265)
13:29:59,407 INFO  [stdout] (http-localhost/127.0.0.1:8080-1) at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(WSDLReaderImpl.java:2251)
13:29:59,407 INFO  [stdout] (http-localhost/127.0.0.1:8080-1) at org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:261)
13:29:59,407 INFO  [stdout] (http-localhost/127.0.0.1:8080-1) at org.apache.cxf.wsdl11.WSDLManagerImpl.getDefinition(WSDLManagerImpl.java:206)
13:29:59,407 INFO  [stdout] (http-localhost/127.0.0.1:8080-1) at org.apache.cxf.wsdl11.WSDLServiceFactory.(WSDLServiceFactory.java:98)
13:29:59,408 INFO  [stdout] (http-localhost/127.0.0.1:8080-1) at org.apache.cxf.jaxws.ServiceImpl.initializePorts(ServiceImpl.java:204)
13:29:59,408 INFO  [stdout] (http-localhost/127.0.0.1:8080-1) at org.apache.cxf.jaxws.ServiceImpl.(ServiceImpl.java:149)
13:29:59,408 INFO  [stdout] (http-localhost/127.0.0.1:8080-1) at org.jboss.wsf.stack.cxf.client.ProviderImpl$JBossWSServiceImpl.(ProviderImpl.java:509)
13:29:59,408 INFO  [stdout] (http-localhost/127.0.0.1:8080-1) at org.jboss.wsf.stack.cxf.client.ProviderImpl.createServiceDelegate(ProviderImpl.java:204)
13:29:59,408 INFO  [stdout] (http-localhost/127.0.0.1:8080-1) at javax.xml.ws.Service.(Service.java:57)

Reason:
JBoss uses wsdl4j-1.6.2.redhat-6.jar (Jboss version 6.2), which does not contain fix for the issue.
Path to jar in JBoss : \jboss-eap-6.2\modules\system\layers\base\javax\wsdl4j\api\main

[A NPE occurs when parsing a WSDL with the defined before the element. See stack trace below. The cause is in parseOperation - the line that sets 'op' to null if retrieved = true should be moved after the invocation of parseExtensibilityAttributes]

Detailed information is available at:  http://sourceforge.net/p/wsdl4j/bugs/37/


Sunday, January 4, 2015

Spring Notes : What is Spring Framework

What is Spring Framework?
Spring is a lightweight  framework for building Enterprise applications using Java. It provides all infrastructure support for developing applications. You can build your applications using POJO (Plain old java objects) without worrying about enterprise service code like transaction management, logging etc. It is a modular framework which helps you to use only those modules which are required for your application. You can easily integrate Spring features with other frameworks like Hibernate, Struts etc. Dependency Injection is main feature of Spring.

Dependency Injection:
Dependency Injection is core of Spring framework. In Dependency Injection, Container is responsible for Object Life-cycle (object creation, resolving dependencies for object etc) and enterprise applications can be built using POJO's. It can be achieved using configuration files or annotations.

Different modules of Spring:
1. Core container: Core, Beans, Context, Spring Expression language(SpEL) modules
2. Spring AOP (Aspect oriented programming) :AOP module
3. Data Access/ Integration: JDBC, ORM, OMX, JMS, Transactions modules
4. Web: Web, Web-Servlet, Web-Socket, Web-Portlet modules
5. Test : Test module for testing Spring components usinh JUnit or TestNG frameworks.