Search This Blog

Friday, October 05, 2012

How to Capture offending sql of ORA-00001 error

 

Using sql*plus run the sql
 
alter system set events='0001 trace name errorstack level 12';

Now login to other session and run the command ,

SQL> oradebug setmypid
Statement processed.
SQL> oradebug eventdump system
1 trace name ERRORSTACK level 12 >>>> This indicates event is present in the DB

Please also check the folloine note , to check for the events in the db
How To List All The Named Events Set For A Database (Doc ID 436036.1)

Simulate the error of ORA-00001 ,

create table a1(a number primary key);
insert into a1 values (1);
commit;


SQL> insert into a1 values (1);
insert into a1 values (1)
*
ERROR at line 1:
ORA-00001: unique constraint (SCOTT.SYS_C0079247) violated

SQL> show parameters user_dump_dest

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
user_dump_dest                       string      /home/ias/oracle/product/10.2.0/db10gr2/admin/db10gr2/udump

In the latest file you will find the entries as ,

*** 2012-10-05 14:00:11.038
ksedmp: internal or fatal error
ORA-00001: unique constraint (SCOTT.SYS_C0079247) violated
Current SQL statement for this session:
insert into a1 values (1)
----- Call Stack Trace -----

Turn off the debug logs ,
SQL> alter system set events='1 trace name errorstack off';

To confirm whether the event is off or not run the following ,

SQL> oradebug setmypid
Statement processed.
SQL> oradebug eventdump system

Statement processed.

Monday, September 24, 2012

Using DocFetcher tool as local search engine

 

http://docfetcher.sourceforge.net/en/index.html

DocFetcher is an open source desktop search application that runs on Microsoft Windows, Mac OS X and Linux.
It is written in Java and has a Standard Widget Toolkit based graphical user interface.

DocFetcher's indexing and searching facilities are based on Apache Lucene, a widely used open source search engine.
Contents

    1 Features
    2 Portability
    3 Pairing of HTML files
    4 See also
    5 External links

Features

    Supports all major document formats, including PDF, HTML, Microsoft Office and OpenOffice.org
    Supported archive formats: zip, 7z, rar, tar.*
    Can search in Outlook emails (PST files)
    Can be customized to index any kind of source code file
    Automatically updates its indexes whenever files are modified
    Exclusion of files from indexing based on regular expressions

Portability

DocFetcher is available as a portable version, which allows the user to bundle DocFetcher and his or her personal files in order to create a portable and searchable "document repository". Portable means the user may for instance carry around this repository on a USB drive, or a synchronize it over multiple computers via a file synchronization service. Also, due to the fact that DocFetcher is Java-based, this repository can be accessed from different platforms, e.g. from Windows as well as from Linux.
Pairing of HTML files

How to use DocFetcher tool to Index your book mark pages and other online pages that of interest to you

You can use the ScrapBook (Firefox plugin) for this purpose.
https://addons.mozilla.org/en-US/firefox/addon/scrapbook/

ScrapBook is a Firefox plugins that allows you to save web pages and manage your collection of saved pages.
DocFetcher can be used for full-text search in your ScrapBook collection.

Store all the scrapbook collection to some directory and add this directory to the DocFether tool for indexing.

SOA 11g NTLM Setup

This article explains how to configure NTLM protected web Service from the SOA 11g , 

This contains all the steps required to configure a Active Directory , DNS Server and NTLM based Web Service and integrating with SOA 11g etc.

As the setup needs lot of manual setup's I documented all the important steps so that you will not be wasting much time like I did in this case ,

Important points :-
Create a AD Domain first , make sure you select the DNS Server part of this AD Setup , if you do not select this step then NTLM may not work properly.

You can use the tool , dcpromo for this purpose ,

Refer to this blog for the Active Directory Install ,

http://helpdeskgeek.com/how-to/windows-2003-active-directory-setupdcpromo/

Open the DNS Server Setup on the Windows 2003 machine and put your actual DNS machine as forward DNS to this DNS Sever. 

Image(11)

And Add the DNS Servers To the list , 

Image(12)

and restart the Windows 2003 domain , 

Now login in to the test Windows XP machine

In the DNS Server specificy the your Active Directory Machine name , As you have to setup your main DNS Server

as the forward DNS in the Windows 2003 , you will not have any problems in accessing the other machines in your setup.

