24 November 2017

HTTP Codes

La arquitectura Rest se basa fuertemente en el protocolo HTTP, por lo cual es importante responder (y parsear al recibir) los diferentes códigos HTTP que existen.
Los códigos están agrupados por las siguientes categorías:
  • 1xx – Informational
  • 2xx – Successful
  • 3xx – Redirection
  • 4xx - Client Error
  • 5xx - Server Error
El proyecto rest-error-handler hace uso granular de estos códigos.
Deberíamos usar solo los códigos más útiles (top “10”) que son los siguientes:

HTTP Response codes

200OKSuccessfully executed. should be used to indicate nonspecific success
201CREATEDSuccessfully executed and a new resources has been created. The response body is either empty or contains a URI(s) of the created resource. The location header should should also contain the new URI
202ACCEPTEDThe request was valid and has been accepted but has not yet been processed. The response should include a URI to poll for status updates on the request. Allows for asynchronous request ( start of an asynchronous action)
204NO_CONTENTThe request was successful but the server did not have a response. should be used when the response body is intentionally empty.
Ejemplo: Si se busca el listado de productos para un cliente y el cliente existe pero la lista es vacía, el estado es 204
301MOVED_PERMANENTLYThe new location should be returned in the response ( should be used to relocate resources)
400BAD_REQUESTMalformed or invalid request
401UNAUTHORIZEDInvalid authorization credentials
403FORBIDDENDisallowed request. Security error
404NOT_FOUNDResource not found.
Ejemplo: Si se busca un cliente por rut y éste no existe, el estado es 404
405METHOD_NOT_ALLOWEDMethod (verb) not allowed for requested resource. Response will provide an “Allow” header to indicate what is allowed
415UNSUPPORTED_MEDIA_TYPEClient submitted a media type that is incompatible for the specified resource.
500INTERNAL_SERVER_ERRORCatchall for server processing problem
503SERVICE_UNAVAILABLEResponse in the face of too many request

Mayor información:

https://en.wikipedia.org/wiki/List_of_HTTP_status_codes

02 November 2017

Cannot retrieve WLS app info

Cannot retrieve:

The configuration for app is still being loaded from your last request, please wait a moment and retry.

####<Oct 30, 2017 9:59:44 AM CLT> <Error> <Console> <lablnx297> <AdminServer> <[ACTIVE] ExecuteThread: '5' for queue: 'weblogic.kernel.Default (self-tuning)'> <weblogic> <> <cc19eb40-e1ae-46e5-80cb-dbf2a3509811-00000f0c> <1509368384819> <BEA-240003> <Administration Console encountered the following error: java.lang.NullPointerException
  at weblogic.application.internal.ApplicationRuntimeMBeanImpl.getComponentRuntimes(ApplicationRuntimeMBeanImpl.java:449)
  at sun.reflect.GeneratedMethodAccessor1348.invoke(Unknown Source)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:606)
  at weblogic.management.jmx.modelmbean.WLSModelMBean.getAttribute(WLSModelMBean.java:525)
  at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getAttribute(DefaultMBeanServerInterceptor.java:647)
  at com.sun.jmx.mbeanserver.JmxMBeanServer.getAttribute(JmxMBeanServer.java:678)
  at weblogic.management.jmx.mbeanserver.WLSMBeanServerInterceptorBase$12.run(WLSMBeanServerInterceptorBase.java:326)
  at java.security.AccessController.doPrivileged(Native Method)
  at weblogic.management.jmx.mbeanserver.WLSMBeanServerInterceptorBase.getAttribute(WLSMBeanServerInterceptorBase.java:324)
  at weblogic.management.mbeanservers.internal.JMXContextInterceptor.getAttribute(JMXContextInterceptor.java:157)
  at weblogic.management.jmx.mbeanserver.WLSMBeanServerInterceptorBase$12.run(WLSMBeanServerInterceptorBase.java:326)
  at java.security.AccessController.doPrivileged(Native Method)
  at weblogic.management.jmx.mbeanserver.WLSMBeanServerInterceptorBase.getAttribute(WLSMBeanServerInterceptorBase.java:324)
  at weblogic.management.mbeanservers.internal.SecurityInterceptor.getAttribute(SecurityInterceptor.java:300)
  at weblogic.management.jmx.mbeanserver.WLSMBeanServer.getAttribute(WLSMBeanServer.java:279)
  at weblogic.management.mbeanservers.internal.JMXConnectorSubjectForwarder$5$1.run(JMXConnectorSubjectForwarder.java:327)
  at java.security.AccessController.doPrivileged(Native Method)
  at weblogic.management.mbeanservers.internal.JMXConnectorSubjectForwarder$5.run(JMXConnectorSubjectForwarder.java:325)
  at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
  at weblogic.management.mbeanservers.internal.JMXConnectorSubjectForwarder.getAttribute(JMXConnectorSubjectForwarder.java:320)
  at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1468)
  at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:97)
  at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1332)
  at java.security.AccessController.doPrivileged(Native Method)
  at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1431)
  at javax.management.remote.rmi.RMIConnectionImpl.getAttribute(RMIConnectionImpl.java:661)
  at javax.management.remote.rmi.RMIConnectionImpl_WLSkel.invoke(Unknown Source)
  at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:701)
  at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:527)
  at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
  at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:146)
  at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:523)
  at weblogic.rmi.internal.wls.WLSExecuteRequest.run(WLSExecuteRequest.java:118)
  at weblogic.work.ExecuteThread.execute(ExecuteThread.java:311)
  at weblogic.work.ExecuteThread.run(ExecuteThread.java:263)
