Saturday, October 26, 2013

How to change Custom Configuration file in Coherence Cluster

How to change Custom Configuration file in Coherence Cluster


  • Log in to Oracle WebLogic Server Administration Console.
  • Click Lock and Edit.
  • Expand the Environment node in the Domain Structure window.
  • Click Coherence Clusters. The Summary of Coherence Clusters page appears.
  • Select defaultCoherenceCluster (represented as a hyperlink) from the Names column of the table. The Settings page appears.
  • Select the Configuration tab.
  • Select checkbox Use a Custom Cluster Configuration File
  • Give server path of configuration file
  • Click Save.

Pack and Unpack Domain in Oracle Weblogic

Pack and Unpack Domain


After config.sh run(created a domain), domain template can be packed and unpacked in the remote machine.
Where in remote machine make sure all the bits are installed. like Weblogic, and product bits.



Run pack command in source machine,

cd $BEA_HOME/wlserver/common/bin
./pack.sh -domain=$DOMAIN_HOME   -template=/tmp/example_domain.jar -template_name="example_domain_template"


Copy example_domain.jar to target machine’s tmp folder.


Run unpack command in target machine,

cd $BEA_HOME/wlserver/common/bin
./unpack.sh -template=/tmp/example_domain.jar -domain=$DOMAIN_HOME

To Change Cluster Address

To Change Cluster Address

  • Log in to Oracle WebLogic Server Administration Console.
  • Click Lock and Edit.
  • Expand the Environment node in the Domain Structure window.
  • Click Clusters. The Summary of Cluster page appears.
  • Select Cluster1 (represented as a hyperlink) from the Names column of the table. The Settings page appears.

  • Select the General tab.

  • Enter the addresses, with comma separated

To Check Machine reachable - Oracle Weblogic

To Check Machine reachable

  • Log in to Oracle WebLogic Server Administration Console.
  • Expand the Environment node in the Domain Structure window.
  • Click Machines. The Summary of Machine page appears.
  • Select Machine1 (represented as a hyperlink) from the Names column of the table. The Settings page appears.



  • Select the Monitoring tab.



  • See the status



To disable host name verification

  • Log in to Oracle WebLogic Server Administration Console.
  • Click Lock and Edit.
  • Expand the Environment node in the Domain Structure window.
  • Click Servers. The Summary of Servers page appears.
  • Select managed_server (represented as a hyperlink) from the Names column of the table. The Settings page appears.
  • Select the SSL tab.
  • Expand the Advanced section of the page.
  • Set Hostname Verification to None.
  • Click Save.

How to stop loading external DTDs?

While using com.sun.org.apache.xerces parser, if XML has reference to external DTDs, it will be tried to load.
Exception will be thrown either network is not available or SocketPermission is not there.
Generally, this issue seen in JAVA Applet.



network: Cache entry not found [url: http://www.w3.org/TR/html4/strict.dtd, version: null]
network: Connecting http://www.w3.org/TR/html4/strict.dtd with proxy=HTTP 
network: Cache entry not found [url: http://www.w3.org:80/crossdomain.xml, version: null]
network: Connecting http://www.w3.org:80/crossdomain.xml with proxy=HTTP 
java.security.AccessControlException: access denied ("java.net.SocketPermission" "www.w3.org:80" "connect,resolve")
 at java.security.AccessControlContext.checkPermission(Unknown Source)
 at java.security.AccessController.checkPermission(Unknown Source)
 at java.lang.SecurityManager.checkPermission(Unknown Source)
 at java.lang.SecurityManager.checkConnect(Unknown Source)
 at sun.plugin2.applet.SecurityManagerHelper.checkConnectHelper(Unknown Source)
 at sun.plugin2.applet.AWTAppletSecurityManager.checkConnect(Unknown Source)
 at sun.net.www.http.HttpClient.openServer(Unknown Source)
 at sun.net.www.http.HttpClient.(Unknown Source)
 at sun.net.www.http.HttpClient.New(Unknown Source)
 at sun.net.www.http.HttpClient.New(Unknown Source)
 at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source)
 at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
 at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
 at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
 at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
 at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startEntity(Unknown Source)
 at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startDTDEntity(Unknown Source)
 at com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.setInputSource(Unknown Source)
 at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.dispatch(Unknown Source)
 at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.next(Unknown Source)
 at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(Unknown Source)
 at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
 at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)
 at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
 at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
 at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
 at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
 at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(Unknown Source)
 at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(Unknown Source

To overcome, set load-external-dtd feature to false.



DocumentBuilderFactory localDocumentBuilderFactory = DocumentBuilderFactory.newInstance();
localDocumentBuilderFactory.setNamespaceAware(true);
localDocumentBuilderFactory.setValidating(false);
 
localDocumentBuilderFactory.setFeature(
"http://apache.org/xml/features/nonvalidating/load-external-dtd", false);


Friday, March 1, 2013

How to detect the duplicate keys in .properties file

How to detect the duplicate keys in .properties file.


import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;

public class PropertyDuplicateCheck {

 /**
  * @param args
  */
 public static void main(String[] args) {
  FileInputStream fis = null;
  String EQUALs = "=";
  try {
   fis = new FileInputStream("Z:\\dsp-jarpaths.properties");
   Set<String> set = new TreeSet<String>();
   Map<String, Integer> map = new TreeMap<String, Integer>();

   BufferedReader br = new BufferedReader(new InputStreamReader(fis));
   String strLine;
   String keyValuePair[] = null;
   System.out.println("Unparsed or commented Lines:");
   while ((strLine = br.readLine()) != null) {
    if (strLine.contains(EQUALs)) {
     keyValuePair = strLine.split(EQUALs);
     String key = keyValuePair[0];

     if (!set.add(key)) {
      if (map.containsKey(key)) {
       map.put(key, map.get(key).intValue() + 1);
      } else {
       map.put(key, 2);
      }
     }

    } else {
     System.out.println(strLine);
    }
   }

   System.out.println("Print duplicate entry with duplication count:"
     + map);

  } catch (Exception e) {
   System.err.println("Error: " + e.getMessage());
  } finally {
   try {
    fis.close();
   } catch (Exception e) {
    // do nothing
   }
  }

 }

}


Recent Posts

Unix Commands | List all My Posts

Texts

This blog intended to share the knowledge and contribute to JAVA Community such a way that by providing samples and pointing right documents/webpages. We try to give our knowledege level best and no guarantee can be claimed on truth. Copyright and Terms of Policy refer blogspot.com