2014年10月9日木曜日

HOW DO YOU DO: CREATE AD USER AND ADD THIS INTO GROUP

static void Main(string[] args)
       {
           try
           {
               string[] groups = new string[] { "Admin", "Back_End", "CSharp", "Developer", "Faserati", "Flex", "Front-End", "HTML", "JS", "SQL", "Teacher", "Tester" };

               DirectoryEntry root = new DirectoryEntry();
               root.Path = "LDAP://FAST.Faserati/CN=Users,DC=FAST,DC=Faserati";
               root.Username = "Administrator";
               root.Password = "P@$$w0rd";

               DirectoryEntry group = new DirectoryEntry();
               group.Path = "LDAP://FAST.Faserati";
               group.Username = "Administrator";
               group.Password = "P@$$w0rd";
               group.Children.SchemaFilter.Add("group");
               for (int i = 0; i < 10000; i++)
               {
                   Random r = new Random();
                   string g = groups[r.Next(0, 11)];

                   DirectoryEntry parent = group.Children.Find("CN=" + g);
                   parent.Invoke("Add", CreateUser(root, g + i.ToString()).Path.ToString());

               }
           }
           catch (COMException ex)
           {
               Console.WriteLine(ex.Message);
           }
       }

       static DirectoryEntry CreateUser(DirectoryEntry root, string userName)
       {
           using (var de = new DirectoryEntry())
           {
               de.Path = "LDAP://FAST.Faserati/CN=Users,DC=FAST,DC=Faserati";
               de.Username = "Administrator";
               de.Password = "P@$$w0rd";
               DirectoryEntry user = root.Children.Add("CN=" + userName, "user");
               user.Properties["company"].Add("Faserati");
               user.Properties["employeeID"].Add("4711");
               user.Properties["samAccountName"].Add(userName);
               user.Properties["userPrincipalName"].Add(userName + "@explorer.local");
               user.Properties["sn"].Add("Doe");
               user.Properties["mail"].Add(userName + "@Faserati.com");
               user.Properties["userPassword"].Add("someSecret");
               user.Properties["userAccountControl"].Add(544);
               user.CommitChanges();

               return user;
           }

http://technet.microsoft.com/en-us/library/cc783256(v=ws.10).aspx

Understanding unique attributes in Active Directory

http://wenku.baidu.com/link?url=LewnAPwN0b7KLzTqm6L6yUWIL4s8ulFAZS4beoBoAAEtQ0AkFNZJC0p27n9ynArElwXlDOqq86VvkPyJMapTiAk8yjg8_BvcXWIkcL9apkm

Diagnosing Intermittent Authentication Failures and User Lock-Outs in Oracle WebLogic

2014年7月8日火曜日

Android: Gen already exists but is not a source folder

Error info:
Gen already exists but is not a source folder.

Workaround-1:
1. Right click project, and select "Properties"
2. Select "Java Build Path"
3. Open "Source"
4. Click "Add Folder..."
5. Select "gen", click "OK", Click "YES",and click "OK"
6. Right click project, select "Android Tools"-->"Fix Project Properties"

Workaround-2:
This error's root cause is classpath issue,and look likes following format.
-----------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>
-----------------------------------------------
You can modify this file's following tags:
------------------------------
kind="src"
kind="con"
kind="lib"
kind="output"
-------------------------------------------------

2014年6月30日月曜日

How to Install Java 7(JDK 7u60) On RHEL 6

Step1 Download File
http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
#tar xzf jdk-7u60-linux-x64.gz

Step2 Install JAVA using Alternatives
#cd /home/oracle/alice/jdk1.7.0_60
#[oracle@infbjvm1XX jdk1.7.0_60]$ sudo -i
[root@infbjvm1XX ~]# alternatives --install /usr/bin/java java /home/oracle/alice/jdk1.7.0_60/bin/java 2
[root@infbjvm1XX ~]# alternatives --config java
There are 3 programs which provide 'java'.
  Selection    Command
-----------------------------------------------
*+ 1           /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java
   2           /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java
   3           /home/oracle/alice/jdk1.7.0_60/bin/java
Enter to keep the current selection[+], or type selection number: 3
#

Now you may also required to setup javac and jar commands path using alternatives:
[root@infbjvm1XX ~]# alternatives --install /usr/bin/jar jar /home/oracle/alice/jdk1.7.0_60/bin/java
[root@infbjvm1XX ~]# alternatives --install /usr/bin/javac javac /home/oracle/alice/jdk1.7.0_60/bin/java
[root@infbjvm1XX ~]# set jar /home/oracle/alice/jdk1.7.0_60/bin/java
[root@infbjvm1XX ~]# set javac /home/oracle/alice/jdk1.7.0_60/bin/javac

Step3 Check JAVA Version
# java -version
java version "1.7.0_60"
Java(TM) SE Runtime Environment (build 1.7.0_60-b19)
Java HotSpot(TM) 64-Bit Server VM (build 24.60-b09, mixed mode)

Step4 Setup Environment Variables
export JAVA_HOME=/home/oracle/alice/jdk1.7.0_60/
export JRE_HOME=/home/oracle/alice/jdk1.7.0_60/jre
export PATH=$PATH:/home/oracle/alice/jdk1.7.0_60/bin:/home/oracle/alice/jdk1.7.0_60/jre/bin

Problem starting Weblogic Server 10.3.6

Error info:
<Jun 30, 2014 2:46:15 PM CST> <Critical> <Health> <BEA-310006> <Critical Subsystem PersistentStore._WLS_AdminServer has failed. Setting server state to FAILED.
Reason: weblogic.store.PersistentStoreFatalException: [Store:280105]The persistent file store "_WLS_AdminServer" cannot open file _WLS_ADMINSERVER000000.DAT.>
<Jun 30, 2014 2:46:15 PM CST> <Critical> <WebLogicServer> <BEA-000385> <Server health failed. Reason: health of critical service 'PersistentStore._WLS_AdminServer' failed>
<Jun 30, 2014 2:46:15 PM CST> <Error> <Store> <BEA-280061> <The persistent store "_WLS_AdminServer" could not be deployed: weblogic.store.PersistentStoreFatalException: [Store:280105]The persistent file store "_WLS_AdminServer" cannot open file _WLS_ADMINSERVER000000.DAT.

Workaround:
Navigating to
/user_projects/domains/<<Domain_name>>/servers/AdminServer/data/store/default/

directory and delete the _WLS_ADMINSERVER000000.DAT file.
After deleting the file, try restart the server again.
This action is detailed out in Oracle Support doc if 957377.1.

java.lang.OutOfMemoryError: PermGen space with weblogic

Error info:
java.lang.OutOfMemoryError: PermGen space
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at weblogic.utils.classloaders.GenericClassLoader.defineClass(GenericClassLoader.java:343)
at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:302)
at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:270)
at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:64)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:179)
at weblogic.utils.classloaders.ChangeAwareClassLoader.loadClass(ChangeAwareClassLoader.java:43)
at oracle.cabo.ui.laf.base.xhtml.InlineMessageRenderer._isAccessKeyNotOnPrompt(Unknown Source)
at oracle.cabo.ui.laf.base.xhtml.InlineMessageRenderer._createContentNode(Unknown Source)
at oracle.cabo.ui.laf.base.xhtml.InlineMessageRenderer.__registerMarlinRenderer(Unknown Source)
at oracle.cabo.ui.laf.base.xhtml.XhtmlLookAndFeel._registerDependentRenderers(Unknown Source)
at oracle.cabo.ui.laf.base.xhtml.XhtmlLookAndFeel.createDefaultFactory(Unknown Source)
at oracle.cabo.ui.laf.base.xhtml.XhtmlLookAndFeel.<clinit>(Unknown Source)
at oracle.cabo.ui.laf.base.desktop.BaseDesktopUtils.registerLookAndFeel(Unknown Source)
at oracle.cabo.ui.laf.LookAndFeelManager.createDefaultLookAndFeelManager(Unknown Source)
at oracle.cabo.ui.laf.LookAndFeelManager.getDefaultLookAndFeelManager(Unknown Source)
at oracle.sysman.emSDK.chart.EmChartCacheManager.init(EmChartCacheManager.java:105)
at oracle.sysman.emSDK.svc.ServiceUtil.initService(ServiceUtil.java:94)
at oracle.sysman.eml.app.ContextInitializer.contextInitialized(ContextInitializer.java:600)
at weblogic.servlet.internal.EventsManager$FireContextListenerAction.run(EventsManager.java:481)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.internal.EventsManager.notifyContextCreatedEvent(EventsManager.java:181)
at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1868)
at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:3154)
at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1518)
at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:484)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
java.lang.OutOfMemoryError: PermGen space
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at weblogic.utils.classloaders.GenericClassLoader.defineClass(GenericClassLoader.java:343)
at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:302)
at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:270)
at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:64)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:179)
at weblogic.utils.classloaders.ChangeAwareClassLoader.loadClass(ChangeAwareClassLoader.java:43)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:190)
at oracle.sysman.emSDK.svc.ServiceUtil.initService(ServiceUtil.java:91)

