Monday, February 15, 2016

Error while domain creation - Weblogic



Preparing...
Extracting Domain Contents...
Creating Domain Security Information...
Domain Creation Failed!

Domain Location: C:\Oracle\Middleware\user_projects\domains\custom_domain

Reason: null

Exception:

Traceback (innermost last):
  File "<iostream>", line 155, in ?
  File "<iostream>", line 53, in writeUcmAutoInstallFile
  File "C:\Oracle\Middleware\wlserver_10.3\common\wlst\modules\jython-modules.jar\Lib/javaos$py.class", line 334, in system
  File "C:\Oracle\Middleware\wlserver_10.3\common\wlst\modules\jython-modules.jar\Lib/popen2.py", line 235, in system
  File "C:\Oracle\Middleware\wlserver_10.3\common\wlst\modules\jython-modules.jar\Lib/popen2.py", line 72, in __init__
  File "C:\Oracle\Middleware\wlserver_10.3\common\wlst\modules\jython-modules.jar\Lib/javashell.py", line 64, in execute
OSError: (0, 'Failed to execute command ([\'sh\', \'-c\', \'chmod 755 C:\\\\Oracle\\\\Middleware\\\\user_projects\\\\domains\\\\hassad/ucm/cs/bin/autoinstall.cfg\']): java.io.IOException: Cannot run program "sh": CreateProcess error=2, The system cannot find the file specified')


Solution:

To solve this we need to patch the jython-modules.jar. For default JDeveloper installation path we need to go to C:\Oracle\Middleware\wlserver_10.3\common\wlst\modules and extract the jython-modules.jar using a utility like 7-zip. Then we need to open the javashell.py python script inside lib folder and add at line 139 a String for Windows 8 OS:

_osTypeMap = (
        ( "nt", ( 'nt', 'Windows NT', 'Windows NT 4.0', 'WindowsNT',
                  'Windows 2000', 'Windows 2003', 'Windows XP', 'Windows CE',
                  'Windows Vista', 'Windows Server 2008', 'Windows 7', 'Windows 8' )),
        ( "dos", ( 'dos', 'Windows 95', 'Windows 98', 'Windows ME' )),
        ( "mac", ( 'mac', 'MacOS', 'Darwin' )),
        ( "None", ( 'None', )),
        )



Remove Domain from Weblogic Server


As of now there is no out of the box feature with Weblogic Configuration wizard to remove or delete a domain.

These are basically manual steps.
For example if I want to delete a domain named geo_domain below are the steps you need to remove the domain.

1. Open domain-registry.xml under $Middleware_HOME .Remove the corresponding entry referring to geo_domain.
CodeSnippet :: domain-registry.xml
<?xml version="1.0" encoding="UTF-8"?>
<domain-registry xmlns="http://xmlns.oracle.com/weblogic/domain-registry">
<domain location="C:\Oracle\Middleware\user_projects\domains\soa_domain"/>
<domain location="C:\Oracle\Middleware\user_projects\domains\geo_domain"/>
</domain-registry>

2. Open nodemanager.domains file under $Middleware_HOME \wlserver_10.3\common\nodemanager\ folder. Remove the corresponding entry referring to geo_domain.
CodeSnippet :: nodemanager.domains
#Domains and directories created by Configuration Wizard
geo_domain=C\:\\Oracle\\Middleware\\user_projects\\domains\\geo_domain

3. Delete the domain folder under domains folder manually.
        $Middleware_HOME\user_projects\domains\geo_domain

4. Delete the domain folder under applications folder manually.
        $Middleware_HOME\user_projects\ applications\geo_domain

Installing the NodeManager service


1.    Open the Command Prompt
2.    Run %WL_HOME%\wlserver_10.3\server\bin\setWLSEnv.cmd to set Weblogic Environment variables like WL_HOME, JAVA_HOME, PATH, CLASSPATH etc.
3.    Edit the installNodeMgrSvc.cmd to bind to a hostname for remote starts 
set NODEMGR_HOST=localhost
4.    Now run the %WL_HOME%\wlserver_10.3\server\bin\installNodeMgrSvc.cmd Validate the service from the services list as well using the services.msc utility.


5.    Start the NodeManager service named as above “Oracle WebLogic NodeManager…”
6.    Make sure starting the NodeManager service should create a  nodemanager.properties file under %WL_HOME%\wlserver_10.3\common\nodemanager.

Setup NodeManager to restore servers to their last known state after a reboot

1.   
Open nodemanager.properties located at %WL_HOME%\wlserver_10.3\common\nodemanager
2.    Set CrashRecoveryEnabled property value to true CrashRecoveryEnabled=true 
3.    Set StartScriptEnabled property value to true to invoke the startWeblogic script StartScriptEnabled=true
4.    Set StopScriptEnabled property value to true to invoke the stopWeblogic script and get the managed servers to shutdown cleanly StopScriptEnabled=false
5.    Set ListenAddress property value ListenAddress=localhost
6.    Set SecureListener property value (In case you selected plan for as communication type) SecureListener=false
7.    Restart of NodeManager service for each change to this nodemanager.properties file



