Showing posts with label weblogic12c. Show all posts
Showing posts with label weblogic12c. Show all posts

Tuesday, January 23, 2018

WebLogic stopManagedWeblogic.sh script prompts for username and password for shutting down managed server

Leave a Comment

The managed server created in the WebLogic 12c environment is prompting for the username and password when stopping the managed server with stopManagedWeblogic.sh script even when boot.properties file is present with correct credentials.

The boot.properties file configured in some other accessible location whose path is specified using -Dweblogic.system.BootIdentityFile java option

I've observed below strange behavior

  • It's not prompting for username and password when starting the managed server with startManagedWeblogic.sh script(I suppose it's looking into boot.properties file).
  • It's not prompting for username and password when starting and stopping admin server

It's prompting for username and password only in case of managed server shutdown using stopManagedWeblogic.sh script.

Is passwordless managed server shutdown not supported in WebLogic ?, as I don't want username and password specified as a parameter to stop script.

1 Answers

Answers 1

I faced a similar issue and could resolve it by trying the following:

  1. create the directory <domain_home>/servers/<managed_server>/security
  2. create boot.properties in the above directory with the below values:
    username=<username>
    password=<password>

Now, start/stopManagedWeblogic.sh would work without prompting for credentials.

Read More

Sunday, October 29, 2017

Why Session Destroyed Event triggered multiple times for one Http Session on WebLogic Cluster

Leave a Comment

I have a weblogic 12c, configured with one cluster, 4 node instances in the cluster, Default Load Algorithm is Round Robin, Replication Type is MAN. I deploy one web application on all 4 nodes.

Issue:
During the run time, I found that to one http session, sessionDestroyed event would be triggered more than one time when it becomes time out in the weblogic (1 hour). But per log, sessionCreated event was only triggered one time.

It confused me. Does there has any magic? I remember per the official documentation, session replication among the cluster instance should be transparent to the developers. So that what is expected is only one sessionCreated event and only one sessionDestroyed event would be triggered for one http session.

Attach the Log:

DEBUG Oct-20-17 01:53:40 [[ACTIVE] ExecuteThread: '9' for queue: 'weblogic.kernel.Default (self-tuning)'] (AMCSessionListener-27  ) - Session: wIc4WB62vlaYR_tMRMIc0WpBHchh5fbwpinxgaig4mJRJFhlPUcj!-1795465203!1400921280!1508478820022 Created at Fri Oct 20 01:53:40 EDT 2017 DEBUG Oct-20-17 02:54:05 [[ACTIVE] ExecuteThread: '9' for queue: 'weblogic.kernel.Default (self-tuning)'] (AMCSessionListener-46  ) - Session: wIc4WB62vlaYR_tMRMIc0WpBHchh5fbwpinxgaig4mJRJFhlPUcj!-1795465203!1400921280!1508478820022 Destroyed at Fri Oct 20 02:54:05 EDT 2017 DEBUG Oct-20-17 02:55:12 [[ACTIVE] ExecuteThread: '17' for queue: 'weblogic.kernel.Default (self-tuning)'] (AMCSessionListener-46  ) - Session: wIc4WB62vlaYR_tMRMIc0WpBHchh5fbwpinxgaig4mJRJFhlPUcj!173379423!1400921280!1508478820022 Destroyed at Fri Oct 20 02:55:12 EDT 2017 

Below is my weblogic configuration:

<?xml version="1.0" encoding="UTF-8"?> <weblogic-web-app xmlns="http://www.bea.com/ns/weblogic/90" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bea.com/ns/weblogic/90 http://www.bea.com/ns/weblogic/90/weblogic-web-app.xsd">   <session-descriptor>     <cookie-path>/AppName</cookie-path>     <persistent-store-type>replicated</persistent-store-type>     <http-proxy-caching-of-cookies>true</http-proxy-caching-of-cookies>     <cookie-secure>true</cookie-secure>      </session-descriptor>   </weblogic-web-app> 

This is my session configure in the web.xml inside web application:

<session-config>     <session-timeout>60</session-timeout> </session-config> 

This is my SessionListener.java:

public class SessionListener implements HttpSessionListener {      private static Logger logger = Logger.getLogger(SessionListener.class);      @Override     public void sessionCreated(HttpSessionEvent se) {         if (logger.isDebugEnabled()) {             logger.debug("Session: " + se.getSession().getId() + " Created at " + (new java.util.Date()));         }     }      @Override     public void sessionDestroyed(HttpSessionEvent se) {         if (logger.isDebugEnabled()) {             logger.debug("Session: " + se.getSession().getId() + " Destroyed at " + (new java.util.Date()));         }     } } 

This code for manually logout:

@RequestMapping(value = "/logout", method = RequestMethod.GET) public ModelAndView logout(HttpServletRequest request,             HttpServletResponse response) throws Exception {          ...         // Business Logic for Logout         ...          request.getSession().invalidate();          CommonViewObject vo = new CommonViewObject();         return renderReponse(request, response, vo, "Login"); } 

Any suggestion would be appreciated. I need address the issue, thank you!

Update:

According to my investigation in this week, I found that the second time call on sessionDestroyed is triggered by the time out of secondary session created by weblogic session replication, which is what I do not want. Do we have any way to avoid this?

1 Answers

Answers 1

If you force the user to logout via the invalidate()method, then HttpSessionListener sessionDestroyed() method is called twice, once when they logout, and a second time after some delayed time period.

This occurs if after the logout you redirect the user back to a web page within your application. What you're essentially doing is starting another session (which may not be immediately obvious if you haven't added security/authentication requirements to all your web pages), and the delayed second call of the sessionDestroyed() method is a timeout occurring.

The simple solution, on logout redirect the user to a web page outside of your application.

You may be interested to look :

JDev/ADF: How to log user login/logout/timeout to the database

JSP Servlet session invalidate() does not make session null

Read More

Monday, June 20, 2016

Red exclamation mark next to object in JNDI Tree

Leave a Comment

I have successfully deployed a Hazelcast Resource Adapter to Weblogic 12c using a weblogic hazelcast template, which results in a Hazelcast Connection Factory (Main#com.company.HazelcastCF) and the resource itself (Main#com.company.MyHazelcastResource) showing up in the JNDI tree when I go through the server into View JNDI Tree. Everything is functional and ears that depend on this resource adapter deploy successfully, and can use my Hazelcast node without issue.

However, there is a peculiar red exclamation mark next to the two entries connected to my resource adapter in the JNDI tree, like this one: Red exclamation mark next to HazelcastCF

How can I find out what causes this red exclamation mark to show up - and, assuming something is wrong, fix the underlying issue?

The following is the weblogic-ra.xml in META-INF for the resource adapter.

<?xml version="1.0"?> <weblogic-connector  xmlns="http://xmlns.oracle.com/weblogic/weblogic-connector"     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"     xsi:schemaLocation="http://xmlns.oracle.com/weblogic/weblogic-connector              http://xmlns.oracle.com/weblogic/weblogic-connector/1.0/weblogic-connector.xsd">      <jndi-name>Main#com.company.MyHazelcastResource</jndi-name>     <enable-access-outside-app>true</enable-access-outside-app>     <enable-global-access-to-classes>true</enable-global-access-to-classes>     <outbound-resource-adapter>         <connection-definition-group>             <connection-factory-interface>javax.resource.cci.ConnectionFactory</connection-factory-interface>             <connection-instance>                 <jndi-name>Main#com.company.HazelcastCF</jndi-name>                 <connection-properties>                     <pool-params>                         <initial-capacity>1</initial-capacity>                         <max-capacity>50</max-capacity>                         <capacity-increment>1</capacity-increment>                     </pool-params>                 </connection-properties>             </connection-instance>         </connection-definition-group>     </outbound-resource-adapter> </weblogic-connector> 

And this is a screenshot of the whole JNDI Tree after only the resource adapter being deployed (note that whatever happens onMouseOver for the exclamation mark results in a JavaScript error in the console).

enter image description here

0 Answers

Read More

Thursday, April 7, 2016

Weblogic 12c : Prefer-web-inf-classes and prefer-application-packages for Jersey

Leave a Comment

I have to use both (oddly enough ..) "prefer-web-inf-classes" and "prefer-application-packages properties of weblogic.xml on a Weblogic 12c Server (12.2.1)

It is REST application based on Jersey 1.9. * ( Jersey 1.x JAX-RS RI) and Guice.

1. Why use :prefer-web-inf-classes

If you have more than one WAR you have to place at the level of war/lib the libraries for guice-jersey / guice , other way you get an Multibindings Error.

It must be indicate also the prefer-web-inf-classes to true. This way works properly! I have tried to work in the same way using prefer-application-packages with packages (com.sun.jersey.guice.spi.container.servlet /com.google.inject.servlet, etc..) but no way.

Note: Is not possible to exclude this libraries at EAR level.

2. Why use :prefer-application-packages

To use Jersey 1.x JAX-RS RI on Weblogic 12c (12.2.1) so I have to indicate the following packages (other way Weblogic uses Jersey 2, and different version of Jackson libraries, etc. )

It works perfectly on Jersey 1.X if it is indicated this way. . I have probed two war separately, and works fine... but, remember my friend i have two war..so....

Summary

I can not use both properties (deploying error for using both properties on the weblogic.xml..), but its needed :

  1. For the problem with Guice Filter, need to put prefer-web-inf-classes to true to use guice-servlet.jar / jersey-guice.jar at war-lib level.
  2. To work with Jersey 1.x, need to use .....prefer-application-package

Question: How to combine both to use one of them??

1 Answers

Answers 1

  • Hello, world! Hi, There are two way to resolve this problem.

    1. You can used to combine both file in to one file and call it based on choose tag as requirements.

    2. You can just write tags to merge or import/ include your xml file in to one. Example shown. Hint: Do google how to merge and call xml file based on condition.

Read More