Work around:
The reference bug is listed following:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4957990

In my case the solution was to edit the DOMAIN\bin\setDomainEnv.cmd file. The following modifications were made before the server would start as intended:
The -Xms and -Xmx values were increased;
the -XX:PermSize and -XX:MaxPermSize values were increased too
and lastly, but probably most importantly
the if "%JAVA_VENDOR%"=="Sun" (conditions were changed to if "%JAVA_VENDOR%"=="Oracle" ) in order to properly recognize my JVM.

Reference Doc:
http://www.cnblogs.com/pipijiqimao/archive/2013/03/06/2946344.html

2014年6月4日水曜日

WLS: ERROR CODE 17002

Error info:
[EL Severe]: 2014-06-04 14:09:08.047--ServerSession(19793384)--Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.3.1.v20111018-r10243): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLRecoverableException: IO\u30a8\u30e9\u30fc: The Network Adapter could not establish the connection
Error Code: 17002
6 04, 2014 2:09:08 \u5348\u5f8c oracle.security.jps.internal.common.config.AbstractSecurityStore getSecurityStoreVersion
\u8b66\u544a: Unable to get the Version from Store returning the default
oracle.security.jps.service.policystore.PolicyStoreConnectivityException: JPS-00027: \u5185\u90e8\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f: java.net.ConnectException: \u63a5\u7d9a\u3092\u62d2\u5426\u3055\u308c\u307e\u3057\u305f
at oracle.security.jps.internal.policystore.rdbms.JpsDBDataManager.handleDatabaseException(JpsDBDataManager.java:2153)
at oracle.security.jps.internal.policystore.rdbms.JpsDBDataManager.processJPAException(JpsDBDataManager.java:2708)
at oracle.security.jps.internal.policystore.rdbms.JpsDBDataManager.existsTable(JpsDBDataManager.java:1517)
at oracle.security.jps.internal.policystore.rdbms.JpsDBDataManager.isPrincipalAssigneeSplit(JpsDBDataManager.java:1457)
at oracle.security.jps.internal.policystore.rdbms.JpsDBDataManager.checkFunctionSupportedInDoAs(JpsDBDataManager.java:1414)
at oracle.security.jps.internal.policystore.rdbms.JpsDBDataManager.checkFunctionSupported(JpsDBDataManager.java:1448)
at oracle.security.jps.internal.policystore.rdbms.JpsDBDataManager.createEMFAndSubject(JpsDBDataManager.java:1587)
at oracle.security.jps.internal.policystore.rdbms.JpsDBDataManager.getEMFAndSubject(JpsDBDataManager.java:1549)
at oracle.security.jps.internal.policystore.rdbms.JpsDBDataManager.init(JpsDBDataManager.java:1174)
at oracle.security.jps.internal.policystore.rdbms.JpsDBDataManager.jpsObjectBaseQuery(JpsDBDataManager.java:3894)
at oracle.security.jps.internal.policystore.rdbms.JpsDBDataManager.queryBaseObjects(JpsDBDataManager.java:7124)
at oracle.security.jps.internal.common.config.AbstractSecurityStore.getSecurityStoreVersion(AbstractSecurityStore.java:169)
at oracle.security.jps.internal.common.config.AbstractSecurityStore.getSecurityStoreVersionInternal(AbstractSecurityStore.java:152)
at oracle.security.jps.internal.common.config.AbstractSecurityStore.getSecurityStoreVersion(AbstractSecurityStore.java:129)
at oracle.security.jps.internal.credstore.ldap.LdapCredentialStore.<init>(LdapCredentialStore.java:157)
at oracle.security.jps.internal.credstore.ldap.LdapCredentialStore.<init>(LdapCredentialStore.java:140)
at oracle.security.jps.internal.credstore.ldap.LdapCredentialStoreProvider.getInstance(LdapCredentialStoreProvider.java:130)
at oracle.security.jps.internal.credstore.rdbms.DbmsCredentialStoreProvider.getInstance(DbmsCredentialStoreProvider.java:78)
at oracle.security.jps.internal.credstore.rdbms.DbmsCredentialStoreProvider.getInstance(DbmsCredentialStoreProvider.java:60)
at oracle.security.jps.internal.credstore.rdbms.DbmsCredentialStoreProvider.getInstance(DbmsCredentialStoreProvider.java:52)
at oracle.security.jps.internal.core.runtime.ContextFactoryImpl.findServiceInstance(ContextFactoryImpl.java:139)
at oracle.security.jps.internal.core.runtime.ContextFactoryImpl.getContext(ContextFactoryImpl.java:170)
at oracle.security.jps.internal.core.runtime.ContextFactoryImpl.getContext(ContextFactoryImpl.java:206)
at oracle.security.jps.internal.core.runtime.JpsContextFactoryImpl.getContext(JpsContextFactoryImpl.java:132)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.python.core.PyReflectedFunction.__call__(Unknown Source)
at org.python.core.PyMethod.__call__(Unknown Source)
at org.python.core.PyObject.__call__(Unknown Source)
at org.python.core.PyInstance.invoke(Unknown Source)
at org.python.pycode._pyx50.isInCredStore$20(/home/oracle/mdwAlice/Oracle_IDM1/common/tools/configureSecurityStore.py:259)
at org.python.pycode._pyx50.call_function(/home/oracle/mdwAlice/Oracle_IDM1/common/tools/configureSecurityStore.py)
at org.python.core.PyTableCode.call(Unknown Source)
at org.python.core.PyTableCode.call(Unknown Source)
at org.python.core.PyFunction.__call__(Unknown Source)
at org.python.core.PyObject.__call__(Unknown Source)
at org.python.pycode._pyx50.f$0(/home/oracle/mdwAlice/Oracle_IDM1/common/tools/configureSecurityStore.py:562)
at org.python.pycode._pyx50.call_function(/home/oracle/mdwAlice/Oracle_IDM1/common/tools/configureSecurityStore.py)
at org.python.core.PyTableCode.call(Unknown Source)
at org.python.core.PyCode.call(Unknown Source)
at org.python.core.Py.runCode(Unknown Source)
at org.python.util.PythonInterpreter.execfile(Unknown Source)
at weblogic.management.scripting.WLST.main(WLST.java:139)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at weblogic.WLST.main(WLST.java:29)
Caused by: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.3.1.v20111018-r10243): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLRecoverableException: IO\u30a8\u30e9\u30fc: The Network Adapter could not establish the connection
Error Code: 17002
at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:324)
at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:319)
at org.eclipse.persistence.sessions.DefaultConnector.connect(DefaultConnector.java:138)
at org.eclipse.persistence.sessions.DatasourceLogin.connectToDatasource(DatasourceLogin.java:162)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:584)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:206)
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:488)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getDatabaseSession(EntityManagerFactoryDelegate.java:188)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.createEntityManagerImpl(EntityManagerFactoryDelegate.java:277)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:294)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:272)
at oracle.security.jps.internal.policystore.rdbms.JpsDBDataManager.existsTable(JpsDBDataManager.java:1494)
... 47 more
Caused by: java.sql.SQLRecoverableException: IO\u30a8\u30e9\u30fc: The Network Adapter could not establish the connection
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:458)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:546)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:236)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:521)
at java.sql.DriverManager.getConnection(DriverManager.java:571)
at java.sql.DriverManager.getConnection(DriverManager.java:187)
at org.eclipse.persistence.sessions.DefaultConnector.connect(DefaultConnector.java:98)
... 56 more