Image(13)

Go to My Computer Properties and use the AD Domain machine , for example ,

Image(14)

Create a test user from Windows 2003 domain and use this user to login to Windows 2003 domain , for example

Image(4)

Now install the IIS Server on the Windows 2003 machine , Click on Add or Remove programs and Add/Remove Windows Components

Image(5)

Install .Net FrameWork SDK , i.e .NET 4.0.X on this machine ,

Invoke the inetmgr (IIS Admin tool ) and Create a Virtual Directory say c:\temp\test1

Image(6)

Under Directory Server for this Virtual Directory remove the Enable Anonymous access and click 

on Integrated Windows Authentication ,

Image(7)

Create a Simple HTML File with the following on this ,

<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<title>Test Page IIS</title>
</head>
<body>
Hello Test<br>
</body>
</html> 

Access the URL using ,

http://iscsoavm10.mydomain.com/test1/test.html

This asks for a username and password on a plain machine , 

If you access this URL using a machine , that is already logged in to this domain , then it will not ask for the password. This is what NTLM about.

For testing the ASP.Net file create the following test.aspx file ,

<%@ Page Language="C#" %>
<html>
<head>
<title>ASP.NET Hello World</title>
</head>
<body bgcolor="#FFFFFF">
<p><%= "Hello World!" %></p>
<p><%= User.Identity.Name %></p>
</body>
</html>

Copy this file in c:\temp\test1 directory and run the

http://iscsoavm10.mydomain.com/test1/test.aspx

This displays the o/p as 

Hello World!

ISCSOAVM100\Administrator

Using Visual C# Studio create a Sample Web Service 

In the Web.config file have the following entries ,

==========================================================================================

<?xml version="1.0"?>
<configuration>
  <appSettings/>
  <connectionStrings/>
  <system.web>
    <compilation>
    </compilation>
    <!--
        The <authentication> section enables configuration
        of the security authentication mode used by
        ASP.NET to identify an incoming user.
    -->
    <authentication mode="Windows" />
    <!--
        The <customErrors> section enables configuration
        of what to do if/when an unhandled error occurs
        during the execution of a request. Specifically,
        it enables developers to configure html error pages
        to be displayed in place of a error stack trace.
        <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
         <error statusCode="403" redirect="NoAccess.htm"/>
         <error statusCode="404" redirect="FileNotFound.htm"/>
        </customErrors>
      -->
  </system.web>
  <system.webServer>
    <!--
        To browse web app root directory during debugging, set the value below to true.
        Set to false before deployment to avoid disclosing web app folder information.
      -->
    <directoryBrowse enabled="true"/>
  </system.webServer>
  <system.serviceModel>
    <services>
      <service name="WcfService3.Service1" behaviorConfiguration="WcfService3.Service1Behavior">
        <!-- Service Endpoints -->
        <endpoint address="" binding="basicHttpBinding"  bindingConfiguration="BasicHttpEndpointBinding" contract="WcfService3.IService1">
          <!--
              Upon deployment, the following identity element should be removed or replaced to reflect the
              identity under which the deployed service runs.  If removed, WCF will infer an appropriate identity
              automatically.
          -->
          <identity>
            <dns value="localhost"/>
          </identity>
        </endpoint>
        <endpoint address="mex" binding="basicHttpBinding"    contract="IMetadataExchange" bindingConfiguration="BasicHttpEndpointBinding" />
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="WcfService3.Service1Behavior">
          <!-- To avoid disclosing metadata information, set the value below to false before deployment -->
          <serviceMetadata httpGetEnabled="true"/>
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
     <bindings>
<basicHttpBinding>
<binding name="BasicHttpEndpointBinding">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows" />
</security>
</binding>
</basicHttpBinding>
</bindings>
  </system.serviceModel>
</configuration>

==========================================================================================

The important one's are 

     <bindings>
<basicHttpBinding>
<binding name="BasicHttpEndpointBinding">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows" />
</security>
</binding>
</basicHttpBinding>
</bindings>

  <endpoint address="" binding="basicHttpBinding"  bindingConfiguration="BasicHttpEndpointBinding" contract="WcfService3.IService1">

   <endpoint address="mex" binding="basicHttpBinding"    contract="IMetadataExchange" bindingConfiguration="BasicHttpEndpointBinding" />

