Search This Blog

Thursday, December 10, 2015

Newralic Setup


1) download newralic.zip 3.1.1
extract and paste it into jboss home
ex: D:/jboss-eap-6.1/newrelic

2) go to cmd
type

java -jar newralic.jar install


3)we can see the entry in standalone.bat if it is eap6.0
    set JAVA_OPTS=-javaagent:"D:/jboss-eap-6.1/newrelic/newrelic.jar" %JAVA_OPTS%

so while run..
please add this line


-javaagent:D:/jboss-eap-6.1/newrelic/newrelic.jar


4) if u run from eclipse
open your server [double click].
open launch configuration
VM arguments


add this line -javaagent:D:/jboss-eap-6.1/newrelic/newrelic.jar

start the server

Jboss - EAP - JPA error

1. X:\jboss-eap-6.2\modules\system\layers\base\javax\persistence\api\main\module.xml 
modifiy :    export="false"

2. X:\jboss-eap-6.2\modules\system\layers\base\javaee\api\main
modify : export="false"

   

3. Open standalone.xml or standalone-full.xml etc..
    go to

    html comment that block to avoid exceptions


Jboss EAP 6+ HornetQ setup



1)      Add this in standalone-full.xml under   
1.1 Change the max size bytes , default 10 MB
                   
                        jms.queue.DLQ
                        jms.queue.ExpiryQueue
                        0
                        20971520
                        BLOCK
                        10
                   
 
1.1 Add the below line after 
tag.


                   
                       
                       
                   
                   
                       
                       
                   
             
                   
                        
                       
                   
                   
                       
                        
                   
              
                   
                       
                       
                   
                       
                       
                   

                   
                       
                       
                   
              
                   
                       
                       
                   
                   
                       
                       
                   
              
                   
                       
                       
                   
                   
                       
                       
                   
                       
                       
                    

               

2)      Add new user for JMS through add-user.bat
X:\> add-user.bat
b
ApplicationRealm
jmsUser
password
yes

                check in mgm-users.properties, application-users.properties like below line [new user with pwd]
jmsUser=aeadcf105686eafa6afc994e86a520db

3)      Add the below line into applicaiton-roles.properties
jmsUser=guest
3.5) Start the server
D:\EAP-6.0.0.GA\jboss-eap-6.0\bin>standalone.bat -b 192.168.7.9 -Djboss.server.default.config=standalone-full.xml
Or
D:\EAP-6.0.0.GA\jboss-eap-6.0\bin>standalone.bat -b 192.168.7.9 –c standalone-full.xml

4)      Sender1.java
/**
 *
 */
package com.test;

import java.util.Hashtable;

import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.Destination;
import javax.jms.MessageProducer;
import javax.jms.Queue;
import javax.jms.Session;
import javax.jms.TextMessage;
import javax.naming.Context;
import javax.naming.InitialContext;

public class Sender1
{
                public static void main ( String [] args )
                {

                                try
                                {

                                                Hashtable env = new Hashtable ();
                                                env.put ( Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory" );
                                                env.put ( Context.PROVIDER_URL, "remote://192.168.7.9:4447" );
                                                env.put ( Context.SECURITY_PRINCIPAL, "jmsUser" );
                                                env.put ( Context.SECURITY_CREDENTIALS, "password" );
                                                Context context = new InitialContext ( env );

                                                ConnectionFactory cf = (ConnectionFactory) context.lookup ( "jms/RemoteConnectionFactory" );
                                                Destination destination = (Destination) context.lookup ( "jms/queue/test" );
                                                Connection connection = cf.createConnection ( "jmsUser", "password" );
                                                Session session = connection.createSession ( false, Session.AUTO_ACKNOWLEDGE );
                                                Queue queue = (javax.jms.Queue) context.lookup ( "jms/queue/test" );

                                                TextMessage textMessage = session.createTextMessage ();
                                                textMessage.setText ( "hello vijay 3" );
                                                javax.jms.MessageProducer producer = session.createProducer ( destination );
                                                producer.send ( textMessage );

                                                System.out.println ( "Sending Done " );

                                                // Close the session and connection resources.
                                                // context.close();
                                                session.close ();
                                                connection.close ();

                                }
                                catch ( Exception ex )
                                {

                                                ex.printStackTrace ();

                                }

                }

}


5)      Add your spring+hornetq+remote+listener application into Jboss-eap-6.0\ Standalone \ deployments folder and change your settings according to your remote IP in applicationContext and start the server to receive.