Workaround:
That is a database error code.Please check your database connection information.

2014年5月29日木曜日

Installation Steps OWSM and SOA

Oracle Web Services Manager offers a comprehensive and easy-to-use solution for policy management and security of service infrastructure. It provides visibility and control of the policies through a centralized administration interface offered by Oracle Enterprise Manager.

Web Services Manager is a component of SOA Suite.

OTN:
http://www.oracle.com/technetwork/middleware/webservices-manager/index.html

1. Software download:
http://www.oracle.com/technetwork/middleware/soasuite/downloads/downloads-085394.html
2. Installing the OWSM Agent and SOA Shiphome.
3.Installed wls1036_generic.jar as there was not option for 64 bit version.
Created Middleware Home(MW_HOME) for the WLS .
unzip all 6 zip files soa1.zip to soa6.zip
execute./soa/Disk1/runInstaller -jreLoc <jdk_loc>
4.Install the setup select the Middleware home given in earlier setup.
after installation set $ORACLE_HOME=$MW_HOME/Oracle_SOA1
5.Now you need to create Schema for the SOA suite. So for this we run the rcu utility.
execute. /rcu_home/bin/rcu where- rcu_home is the directory where the rcu.zip file is extracted.
6.Go to create and provide the data base connection details.
7.then select the SOA suit infrastructure here as below


8.Then hit create.
Now configure the SOA Domain : goto $ORACLE_HOME/common/bin
./config.sh and select create new weblogic domain.

select SOA suite owsm and Oracle JRf and EM as below.


9.To check deployments are up start the servers

$MW_HOME/user_projects/domains<domain-name>/bin
./startWeblogic.sh ----> to start the admin server.
./startManagedWeblogic.sh soa_server1 ---> to start the SOA server.


10.To ensure you have installed the server with right policy go to the URLhttp://host name:9001/wsm-pm/validator [in my case Admin server hosted at 9001]

Doc:
http://docs.oracle.com/cd/E28280_01/doc.1111/e14860/products.htm#BABHCBCG

Securing REST using Oracle WebService Manager 12.1.2
Doc:
http://www.oracle.com/technetwork/middleware/webservices-manager/rest-service-security-owsm-12c-1971795.pdf