step by step quickest way to create a web page on linux

need a quick way to create a web page on linux? here it is step by step:

  1. as root install httpd (if not already installed)
    yum install httpd
  2. as whoever, modify the default index.html page in /var/www/html
    note: configs for httpd are in /etc/httpd

    cd /var/www/html
    cp index.html index.html.bak
    vi index.html 
    chmod 755 index.html
  3. as root, start the httpd service
    service httpd start
  4. tada! now check it with your browser
    http://yourhostname

Permanent link to this article: http://devnumbertwo.com/create-a-web-page-on-linux/

OPatch error: “Inventory load failed… OPatch cannot load inventory for the given Oracle Home

trying to do an opatch lsinventory and it’s giving your problems? perhaps like the one below:

 

Oracle Interim Patch Installer version 11.1.0.9.0
Copyright (c) 2011, Oracle Corporation.  All rights reserved.


Oracle Home       : /u01/app/oracle_fmw/Oracle_SOA1
Central Inventory : /u01/app/oraInventory
   from           : /u01/app/oracle_fmw/Oracle_SOA1/oraInst.loc
OPatch version    : 11.1.0.9.0
OUI version       : 11.1.0.9.0
OUI location      : /u01/app/oracle_fmw/Oracle_SOA1/oui
Log file location : /u01/app/oracle_fmw/Oracle_SOA1/cfgtoollogs/opatch/opatch2014-01-01_01-01-00AM_1.log

Patch history file: /u01/app/oracle_fmw/Oracle_SOA1/cfgtoollogs/opatch/opatch_history.txt


OPatch detects the Middleware Home as "/u01/app/oracle_fmw"

List of Homes on this system:
  ...
Inventory load failed... OPatch cannot load inventory for the given Oracle Home.
Possible causes are:
   Oracle Home dir. path does not exist in Central Inventory
   Oracle Home is a symbolic link
   Oracle Home inventory is corrupted
LsInventorySession failed: OracleHomeInventory gets null oracleHomeInfo

OPatch failed with error code 73

 

the cause: it’s probably because the ORACLE_HOME is not registered in the Central Inventory (also known as the oraInventory)

 

fix it! by attaching the ORACLE_HOME information to the existing Central Inventory

$ORACLE_HOME/oui/bin/attachHome.sh

Permanent link to this article: http://devnumbertwo.com/opatch-cannot-load-inventory-for-the-given-oracle-home/

list all processes and their command-line parameters in windows

trying to list all processes and their command-line parameters in windows?

here you go! type this in a cmd prompt:

WMIC /OUTPUT:C:\processes-with-command-line-params.txt PROCESS get Caption,Commandline,Processid

or

WMIC /OUTPUT:C:\processes-with-command-line-params.txt path win32_process get Caption,Processid,Commandline

list all processes and their command-line parameters in windows
what you’re loking for will be in this file –> C:\ProcessList.txt

i’ve also tried this on a Windows 2008 R2 server and for some reason gotten an “Invalid Global Switch” error and I couldn’t figure out why. this might help you to just set the output to CLIPBOARD and then just paste it to a file. For some reason it allowed the command to run when output was CLIPBOARD:

WMIC /OUTPUT:CLIPBOARD PROCESS get Caption,Commandline,Processid

want to know more about the WMIC command? here’s the microsoft technet article

Permanent link to this article: http://devnumbertwo.com/list-all-processes-and-their-command-line-parameters-in-windows/

rm is not recognized as an internal or external – OHS startComponent.cmd and stopComponent.cmd

If you installed OHS 12.1.2.0 on Windows then you might run into this issue when attempting to use the startComponent.cmd and stopComponent.cmd commands:

startComponent.cmd and stopComponent.cmd return rm is not recognized as an internal or external...

 

This is a bug (BUG 17276497). Pretty simple fix:

  1. edit the startComponent.cmd and stopComponent.cmd files in DOMAIN\bin
    Replace the following line:

    if exist %PY_LOC% (
    rm -f %PY_LOC%
    )

    With this line:

    if exist %PY_LOC% (
    del %PY_LOC%
    )

Permanent link to this article: http://devnumbertwo.com/rm-is-not-recognized-as-an-internal-or-external/

cannot delete files – file name is too long

if you’re trying to delete files in Windows that are either too deep or whose names are too long you could get this error:

cannot delete files - file name is too long

cannot delete files - file name is too long

some articles will say to copy the contents to a shorter folder path OR rename the files (duh!) but in some cases this will not work. you end up getting the same error! i.e. copy the long-named file to somewhere else, it will say that the name is too long to perform that action. so I wouldn’t even bother trying that nonsense…

give this a shot, worked like a charm for me:

  1. drill down into the folders to the folder that contains the problem files or folders
  2. share the folder that contains the files/folders
  3. map a network drive to the folder with the problem files/folders
  4. open the mapped drive from another computer on the network, delete the files or folders in question
  5. disconnect the map drive and remove the share

how long can a file name be in windows? here’s what Microsoft says:

It depends on the length of the complete path to the file (such as C:\Program Files\filename.txt). Windows limits a single path to 260 characters. This is why you might occasionally get an error when copying a file with a very long file name to a location that has a longer path than the file’s original location.