For ex: D:\works\SdexSOA\MessageQueueSOA\WebContent\WEB-INF\applicationContext.xml



6)      If it is spring, add like below in application-context.xml
For ex:-
<bean id="destinationMail" class="org.springframework.jndi.JndiObjectFactoryBean">
       <property name="jndiTemplate" ref="jnditemplate" />
       <property name="jndiName" value="jms/queue/mail" />
</bean>
      
<bean class="org.springframework.jms.listener.SimpleMessageListenerContainer">
       <property name="connectionFactory" ref="credentialsconnectionfactory" />
       <property name="destination" ref="destinationMail" />
       <property name="messageListener" ref="receiverMail" />
</bean>
      
<bean id="receiverMail" class="com.gnax.sdex.soa.service.JMSReceiverService" />



7)      JMSReceiverService.java

package com.gnax.sdex.soa.service;

import java.util.Date;

import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.ObjectMessage;
import javax.jms.Queue;

import com.gnax.sdex.soa.bean.common.EmailBean;
import com.gnax.sdex.soa.utils.ConfigManager;
import com.gnax.sdex.soa.utils.EMail;
import com.gnax.sdex.soa.utils.JMSReceiverHelper;
import com.gnax.sdex.soa.vo.PatientInfoVO;

/**
 * @author Vijay .D.R
 * @version 1.0, 11/1/2013
 * @since 1.0
 */

public class JMSReceiverService implements MessageListener
{

                public JMSReceiverService ()
                {
                }

                public void onMessage ( Message message )
                {
                                try
                                {
                                                // TextMessage text = (TextMessage) message;
                                                ObjectMessage objectMessage = (ObjectMessage) message;
                                                Queue queue = (Queue) message.getJMSDestination ();
                                                // System.out.println ( queue.getQueueName () );

                                                if ( queue.getQueueName ().equals ( ConfigManager.getPropertyValue ( "destination.mail.queueName" ) ) )
                                                {
                                                                System.out.println ( queue.getQueueName () );
                                                                EmailBean emailBean = (EmailBean) objectMessage.getObject ();
                                                                message.acknowledge ();
                                                                // System.out.println ( new Date () + " : received the following message : " + text.getText () );
                                                                EMail.getEmailInstance ().sendEmail ( emailBean.getTo (), emailBean.getCc (), emailBean.getBcc (), emailBean.getSubject (), emailBean.getBodyContent () );
                                                                System.out.println ( new Date () + " : received the following message : " + emailBean.getFrom () );
                                                }
                                                else if ( queue.getQueueName ().equals ( ConfigManager.getPropertyValue ( "destination.sms.queueName" ) ) )
                                                {
                                                                System.out.println ( queue.getQueueName () );
                                                }
                                                else if ( queue.getQueueName ().equals ( ConfigManager.getPropertyValue ( "destination.fax.queueName" ) ) )
                                                {
                                                                System.out.println ( queue.getQueueName () );
                                                }
                                                else if ( queue.getQueueName ().equals ( ConfigManager.getPropertyValue ( "destination.auditTrail.queueName" ) ) )
                                                {
                                                                System.out.println ( queue.getQueueName () );
                                                }
                                                else if ( queue.getQueueName ().equals ( ConfigManager.getPropertyValue ( "destination.hlSeven.queueName" ) ) )
                                                {
                                                                System.out.println ( queue.getQueueName () );
                                                                PatientInfoVO patientInfoVO = (PatientInfoVO) objectMessage.getObject ();
                                                                message.acknowledge ();
                                                                new JMSReceiverHelper ().addOrUpdatePatientDetails ( patientInfoVO );
                                                }
                                }
                                catch ( JMSException e )
                                {
                                                e.printStackTrace ();
                                }
                                catch ( Exception e )
                                {
                                                e.printStackTrace ();
                                }
                }

}