With out this , you may get lot of exceptions like 'anonymous' users are not allowed etc ,

Web Service Code 

---------------------

using System;

using System.Collections.Generic;

using System.Runtime.Serialization;

using System.ServiceModel;

using System.Text;

using System.Web;

using System.ServiceModel;

namespace WcfService3

{

// NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Service1" in code, svc and config file together.

// NOTE: In order to launch WCF Test Client for testing this service, please select Service1.svc or Service1.svc.cs at the Solution Explorer and start debugging.

public class Service1 : IService1

    {

public string GetData( int value)

        {

//  OperationContext.Current.ServiceSecurityContext.WindowsIdentity.Name

// Create stream writer object and pass it the file path

StringBuilder sw = new StringBuilder ();

            sw.AppendLine( "--------> " + value);

return string.Format( "You entered: {0}", sw.ToString());

        }

public CompositeType GetDataUsingDataContract(CompositeType composite)

        {

if (composite == null)

            {

throw new ArgumentNullException("composite" );

            }

if (composite.BoolValue)

            {

                composite.StringValue += "Suffix";

            }

return composite;

        }

    }

}

Web Services Interface Code 

===========================

using System;

using System.Collections.Generic;

using System.Runtime.Serialization;

using System.ServiceModel;

using System.Text;

namespace WcfService3

{

// NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IService1" in both code and config file together.

    [ServiceContract]

public interface IService1

    {

        [ OperationContract]

string GetData( int value);

        [ OperationContract]

CompositeType GetDataUsingDataContract(CompositeType composite);

// TODO: Add your service operations here

    }

// Use a data contract as illustrated in the sample below to add composite types to service operations.

    [DataContract]

public class CompositeType

    {

bool boolValue = true;

string stringValue = "Hello ";

        [ DataMember]

public bool BoolValue

        {

get { return boolValue; }

set { boolValue = value; }

        }

        [ DataMember]

public string StringValue

        {

get { return stringValue; }

set { stringValue = value; }

        }

    }

}

From Visual Studio Create a New Publish Profile with the directory as say c:\temp\test

and publish this Web Service to this directory.

If the C# Visual studio and IIS server are there on a different machines then copy the  contents c:\temp\test to the IIS Server directory.

From the Browser access the URL ,

http://iscsoavm10.mydomain.com/test1/Service1.svc

This should ask for a password, enter the username as test and Welcome1.

Now from SOAP UI 

Image(15)

Image(9)

Click on Auth from the SOAP UI

Image(16)

From JDeveloper you have to first download the wsdl file and the related XSD files manually ,

First download the wsdl file , 

http://iscsoavm10.iscsoavm10.mydomain.com/Test1/Service1.svc?wsdl

In this wsdl file , you will find you need 3 xsd files ,

<xsd:import schemaLocation="http://iscsoavm10.iscsoavm10.mydomain.com/Test1/Service1.svc?xsd=xsd0" namespace="http://tempuri.org/"/>

<xsd:import schemaLocation="http://iscsoavm10.iscsoavm10.mydomain.com/Test1/Service1.svc?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/"/>

<xsd:import schemaLocation="http://iscsoavm10.iscsoavm10.mydomain.com/Test1/Service1.svc?xsd=xsd2" namespace="http://schemas.datacontract.org/2004/07/WcfService3"/>

Download the xsd files ,

http://iscsoavm10.iscsoavm10.mydomain.com/Test1/Service1.svc?xsd=xsd0 as xsd0.xsd

http://iscsoavm10.iscsoavm10.mydomain.com/Test1/Service1.svc?xsd=xsd1  as xsd1.xsd

http://iscsoavm10.iscsoavm10.mydomain.com/Test1/Service1.svc?xsd=xsd2  as xsd2.xsd

and change the downloaded wsdl file 

<xsd:import schemaLocation="xsd/xsd0.xsd" namespace="http://tempuri.org/"/>

<xsd:import schemaLocation="xsd/xsd2.xsd" namespace="http://schemas.microsoft.com/2003/10/Serialization/"/>

<xsd:import schemaLocation="xsd/xsd2.xsd" namespace="http://schemas.datacontract.org/2004/07/WcfService3"/>

And create a simple BPEL to call this service , 

In the composite.xml file have the following entries ,

oracle.webservices.auth.username

oracle.webservices.auth.password