Permanent link to this article: http://devnumbertwo.com/cannot-delete-files-file-name-is-too-long/

Unexpected exception from Plugin: java.lang.NullPointerException starting OHS HTTP Server

the problem: you used DOMAIN/bin/installNodeMgrSvc.cmd to install the OHS node manager, and when starting the OHS using startComponent.cmd ohs1 you get –> Server start command for OHS server ‘ohs1’ failed due to: Unexpected exception from Plugin: java.lang.NullPointerException

Starting System Component ohs1 ...

Initializing WebLogic Scripting Tool (WLST) ...

Welcome to WebLogic Server Administration Scripting Shell

Type help() for help on available commands

Reading domain from C:/Oracle/Middleware/Oracle_Home/user_projects/domains/dev2_domain

Please enter your password :
Connecting to Node Manager ...
Successfully Connected to Node Manager.
Starting server ohs1 ...
Error Starting server ohs1: weblogic.nodemanager.NMException: Received error message from Node Manager Server: 
[Server start command for OHS server 'ohs1' failed due to: Unexpected exception from Plugin: java.lang.NullPointerException. 
Please check Node Manager log and/or server 'ohs1' log for detailed information.]. Please check Node Manager log for details.
Successfully disconnected from Node Manager.

Exiting WebLogic Scripting Tool.

Done

this is a bug! (16883059) fix this suckah by doing the following:

  1. you need to uninstall the nodemanager service
    cd DOMAIN\bin\
    uninstallNodeMgrSvc.cmd
  2. set the following java options first and then install the nodemanager service again:
    cd DOMAIN\bin
    set JAVA_OPTIONS=-Dohs.product.home=<product_home> -Dweblogic.rootdirectory=<domain_directory>
    installNodeMgrSvc.cmd

    example:

    -Dohs.product.home=C:\\Oracle\\Middleware\\Oracle_Home\\ohs -Dweblogic.rootdirectory=C:\\Oracle\\Middleware\\Oracle_Home\\user_projects\\domains\\base_domain
    installNodeMgrSvc.cmd
  3. start the Nodemanager service
  4. start OHS using the startComponent.cmd command again. you should be all set

Permanent link to this article: http://devnumbertwo.com/unexpected-exception-from-plugin-java-lang-nullpointerexception/

fix weblogic error: Received fatal alert certificate_unknown

the problem: starting up weblogic and you get — Received fatal alert certificate_unknown

com.sun.xml.ws.client.ClientTransportException: HTTP transport error: 
javax.net.ssl.SSLHandshakeException: Received fatal alert: certificate_unknown

you might also be receiving

javax.net.ssl.SSLHandshakeException: General SSLEngine problem
...
weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:254)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
Caused By: sun.security.validator.ValidatorException: PKIX path validation failed:
java.security.cert.CertPathValidatorException: Algorithm constraints check failed: MD5withRSA

the cause: release notes for Java SE Update 40 show that the Default Key Length has been increased. Starting from 7u40, the use of x.509 certificates with RSA keys less than 1024 bits in length is restricted.

fix it so you can startup weblogic without issues – perform ONE of the following:

  1. Create a new Demo Key with the larger key size (strength of 2048)
  2. Obtain your own certificate, by submiting a new request to your CA, increasing its certificate strength (i.e. >1024).
  3. Remove the key length restriction (not recommended but the fastest solution)
    • I did this just so I could startup without errors for the time being until #3 could be done
      edit $JAVA_HOME/jre/lib/security/java.security
      it looks like this

      jdk.certpath.disabledAlgorithms=MD2, RSA keySize < 1024

      change 1024 to 512

      jdk.certpath.disabledAlgorithms=MD2, RSA keySize < 512
  4. Upgrade to WLS 12.1.2

Permanent link to this article: http://devnumbertwo.com/received-fatal-alert-certificate_unknown/

the server is in incompatible state – weblogic

the problem:  your node manager is reachable but you could not start the managed server. when attempting to start the server it is giving an error like

the server is in incompatible state which is incompatible with this operation or are 
not associated with a running Node Manager or you are not authorized to perform the 
action requested. No action will be performed

weblogic the server is in incompatible state
try this $h1t…

try deleting (or renaming/backing up) this file –> DOMAIN_HOME/servers/<servername>/data/nodemanager/<servername>.state

then try starting the managed server again through the console.

Note that per Oracle’s documentation, the .state file should not be removed as the Node Manager needs this to determine the current state of the file (read the Oracle doc here).

But hey, the state is wrong! If you want to proceed with caution, you can always rename/backup the file (ex. rename that bad boy to <servername>.state.bak) rather than completely removing it. Although, the Node Manager seems to re-generate this file if you delete it – but you should be fine either way.

 

Permanent link to this article: http://devnumbertwo.com/the-server-is-in-incompatible-state/

poo poo poo… everywhere

Permanent link to this article: http://devnumbertwo.com/poo-poo-poo-everywhere/

create windows service weblogic admin server

installation notes and $h!t on how to create windows service weblogic admin server…