NOTE: QUEUE or TOPIC name should not be contains numeric/special char..  [ like hl7Queue ]

Add - Remove Column in MongoDB


// add new column and with default value
db.order.update({}, {$set: {"status": 'NEW'}},{multi:true})

//remove a column
db.order.update({}, {$unset: {"status": ''}},{multi:true})

MongoDB - Update statement

//update
db.documentName.update({'_id': ObjectId('566136f3e4b03044bfb8b37e'),'attributeName':'existing-value'},{$set:{'sameAttributeName':'New-value'}})

sample

db.order.update({'_id': ObjectId('566136f3e4b03044bfb8b37e'),'status':'NEW'},{$set:{'status':'COMPLETE'}})







db.login.update({'_id': ObjectId('5667a7ffe4b04ebafe56122e'),'password':'','email':'','mobileNumber':''},{$set:{'password':'qwerty','email':'drvijayy2k2@gmail.com','mobileNumber':'9842088860'}})

Mongo setup - DB - User creation

1.     install mongodb x.x

2.     go to c: drive and create two folder
    C:\data
    C:\data\db

2.    type mongo [ command prompt / use robo mongo ui ]

3.      create user and db [type ]
        use gcdr
        db.createUser({user: "test",pwd: "test",roles: [ "readWrite", "dbAdmin" ]  } )

4.     db authenticate [type ]

     db.auth ("test","test");


ENJOY

Maven Install in linux

Maven
******

 
    sudo apt-get install maven

    sudo update-alternatives --config mvn

Git install in Linux - Ubunto

sudo apt-get install git-core

MongoDB Install in Linux

1.    Install MongoDB
    Import the public key used by the package management system.

    sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10

2. Create a list file for MongoDB.

    echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list

3 Reload local package database.

    sudo apt-get update

4 Install the MongoDB packages.

    sudo apt-get install -y mongodb-org

4.1 Install a specific release of MongoDB.

    sudo apt-get install -y mongodb-org=3.0.7 mongodb-org-server=3.0.7 mongodb-org-shell=3.0.7 mongodb-org-mongos=3.0.7 mongodb-org-tools=3.0.7

5. Start MongoDB.


    sudo service mongod start

5.1 Verify that MongoDB has started successfully
    Verify that the mongod process has started successfully by checking the contents of the log file at /var/log/mongodb/mongod.log for a line reading

6 Stop MongoDB.

    sudo service mongod stop

7 Restart MongoDB.
   
    sudo service mongod restart

8. mongodb - uninstall

    sudo service mongod stop
    sudo apt-get purge mongodb-org*
    sudo rm -r /var/log/mongodb
    sudo rm -r /var/lib/mongodb

Install Java JDK in linux

    Installing Java 8
        $ sudo add-apt-repository ppa:webupd8team/java
        $ sudo apt-get update
        $ sudo apt-get install oracle-java8-installer

    Verify java
        $ java -version

    Configuring Java Environment
        $ sudo apt-get install oracle-java8-set-default

Wednesday, October 7, 2015

Run Open ATNA, XDS, PixPdq Steps

Open ATNA
*********


1. Goto cmd
cd D:\works\BlueCap\POC\openatna\trunk\openatna\all\build

2. java -jar openatna-1.2.1-SNAPSHOT.jar

3. open jboss dev stuido workspace  D:\jbdevstudio\workspace\Blue-Cap\openatna
    run junit


Open XDS
********


1. goto cmd D:\works\BlueCap\POC\openxds\tags\build

2. java -jar openxds-1.0.jar

3. open jboss dev stuido workspace  D:\jbdevstudio\workspace\Blue-Cap
 run ProvideAndRegisterDocumentSetTest.java 