oracle.webservices.preemptiveBasicAuth as false ,

for example , 

<binding.ws port="http://tempuri.org/#wsdl.endpoint(Service1/BasicHttpBinding_IService1)"
                location="test1.wsdl" soapVersion="1.1">
      <property name="weblogic.wsee.wsat.transaction.flowOption"
                type="xs:string" many="false">WSDLDriven</property>
                 <property name="oracle.webservices.auth.username"  type="xs:string" many="false">test</property>
                 <property name="oracle.webservices.auth.password"  type="xs:string" many="false">Welcome1</property>
                 <property name="oracle.webservices.preemptiveBasicAuth"  type="xs:string" many="false">false</property>
    </binding.ws>

You can also set these properties from EM Console , 

Click on your SOA project , and Services and References

and Click on Web Service you are calling and Click on the Proprties TAB , here you can enter the values for 

oracle.webservices.auth.username

oracle.webservices.auth.password

oracle.webservices.preemptiveBasicAuth

Image(17)

Thursday, July 12, 2012

How to run a unix command remotely using java

 

Download the jar file from ,

http://www.jcraft.com/jsch/

http://nchc.dl.sourceforge.net/project/jsch/jsch.jar/0.1.48/jsch-0.1.48.jar

package test1;
import com.jcraft.jsch.*;
import java.io.*;
public class Class2 {
  public Class2() {
    super();
  }
  public static void main(String[] args) throws Exception {
    testconnect();
  }
      public static void testconnect() throws JSchException, IOException {
           String userName = "xxxx";
           String password ="xxxx";
           String hostName = "xxx.xx.oracle.com";
           int port = 22;
        String sdstestCommand = "env";
              JSch jsch = new JSch();
              Session session = jsch.getSession(userName, hostName, port);
              session.setConfig("StrictHostKeyChecking", "no");
              session.setPassword(password);
              session.connect();    
              ChannelExec channel = (ChannelExec) session.openChannel("exec");
              channel.setCommand(sdstestCommand);
              channel.setInputStream(null);
              ((ChannelExec) channel).setErrStream(System.err);
              InputStream in = channel.getInputStream();
              channel.connect();
              System.out.println("Unix system connected...");
              byte[] tmp = new byte[1024];
              while (true){
                  while (in.available() > 0) {
                      int i = in.read(tmp, 0, 1024);
                      if (i < 0) {
                          break;
                      }
                      String line = new String(tmp, 0, i);
                      System.out.println("Unix system console output: " +line);
                  }
                  if (channel.isClosed()){
                      break;
                  }
                  try {
                      Thread.sleep(1000);
                  } catch (Exception ee){
                      //ignore
                  }
              }
              channel.disconnect();
              session.disconnect();     
          }
    }

Wednesday, July 11, 2012

SOA 11g using ant scripts to deploy and undeploy

 

1. First Set JAVA_HOME

set JAVA_HOME=D:\fmw1115\Middleware\jdk160_24

2. set PATH=D:\fmw1115\Middleware\modules\org.apache.ant_1.7.1\bin;%PATH%
3. cd D:\fmw1115\Middleware\jdeveloper\bin

4. Note the down the directory where your SOA Project is there 

D:\bugs-download\Bug14258512\RuleAPITest\RuleAPITest\HelloSOA

5. Compile and package the soa project

ant -f ant-sca-package.xml -DcompositeDir=D:\bugs-download\Bug14258512\RuleAPITest\RuleAPITest\HelloSOA  -DcompositeName=HelloSOA  -Drevision=1.0  -Dscac.application.home=D:\bugs-download\Bug14258512\RuleAPITest\RuleAPITest
6. Deploy the SOA Project
ant -f ant-sca-deploy.xml  -DserverURL=http://localhost:7001  -DsarLocation=D:\bugs-download\Bug14258512\RuleAPITest\RuleAPITest\HelloSOA\deploy\sca_HelloSOA_rev1.0.jar  -Doverwrite=true  -Duser=weblogic  -Dpassword=xxxxx
7. To undeploy use the following command ,
ant -f ant-sca-deploy.xml  -DserverURL=http://localhost:7001    -Duser=weblogic  -Dpassword=xxxx  -DcompositeName=BR_FndIntg_SimpleRuleIVP -Drevision=6.18 undeploy

 

Using this batch script , you can deploy the same composite with say 100 revisions