Setup the machine

1.    Login to the AdminServer console

2.    Navigate through Domain Structure to %DOMAIN_NAME% -> Environment -> Machines

3.    Create a new machine Name : localhost, OS : Other - as my operating system is Windows Node Manager - Type: Plan

4.    Create one machine for each instance of OS for a different host.

5.    Assign the ManagedServer to machines based on which machine the ManagedServer is hosted. Take Lock & Edit and navigate through %DOMAIN_NAME% -> Environment -> Machines -> %MACHINE_NAME% -> Configuration tab -> Servers tab

6.    Do not forget to save and Activate the changes.

Enrolling the domain with NodeManager      

1.    Open command prompt

2.    Run %DOMAIN_HOME%\bin\setDomainEnv.cmd to set domain specific environment variables

3.    Start WLST using java weblogic.WLST

4.    At WLS prompt connect to AdminServer using connect ('weblogic','weblogic','t3://localhost:7001')

5.    Run nmEnroll(domainDir='C:/oracle/Middleware/user_projects/domains/base_domain',nmHome='C:/oracle/Middleware/common/nodemanager'). Make sure that you use forward slashes "/" instead of backward "\" as WLST does not recognize forward slashes. If you use backward slashes "\" you get the following error.



6.    Once the domain is successfully enrolled with NodeManager the nodemanager.domains should be updated too with below values.

#Thu Apr 28 11:54:41 MDT 2014
            base_domain=C\:\\Oracle\\Middleware\\user_projects\\domains\\base_domain 
            Also NodeManager should be reachable in AdminServer console. To validate this,

a)    Login to AdminServer console

b)   Navigate through %DOMAIN_NAME% -> Environment -> Machines -> %MACHINE_NAME% -> Monitoring -> Node Manager Status it should be Reachable (If not please check the nodemanager.log in  C:\Oracle\Middleware\wlserver_10.3\common\nodemanager)
               


Server Startup Configuration

1.    Login to the AdminServer console
2.    Navigate through Domain Structure to %DOMAIN_NAME% -> Environment -> Servers -> ManagedServer_1 -> Configuration tab -> Server Start tab
3.    Take Lock & Edit and input values as appropriate.
Java Home - C:\oracle\Middleware\jdk160_14_R27.6.5-32
Java Vendor - Sun - As I am using Sun JDK 
Weblogic Home - C:\oracle\Middleware
Root Directory -C:\oracle\Middleware\user_projects\domains\base_domain 
Classpath - Can be left blank as we have configured the nodemanager.properties to use startWeblogic script in  Setup nodeManager to restore servers to their last known state after a reboot  step 3 and you can setup necessary values in that script.
Arguments - Can be left blank as we have configured the nodemanager.properties to use startWeblogic script in  Setup NodeManager to restore servers to their last known state after a reboot  step 3 and you can setup necessary values in that script. But i am using memory arguments as input here "-Xms64m -Xmx128m" 
Security Policy - File - C:\oracle\Middleware\wlserver_10.3\server\lib\weblogic.policy
User Name – weblogic
Password – weblogic
Confirm Password – weblogic
4.    Save and activate the changes
5.    Repeat steps 1-4 for each ManagedServer in the domain.



NodeManager Domain Username and password

1.    Login to the AdminServer console

2.    Click on Domain name in the Domain Structure and navigate through %DOMAIN_NAME% (cs_domain) -> Security tab -> General tab -> Advanced link

3.    Take Lock & Edit  and input the NodeManager username/password/confirm passwords fields and these could be unique from your weblogic console password. I have chosen to input same as my console credentials username: weblogic & password: weblogic. This setup would help user who use WLST to connect to NodeManager via nmConnect()

4.    Save and Activate the changes


Complete Setup

Finally the setup is complete and now its time to start your ManagedServer in Admin console using NodeManager.
Starting the ManagedServer using the NodeManager setup
1.    Login to the AdminServer console
2.    Navigate through Domain Structure to %DOMAIN_NAME% -> Environment -> Servers -> ManagedServer_1 -> Control tab -> Start/Stop tab
3.    Under the Server Status section select the ManagedServer and click on start button
4.    When prompted to confirm the Action to be performed, click yes button.
5.    Monitor the server logs and after a while the server should be in RUNNING state


Weblogic ServletContext.getRealPath() - NullPointerException

Setting weblogic Admin Console option

Domain | Web Application | Archived Real Path Enabled to

You can also apply fix in application level by adding the following entry to weblogic.xml file:

<container-descriptor>
    <show-archived-real-path-enabled>true</show-archived-real-path-enabled>
</container-descriptor>

Wednesday, September 30, 2015

WebCenter Customer Component Logging


1. Include import java.util.logging.Logger; in customer component class.

2. Create object of Logger class
 private final Logger logger = Logger.getLogger(ComponentManager.class.getName());

3. Add the logs similar to WebCenter Content.
logger.info("<" + new Date().toString()+ "> <Notice> EBSCheckIn Sql Query @ [ "+ selectSQL+" ] - JNDI @ ["+bean.getAxfDataSource()+"]");