SRC Folder : D:\works\BlueCap\POC\openxds\tags\openxds-1.0-20100309\openxds-core\src\test\java\org\openhealthtools\openxds\integrationtests\

4. use test.properties to change the patient id and check that in personidentifier table in protgres



Open Pixpdq
***********


1. goto Tomcat6.0 and run with openpixpdq.war

2. http://localhost:8080/openpixpdq/
   goto configuration module/menu
   load file : D:\works\BlueCap\POC\openpixpdq\trunk\OpenPIXPDQ\conf\tests\actors\IheActors.xml
3. go down in the same page, select all the check box and give one log file path & save it

4. Go to other screens and test it
    Create a patient and see it in postgres openempi database person_identifier


or
simple open jboss dev stuido workspace  D:\jbdevstudio\workspace\open-pixpdq

FOLLOW 1,2 steps to start 3600 port for pix manager to run directly from IDE

open TestPixFeed.java
    & run junit
FOLDER: D:\works\BlueCap\POC\openpixpdq\trunk\OpenPIXPDQ\src\test\org\openhealthexchange\openpixpdq\ihe\impl_v2\

NOTE: open openpixpdq context , not in trunk, other wise you cannot see junit in right click run as-> junit



if you want to run with dynamically 100 port, such as 8080 to 8180 ....
 x:\>   standalone.bat -Djboss.server.default.config=standalone-full.xml -Djboss.socket.binding.port-offset=100

Friday, May 8, 2015

Sonarqube Setup and Upgrade

Setup and Upgrade

To give a quick try at SonarQube, just follow the tutorial below.
To install a production instance, follow the installation guide.
To upgrade your SonarQube instance, read the upgrade guide and the related upgrade notes.

Get Started in Two Minutes

1. Download and unzip the SonarQube distribution (let's say in "C:\sonarqube" or "/etc/sonarqube")

2. Start the SonarQube server:
# On Windows, execute:
C:\sonarqube\bin\windows-x86-xx\StartSonar.bat
 # On other operating system, execute:
/etc/sonarqube/bin/[OS]/sonar.sh console
3. Download and unzip the SonarQube Runner (let's say in "C:\sonar-runner" or "/etc/sonar-runner")

4. Download and unzip some project samples (let's say in "C:\sonar-examples" or "/etc/sonar-examples")

5. Analyze a project:
# On Windows:
cd C:\sonar-examples\projects\languages\java\sonar-runner\java-sonar-runner-simple
C:\sonar-runner\bin\sonar-runner.bat
# On other operating system:
cd /etc/sonar-examples/projects/languages/java/sonar-runner/java-sonar-runner-simple
/etc/sonar-runner/bin/sonar-runner
6. Browse the results at http://localhost:9000 (default System administrator credentials are admin/admin)

7. open x:\apache-maven-3.2.3\conf\settings.xml, paste under  (optional)

 <settings>
    <pluginGroups>
        <pluginGroup>org.sonarsource.scanner.maven</pluginGroup>
    </pluginGroups>
    <profiles>
        <profile>
            <id>sonar</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <properties>
                <!-- Optional URL to server. Default value is http://localhost:9000 -->
                <sonar.host.url>
                  http://myserver:9000
                </sonar.host.url>
            </properties>
        </profile>
     </profiles>
</settings>

           
       



8. in your project root pom.xml,
 8.1  paste under 
 UTF-8
java



8.2paste under
               

 <build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>2.6</version>
</plugin>
</plugins>
</pluginManagement>
</build>                    

               

OR

       <build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>3.6.0.1398</version>
</plugin>
</plugins>
</pluginManagement>
</build>

9. Go to cmd, your project root folder and type 

mvn clean install
mvn sonar:sonar

10. goto http://localhost:9000  [under projects you can see the reports]

11. If you want Html report
mvn sonar:sonar -Dsonar.analysis.mode=preview -Dsonar.issuesReport.html.enable=true
under your /target/sonar/issues-report folder you can see the html
http://docs.sonarqube.org/display/SONAR/Setup+and+Upgrade

Hit Counter


View My Stats