----------------
@REM initialize test value to be "true"
@SET intCounter=1
:while
@REM test condition
@IF %intCounter% GTR 100 (GOTO wend)
@REM procedure where condition is "true"
@echo ==============================================================================================================
@echo %intCounter%
Rem call ant -f ant-sca-package.xml -DcompositeDir=D:\bugs-download\Bug14258512\RuleAPITest\RuleAPITest\SimpleRule  -DcompositeName=SimpleRule  -Drevision=%intCounter%.0  -Dscac.application.home=D:\bugs-download
\Bug14258512\RuleAPITest\RuleAPITest
Rem call ant -f ant-sca-deploy.xml  -DserverURL=http://localhost:7001  -DsarLocation=D:\bugs-download\Bug14258512\RuleAPITest\RuleAPITest\SimpleRule\deploy\sca_SimpleRule_rev%intCounter%.0.jar  -Doverwrite=true  -
Duser=weblogic  -Dpassword=xxxxxx
call ant -f ant-sca-deploy.xml  -DserverURL=http://localhost:7001    -Duser=weblogic  -Dpassword=xxxxx-DcompositeName=SimpleRule  -Drevision=%intCounter%.0 undeploy
@REM set new test value
@SET /a intCounter=intCounter+1
@REM loop
@echo ==============================================================================================================
@GOTO while
:wend

-----------------

Monday, June 04, 2012

How to Check whether the Schema is Valid or not in a Java Program

 

import java.io.File;
import javax.xml.XMLConstants;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
public class Test {
  public static void main(String[] args) throws Exception{
      SchemaFactory sf =
SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
    Schema schema =    sf.newSchema(new
File("D:\\temp\\xx1\\InstalledBase.xsd"));
  }
}

Thursday, April 19, 2012

SOA Email James Configuration

 

http://niallcblogs.blogspot.in/2009/10/email-activation-with-oracle-soa-suite.html

http://niallcblogs.blogspot.in/2009/10/email-notifications-with-oracle-soa.html

Download from http://james.apache.org/

Unzip to a directory of your choice

Start James

by running the run.bat or run.sh

on linux you have to start the run.sh as root user , stop the sendmailservice before running

service sendmail stop

telnet localhost 4555 (use the password as root/root)
adduser bpelsender welcome1
adduser bpelreceiver welcome1
adduser jcooper welcome1 

Configure Email client for jcooper, bpelsender etc.
·Configure your email client e.g. thunderbird
File->New->Mail Account 

Give the email account name and email  as jcooper@localhost

Thursday, March 22, 2012

Execute commands remotely from unix shell

 

The ssh command on linux does not support passing the passwords at the command line ,

You need to use the sshpass command. It is a utility designed for running ssh using the mode referred to as "keyboard-interactive" password authentication, but in non-interactive mode. You can install it as follows:

rpm –ivh ftp://ftp.muug.mb.ca/mirror/fedora/epel/5/i386/sshpass-1.05-1.el5.i386.rpm

sshpass -p 'root-password' ssh -o StrictHostKeyChecking=no  root@localhost " du  --exclude=/shared  --exclude=/shared2 -Sm / | sort -nr | head -10"

sshpass -p 'root-password' ssh -o StrictHostKeyChecking=no  root@localhost " uptime "

Tuesday, March 13, 2012

Steps to Apply the JDeveloper stand alone patches

 

First download the standalone opatch using the patch number  5912518.
Assuming my JDev Home is : d:\fmw1115\Middleware\jdeveloper
copy d:\p5912518_111000_GENERIC.zip cd d:\fmw1115\Middleware\jdeveloper
cd d:\fmw1115\Middleware\jdeveloper
unzip -d . p5912518_111000_GENERIC.zip
set  ORACLE_HOME=d:\fmw1115\Middleware\jdeveloper
set PATH=d:\fmw1115\Middleware\jdeveloper\OPatch;%PATH%
cd C:\temp\13607268
First try ,
opatch version -jdk d:\fmw1115\Middleware\jdk160_24
Invoking Standalone OPatch 11.1.0.0.0
OPatch Version: 11.1.0.0.0
OPatch succeeded.
Now Apply the patch using ,
opatch apply -jdk d:\fmw1115\Middleware\jdk160_24
If you are applying the patch for the first time then you will see ,
> OPatch finds no 'product.xml' in Oracle Home and will attempt to create 'product.xml' file.
>
> Attempting to retrieve patch inventory's "product" and its "version" information...
>
> Please enter your choice to enable OPatch to create 'product.xml' file or quit creation...
>
>
> Choice Product Version
> ------ ------- -------
> 1 SA_JDEV 11.1.1.5.0
>
> 2. If you wish, quit 'product.xml' creation
>
> Please enter [1-2]:
> 1
> User Responded with: 1
>
> OPatch will put the information of selected product 'SA_JDEV' and selected version '11.1.1.3.0'
> in product.xml during inventory updation.
> "
Now run the command to verify whether the patch applied or not ,
C:\temp\13607268>opatch lsinventory -jdk d:\fmw1115\Middleware\jdk160_24
To remove the patch  run the command ,
cd C:\temp\13607268
opatch rollback -id 13607268 -jdk d:\fmw1115\Middleware\jdk160_24