this has been verified on weblogic 10.3.6 but i believe it will work for any 10.3.x version of weblogic.

 *** CHANGE ANY VALUES IN BLUE TO MATCH YOUR OWN VALUES

 

  1. Create a folder to keep all your windows service related files in, i created a winservices folder in my domain
    C:\oracle\user_projects\domains\devtwo_domain\winservices
  2. Create a cmd file named createAdminWinService.cmd in the winservices folder with the following contents
    echo off
    SETLOCAL
    set DOMAIN_NAME=devtwo_domain
    set USERDOMAIN_HOME=c:\oracle\user_projects\domains\devtwo_domain
    set SERVER_NAME=AdminServer
    call "c:\oracle\wlserver_10.3\server\bin\installSvc.cmd"
    ENDLOCAL
    
  3. Go to the WL_HOME\server\bin directory – in my case it’s c:\oracle\wlserver_10.3\server\bin
    Backup installSvc.cmd
    Then edit installSvc.cmd to contain the following changes

    ...
    set WL_HOME=C:\app\oracle\product\fmw\wlserver_10.3
    @rem call "%WL_HOME%\common\bin\commEnv.cmd"
    call %USERDOMAIN_HOME%\bin\setDomainEnv.cmd
    ...
    set CLASSPATH=%WEBLOGIC_CLASSPATH%;%CLASSPATH%;C:\oracle\user_projects\domains\devtwo_domain\winservices
    ...
    rem *** Install the service
    "%WL_HOME%\server\bin\beasvc" -install -svcname:"beasvc %DOMAIN_NAME%_%SERVER_NAME%" -stopclass:ServerStopper -javahome:"%JAVA_HOME%" -execdir:"%USERDOMAIN_HOME%" -maxconnectretries:"%MAX_CONNECT_RETRIES%" -host:"%HOST%" -port:"%PORT%" -extrapath:"%EXTRAPATH%" -password:"%WLS_PW%" -cmdline:%CMDLINE%  -log:"c:\oracle\user_projects\domains\devtwo_domain\servers\AdminServer\logs\AdminServer-stdout.log"
    
  4. Create ServerStopper.java with the following contents in your winservices folder
    import java.io.File;
    import java.net.URL;
    import java.net.URLClassLoader;
    import java.util.Set;
    import java.util.Iterator;
    import java.rmi.RemoteException;
    import javax.naming.Context;
    import javax.management.ObjectName;
    import weblogic.jndi.Environment;
    import weblogic.management.MBeanHome;
    import weblogic.management.WebLogicMBean;
    import weblogic.management.configuration.ServerMBean;
    import weblogic.management.runtime.ServerRuntimeMBean;
    import weblogic.management.runtime.ServerStates;
    import weblogic.management.WebLogicObjectName;
    public class ServerStopper {
      public static void stop() throws Exception {
        MBeanHome home = null;
        \\url of the Admin server
        String url = "t3:\\localhost:7001";
        String username = "weblogic";
        String password = "password";
        ServerRuntimeMBean serverRuntime = null;
        Set mbeanSet = null;
        Iterator mbeanIterator = null;
        try {
          \\ Set ContextClassloader to prevent assertions
          URL[] urls = { new File("\").toURL() };
          Thread.currentThread().setContextClassLoader(new
             URLClassLoader(urls));
          Environment env = new Environment();
          env.setProviderUrl(url);
          env.setSecurityPrincipal(username);
          env.setSecurityCredentials(password);
          Context ctx = env.getInitialContext();
          home = (MBeanHome)
               ctx.lookup("weblogic.management.adminhome");
          mbeanSet = home.getMBeansByType("ServerRuntime");
          mbeanIterator = mbeanSet.iterator();
          while(mbeanIterator.hasNext()) {
            serverRuntime = (ServerRuntimeMBean)mbeanIterator.next();
            if(serverRuntime.getState().equals(ServerStates.RUNNING)){
                serverRuntime.shutdown();
            }
          }
        } catch (Exception e) {
          e.printStackTrace();
        }
      }
    }
    
  5. Compile the class file by opening a command prompt and performing the following
    cd C:\oracle\user_projects\domains\devtwo_domain\winservices
    set CLASSPATH=c:\wlserver_10.3\server\lib\weblogic.jar
    javac ServerStopper.java
    

    If you are working with Weblogic 12c, your weblogic.jar will be in a location something like:
    C:\wlserver_12.1\server\lib\weblogic.jar

    Note: the java class file contains some deprecated items. so you will see some warnings but it should be OK for now:
    serverstopper_deprecated

  6. Run createAdminWinService.cmd, open a command prompt as Administrator and run the file – example:
    cd c:\oracle\user_projects\domains\devtwo_domain\winservices
    createAdminWinService.cmd
  7. You should now have a service in your Windows Services a service called “beasvc domainname_AdminServer” (in later versions of Weblogic like 12c it will start with something like wlsvc – see image below)
    create windows service weblogic admin server
  8. Test the service by starting it and accessing the Weblogic Administration Console.
    Also test stopping the service through Windows Services.

Permanent link to this article: http://devnumbertwo.com/create-windows-service-weblogic-admin-server/

Older posts «

» Newer posts