Above will work else you need to add following statements in class.

1. Import the handler class - import java.util.logging.Handler;

2. Create object of handler class.
 private Handler consoleHandler = new ConsoleHandler();

3.  Map the handler with logger class.

                         logger.addHandler(consoleHandler);
consoleHandler.setLevel(Level.ALL);
logger.setLevel(Level.ALL);


Try Some Other Patter:-
___________________
1. Import log class

     import intradoc.common.Log;

2.  Add the log info message

Log.info("<" + new Date().toString()+ "> <Notice> EBSCheckIn Sql Query @ [ "+ selectSQL+" ] - JNDI @ ["+bean.getAxfDataSource()+"]");


Try Some thing else :-
___________________

import intradoc.common.Report;

Report.info(section, message, t);

Report.info("filestore", msg, null);

Report.info(null, msg, null);

Report.info("scheduledevents", msg, null);

Report.info("taskmanager", null, ignore);

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

Report.trace("publish", "waiting for publishing thread", ignore);

Report.trace("applet", "MainFrameListener: null command", null);

Report.trace("system", null, excep);

Report.trace("system", "counters or depends is empty", null);

Report.trace("filestore", "adding " + action + " operation to commit log", null);

Report.trace("schemainit", "adding Application target", null);

Report.trace("userstorage", "addAuthData userInfo=" + userInfo + " timeStamp=" + tAuthData.m_timeStamp, null);

  Report.trace("archiver", "Writing export file: " + this.m_archiveDir + "/exports.hda", null);
 
  Report.trace("componentloader", "adding " + dir + " (from " + key + "=" + val + ") to search list", null)
 
   Report.trace("search", "using executable '" + searchExe + "' for searching", null);

Thursday, September 17, 2015

Weblogic Application Authorization

1. Entries in weblogic.xml

   <wls:security-role-assignment>
        <wls:role-name>AUTHENTICATED_USER</wls:role-name>
    <wls:principal-name>ApplicationUser</wls:principal-name>
    </wls:security-role-assignment>
 
     <wls:security-role-assignment>
        <wls:role-name>Deployers</wls:role-name>
    <wls:principal-name>Deployers</wls:principal-name>
    </wls:security-role-assignment>
 
     <wls:security-role-assignment>
        <wls:role-name>WORKFLOW_AUTHENTICATED_USER</wls:role-name>
    <wls:principal-name>WORKFLOW_AUTHENTICATED_USER</wls:principal-name>
    </wls:security-role-assignment>
 

2. Entries in Web.xml
   
                <security-role>
 <role-name>AUTHENTICATED_USER</role-name>
</security-role>
<security-role>
 <role-name>Deployers</role-name>
</security-role>
<security-role>
 <role-name>WORKFLOW_AUTHENTICATED_USER</role-name>
</security-role>


3. <%if(request.isUserInRole("ROLE_WORKFLOW_AUTHENTICATED_USER")){%> WORKFLOW_AUTHENTICATED_USER <%} %>

Friday, September 11, 2015

Apache2 and Create Virtual Hosts


Install Apache2 and Create Virtual Hosts:-

sudo apt-get update
sudo apt-get install apache2

1. Create website directory structure:-

sudo mkdir -p /var/www/python.bh/public_html
sudo mkdir -p /var/www/openstack.python.bh/public_html

2. Grant Permission:-
sudo chown -R $USER:$USER /var/www/python.bh/public_html
sudo chown -R $USER:$USER /var/www/openstack.python.bh/public_html
sudo chmod -R 755 /var/www

3. Create a html index page for each website
vi /var/www/python.bh/public_html/index.html
vi /var/www/python.bh/public_html/index.html

4. Create Virtual Host File and add site entries
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/python.bh.conf
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/openstack.python.bh.conf


sudo vi /etc/apache2/sites-available/python.bh.conf

<VirtualHost *:80>
        ServerAdmin admin@python.bh
        ServerName python.bh
        ServerAlias python.bh
        DocumentRoot /var/www/python.bh/public_html

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Copy the same conf file for other server and update.

5. Register and Enable New Virtual Hosts

sudo a2ensite python.bh.conf
sudo a2ensite openstack.python.bh.conf


6. Restart apache2 server

sudo service apache2 restart

7. Add virtual host entries in hosts file.

127.0.0.1       localhost
127.0.1.1       openstack
192.168.48.128  openstack.python.bh openstack
192.168.48.128  python.bh  python


8. Access the website http://python.bh & http://openstack.python.bh
Note: For windows user add these entries in C:\Windows\System32\drivers\etc\hosts file.

192.168.48.128 python.bh
192.168.48.128 openstack.python.bh

https://code.google.com/p/openbizcard/source/browse/trunk/integrated/Scanner/src/com/yov/lib/?r=103

http://www.gnome.sk/Twain/jtp_try&buy.html


AWS EC2 - SSH locked with UFW

Need to update the instance's user data: 1. Stop the instance 2. Right click (windows) or ctrl + click (Mac) on the instance to open a c...