How to apply patches to a BPM and/or SOA environment in 11.1.1.3 (Doc ID 1288864.1)

Friday, March 09, 2012

How to measure the time it takes to load a web page

 

Many times you need to find out the how long a web page takes to load when troubleshooting performance related
problems.

Here are the steps that you can use with the WebLogic Server 11g.

Home >Summary of Servers >AdminServer
Click on Loggin TAB -> HTTP and go to the Advanced Options

Select the Format as "Extended"
and add the field " time-taken" to the Extended Logging Format Fields.
For example after adding it will be
"date time cs-method cs-uri sc-status time-taken"

After this you need to restart the Server ,

This is the WLST script to do the same ,

connect('weblogic', 'Welcome1', 't3://localhost:7001')
startEdit()

cd('/Servers/AdminServer/WebServer/AdminServer/WebServerLog/AdminServer')
cmo.setLogFileFormat('extended')
cmo.setELFFields('date time cs-method cs-uri sc-status time-taken')

activate()
disconnect()
exit()

After this you need to restart the Server ,

Check the access_log file entries ,

2012-03-09      14:19:16        GET     /em/faces/targetauth/emasLogin?target=Farm_soa_domain&type=oracle_ias_farm&FromContextInitFilter=true&_afrLoop=18992901037066&_afrWindowMode=0&_afrWindowId=null    200     0.066
2012-03-09      14:19:20        GET     /em/LoginStatusServlet?loginReqTime4emas=rlt_1331282958512_0.31560349677888955  2000.0040

The last column indicates the time.

You can measure the timings from browser also ,

for this use the FireFox version > 4.0 , here you can use the Tools-> Web Console or Tools -> Web Developer -> Web Console option.

Or you can use the fiddler tool to measure the time it takes to load web page ,
download the fiddler from ,
http://fiddler2.com/fiddler2/

Fiddle tool can be used with IE or firefox.

Wednesday, March 07, 2012

Unable to start the WebLogic Server weblogic.security.SecurityInitializationException: Authentication for user weblogic denied

 

Getting the following exception when trying to start the WebLogic Server

<Mar 7, 2012 3:57:29 PM IST> <Critical> <WebLogicServer> <BEA-000386> <Server subsystem failed. Reason: weblogic.security.SecurityInitializationException: Authentication for user weblogic denied
weblogic.security.SecurityInitializationException: Authentication for user weblogic denied
        at weblogic.security.service.CommonSecurityServiceManagerDelegateImpl.doBootAuthorization(CommonSecurityServiceManagerDelegateImpl.java:965)
        at weblogic.security.service.CommonSecurityServiceManagerDelegateImpl.initialize(CommonSecurityServiceManagerDelegateImpl.java:1050)
        at weblogic.security.service.SecurityServiceManager.initialize(SecurityServiceManager.java:873)
        at weblogic.security.SecurityService.start(SecurityService.java:141)
        at weblogic.t3.srvr.SubsystemRequest.run(SubsystemRequest.java:64)
        Truncated. see log file for complete stacktrace
Caused By: javax.security.auth.login.FailedLoginException: [Security:090303]Authentication Failed: User weblogic weblogic.security.providers.authentication.LDAPAtnDelegateException: [Security:090295]caught unexpected exception
        at weblogic.security.providers.authentication.LDAPAtnLoginModuleImpl.login(LDAPAtnLoginModuleImpl.java:251)
        at com.bea.common.security.internal.service.LoginModuleWrapper$1.run(LoginModuleWrapper.java:110)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.bea.common.security.internal.service.LoginModuleWrapper.login(LoginModuleWrapper.java:106)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        Truncated. see log file for complete stacktrace