>

HTTP Cluster WebLogic Server

Old Deprecated feature:

web.xml :

<servlet-name>ProxyServlet</servlet-name>
<servlet-class>weblogic.servlet.proxy.HttpProxyServlet</servlet-class>
<init-param>
<param-name>redirectURL</param-name>
<param-value>http://localhost:8080</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>ProxyServlet</servlet-name>
<url-pattern>/MyProducerApp/*</url-pattern>
</servlet-mapping>

.

31 October 2017

Clear Cache WLS

Before deleting any directory, you need to shutdown all servers first.

The following provides a generic example path to the tmp directory in question:

WINDOWS: cd C:\wls\user_projects\domains\servers\

UNIX: cd /wls/user_projects/domains//servers/

The following would be used to clear the cache:

WINDOWS: rd C:\wls\user_projects\domains\servers\tmp
rd C:\wls\user_projects\domains\servers\cache


UNIX: rm -rf /wls/user_projects/domains/servers/tmp
rm -rf /wls/user_projects/domains//servers/cache



 For WLS versions 9.2 and above, delete the following Admin and Managed server cache directories:

    /servers/cache
    /servers/stage (if exists)
    /servers/tmp
 




18 October 2017

WLS JMS Configuration

Essential steps to configure a JMS environment


CORE_WLS_Domain --> Services --> Persistent Stores -->

New:

Name: FileStore-Mensajeria1
Target: Managed Server 1 (WLS01)
Directory: jmsMensajeria_1
(Activate Changes)

Name: FileStore-Mensajeria2
Target: Managed Server 2 (WLSS02)
Directory: jmsMensajeria_2
(Activate Changes)


CORE_WLS_Domain --> Services --> Messaging --> JMS Servers

New:

Name: JMSServer-Mensajeria_1
Persistent Store: FileStore-Mensajeria1
Target: WLS01 (migratable)
(finish)

Name: JMSServer-Mensajeria_2
Persistent Store: FileStore-Mensajeria2
Target: WLS02 (migratable)
(finish)

(Activate Changes)


CORE_WLS_Domain --> Services --> Messaging --> JMS Modules

Name: JMSModule_Mensajeria
Target: wls_core_cluster
(next/finish)
(Activate Changes)


entrar a JMS Module creado: (crear subdeployment)
CORE_WLS_Domain --> Services --> Messaging --> JMS Modules --> JMSModule_Mensajeria --> Subdeployments

New:

name: MensajeriaSubdeployment
Target: JMSServer-Mensajeria_1, JMSServer-Mensajeria_2
(Activate Changes)


CORE_WLS_Domain --> Services --> Messaging --> JMS Modules --> JMSModule_Mensajeria

New:

Connection Factory (next)

Name: ConnectionFactory-Mensajeria
JNDI Name: jms/ConnectionFactory-Mensajeria (next)
(finish)
(Activate Changes)

New:

Distributed Queue (next)

Name: DistributedQueue-Mensajeria
JNDI Name: jms/journal-standar (next)
Advanced Targeting: MensajeriaSubdeployment

JMS Servers: JMSServer-Mensajeria_1, JMSServer-Mensajeria_2
(finish)
(Activate Changes)



12 October 2017

Opatch WLS 12c

Backup Oracle Home:
It is highly recommended that you back up the Oracle home before any patch operation. You can back up the Oracle home using your preferred method. You can use any method such as zip, cp -r, tar, and cpio to compress the Oracle home.

Opatch path:
/Users/German/Oracle/Middleware/Oracle_Home/OPatch

List patches:
./opatch lsinventory
./opatch lsinventory -detail

Check if it's feasible:
./opatch apply /Users/German/tmp/patches/23639929 -report

Apply patch:
./opatch apply /Users/German/tmp/patches/23639929

Rollback patch
./opatch rollback -id 23639929

logs:
ORACLE_HOME/cfgtoollogs/opatch/

More info:
https://docs.oracle.com/middleware/1213/core/OPATC/toc.htm

11 October 2017

Too many open files


The following problem may occurr in WLS:

Caused By: java.net.SocketException: Too many open files
  at java.net.Socket.createImpl(Socket.java:447)
  at java.net.Socket.connect(Socket.java:577)
  at oracle.net.nt.TcpNTAdapter.connect(TcpNTAdapter.java:161)
  at oracle.net.nt.ConnOption.connect(ConnOption.java:159)
  at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:428)
  at oracle.net.resolver.AddrResolution.resolveAndExecute(AddrResolution.java:506)
  at oracle.net.ns.NSProtocol.establishConnection(NSProtocol.java:595)
  at oracle.net.ns.NSProtocol.connect(NSProtocol.java:230)

This is a common issue when  File Descriptors are not enough for the OS processes.

Checcking the most open FD appear WLS Managed Servers and they are almost on the limit:

4076 376 /u04/Middleware/WLS12c/jdk/bin/java-server-Xms1024m-Xmx2048m-XX:PermSize=256m-XX:MaxPermSize=512m-Dweblogic.Name=WLS02

4063 32526 /u04/Middleware/WLS12c/jdk/bin/java-server-Xms1024m-Xmx2048m-XX:PermSize=256m-XX:MaxPermSize=512m-Dweblogic.Name=WLS01

Checking with lsof we see a lot of open jar files from war files, because we have several war files deployed.

Check:

$ ulimit -n
4096

Therefore the solution is to set a bigger soft&hard limit.

04 October 2017

How to know OHS version

$ ./httpd.worker -v
./httpd.worker: error while loading shared libraries: libexpat.so.0: cannot open shared object file: No such file or directory

$ ps -fea | grep httpd

$ export ORACLE_HOME=/u04/Middleware/P_OHS12c/product

$ export LD_LIBRARY_PATH=/u04/Middleware/P_OHS12c/product/lib

$ cd /u04/Middleware/P_OHS12c/product/wlserver/../ohs/bin/

$ ./httpd.worker -v
Server version: Oracle-HTTP-Server/2.2.22 (Unix)
Server built:   Sep  3 2015 01:14:57
Server label:   APACHE_12.1.3.0.0_LINUX.X64_RELEASE



My Blog List

Blog Archive

There was an error in this gadget

Disclaimer

The views expressed on this blog are my own and do not necessarily reflect the views of Oracle.