Follow the following steps:
1: remove the boot.properties file completely from the managed server directory.
2: remove the ManagedServerDir/data/ldap directory completely.
3: Always keep backup of files before removing it.
4: Now try to start the server from the command prompt and provide the username/password used to login to the Admin Console.

Monday, March 05, 2012

WLST SOA MBeans Examples

 

// Get the deployed Composites

connect('weblogic', 'Welcome1', 't3://localhost:7001')
domainRuntime()
soaBean = ObjectName('oracle.soa.config:Location=AdminServer,name=soa-infra,j2eeType=CompositeLifecycleConfig,Application=soa-infra')
print soaBean
composites = mbs.getAttribute(soaBean, 'DeployedComposites')
for composite in composites: 
print 'composite: ',composite 
disconnect()
exit()


// Change the Composite auditLevel to Development

print 'starting the script ....'
username = 'weblogic'
password = 'Welcome1'
url='t3://localhost:7001'

connect(username,password,url)

domainRuntime()

helloworldComposite = ObjectName('oracle.soa.config:Location=AdminServer,partition=default,j2eeType=SCAComposite,revision=1.0,label=soa_2073ceb3-d703-453f-8867-79d3b44d637c,Application=soa-infra,wsconfigtype=WebServicesConfig,name="File1"')
print helloworldComposite
params = ['auditLevel','Development']
sign = ['java.lang.String','java.lang.String']
mbs.invoke(helloworldComposite, 'setProperty', params, sign)
print mbs.getAttribute(helloworldComposite, 'Properties')
disconnect()
exit()
disconnect()
exit()


// Print the Composite Properties

print 'starting the script ....'
username = 'weblogic'
password = 'Welcome1'
url='t3://localhost:7001'

connect(username,password,url)

domainRuntime()

helloworldComposite = ObjectName('oracle.soa.config:SCAComposite.SCAService=Test1,name=AdapterBinding,revision=1.0,partition=default,SCAComposite="File1",Location=AdminServer,label=soa_2073ceb3-d703-453f-8867-79d3b44d637c,j2eeType=SCAComposite.SCAService.SCABinding,Application=soa-infra')
print helloworldComposite
print mbs.getAttribute(helloworldComposite, 'Properties')
disconnect()
exit()
disconnect()
exit()

// Change the ExcludeFiles property of the File Adapter

print 'starting the script ....'
username = 'weblogic'
password = 'Welcome1'
url='t3://localhost:7001'

connect(username,password,url)

domainRuntime()

helloworldComposite = ObjectName('oracle.soa.config:SCAComposite.SCAService=Test1,name=AdapterBinding,revision=1.0,partition=default,SCAComposite="File1",Location=AdminServer,label=soa_2073ceb3-d703-453f-8867-79d3b44d637c,j2eeType=SCAComposite.SCAService.SCABinding,Application=soa-infra')
print helloworldComposite
print '-----------Before Changes------------------'
print mbs.getAttribute(helloworldComposite, 'Properties')
params = ['ExcludeFiles','*.akshay*']
sign = ['java.lang.String','java.lang.String']
mbs.invoke(helloworldComposite, 'setStringProperty', params, sign)
print '-----------After Changes------------------'
print mbs.getAttribute(helloworldComposite, 'Properties')
disconnect()
exit()
disconnect()
exit()

// Display the MDS listPartitions

connect('weblogic', 'Welcome1', 't3://localhost:7001')
domainRuntime()

mdsBean = ObjectName('oracle.mds.lcm:name=MDSDomainRuntime,type=MDSDomainRuntime')

print 'invoke listRepositories without parameters on mds bean'
repositories = mbs.invoke(mdsBean, 'listRepositories',None,None)
for repository in repositories:
mdsObject = ObjectName(repository)
Name = mbs.getAttribute(mdsObject, 'Name')
print 'mds repository object: ', Name
params = [Name]
sign = ['java.lang.String']
partitions = mbs.invoke(mdsBean, "listPartitions", params, sign)
for partition in partitions:
   print 'partition: ', partition
disconnect()
exit()

Thursday, February 23, 2012

BPEL Process to display the IP Address of a hostname

 

Create a BPEL process with the following java embded code ,
<bpelx:exec import="java.net.*"/>
    <bpelx:exec name="Java_Embedding_1" language="java" version="1.3">
      <![CDATA[String ipaddr = (String)getVariableData("stringvar");   
System.out.println(ipaddr); 
try { 
        InetAddress addr1 = InetAddress.getByName(ipaddr); 
          byte[] ipAddr = addr1.getAddress(); 
          // Convert to dot representation 
          String ipAddrStr = ""; 
          for (int i=0; i<ipAddr.length; i++) { 
              if (i > 0) { 
                  ipAddrStr += "."; 
              } 
              ipAddrStr += ipAddr[i]&0xFF; 
          } 
      System.out.println(" Lookup Host Name " +addr1 +" --> " +ipAddrStr); 
      ipaddr = ipAddrStr;

catch(Exception e1) { 
e1.printStackTrace(); 
}
setVariableData("stringvar",ipaddr);]]>
    </bpelx:exec>
Please refer to the Java Doc for the API call's that you can use in BPEL java
http://docs.oracle.com/cd/B31017_01/integrate.1013/b28986/com/collaxa/cube/engine/ext/BaseBPELXExecLet.html
http://technology.amis.nl/blog/2387/embedding-java-in-bpel-process
http://niallcblogs.blogspot.in/2008/01/bpel-embedded-java.html

Thursday, February 02, 2012

EJB Out Bound Example in SOA

 

1. Create a Simple EJB HelloWorld Application and deploy this to the WebLogic Server

Refer to the file below for the example ,

Hello EJB Example

2. Create a new composite and create a mediator component ,

3. In the External Reference drop the ejb Service and specify the EJB JNDI Binding Name  say

OS9SOAApplication-HelloEJB-HelloEJB#test.os9.model.HelloEJB

EJB-Jar file :

and Java Interface : test.os9.model.HelloEJB

4. Wire the EJB Outbound Service to the mediator and perform the XML transformations and run the example ,

Refer to the file in the link given below ,

Calling EJB from Mediator/BPEL

Simple inbound ejb example ,

 

1. Create a java file with the following contents

package test.os9;
//import javax.ejb.Remote;
//@Remote
public interface Hello {
public String sayHello(String input);
}

Compile this file , create a class file and create a jar file and copy the jar file to SCA-INF\lib directory

2. Create an EJB Binding in the Services lane, based on this Java interface. Specify the JNDI Name for this EJB. For example: ejb/EjbBind and select the above interface file and the jar

3. Create a Mediator with no interface definition and Wire this mediator to this EJB Service

4. Create a BPEL process and wire this to the Medaitor

5. Create the mappings for the mediator

6. Create an EJB Client with the following code ,

package test.os9;
import java.util.Hashtable;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
public class EjbClient {
  public EjbClient() {
    super();
  }
  public static void main(String[] args) {
    EjbClient ejbClient = new EjbClient();
    try {
     final Context context = getInitialContext();
     Hello hello = (Hello)context.lookup("ejb/EjbBind");
     System.out.println(hello.sayHello("hello ravi"));
     } catch (Exception ex) {
     ex.printStackTrace();
     }
  }
  private static Context getInitialContext() throws NamingException {
  Hashtable env = new Hashtable();
  // WebLogic Server 10.x connection details
  env.put( Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory" );
  env.put(Context.PROVIDER_URL, "t3://xxx.xxx.oracle.com:7001");
    env.put(Context.SECURITY_PRINCIPAL,"weblogic");
    env.put(Context.SECURITY_CREDENTIALS,"xxxxx");
  return new InitialContext( env );
  }
}

Add the following libraries to compile the class files 

   "EJB 3.0" and "WebLogic 10.3 Remote-Client"

Here is the example ,

Download Example

Tuesday, January 24, 2012

How to increase JVM Memory Size for JDeveloper 11g

Open the file D:\fmw1115\Middleware\jdeveloper\ide\bin\ide.conf

and change the lines

AddVMOption -Xmx1024M
AddVMOption -Xms128M

Also open the file D:\fmw1115\Middleware\jdeveloper\jdev\bin\jdev.conf

and change the line

AddVMOption -XX:MaxPermSize=256M