Showing posts with label weblogic server. Show all posts
Showing posts with label weblogic server. Show all posts

Monday, September 24, 2012

Difference between SID and Service for WLST Config


How to define a datasource in Oracle WebLogic WLST Configuration

For a SID:
<attribute name="Url" value="jdbc:oracle:thin:@hostname:1521:SID" />

For a Service:
<attribute name="Url" value="jdbc:oracle:thin:@hostname:1521/Service" />

Monday, September 10, 2012

javax.security.auth.callback.UnsupportedCallbackException: [Security:090175]

Application throwing Unrecognized Callback exception when connecting through t3:
javax.security.auth.callback.UnsupportedCallbackException: [Security:090175]Unrecognized Callback com.abc.def.security.identityassertion.DramaCallback@32a4755]
at weblogic.jndi.internal.ExceptionTranslator.toNamingException(ExceptionTranslator.java:44)
at weblogic.jndi.WLInitialContextFactoryDelegate.toNamingException(WLInitialContextFactoryDelegate.java:788)
at weblogic.jndi.WLInitialContextFactoryDelegate.pushSubject(WLInitialContextFactoryDelegate.java:675)
at weblogic.jndi.WLInitialContextFactoryDelegate.newContext(WLInitialContextFactoryDelegate.java:469)
at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java:376)
at weblogic.jndi.Environment.getContext(Environment.java:315)
at weblogic.jndi.Environment.getContext(Environment.java:285)
at weblogic.jndi.Environment.createInitialContext(Environment.java:208)
at weblogic.jndi.Environment.getInitialContext(Environment.java:192)
at weblogic.jndi.Environment.getInitialContext(Environment.java:170)
at weblogic.jndi.Environment.getContext(Environment.java:215)


Normally the application works fine when connected through http protocol.
Following are the suggestions to get rid of this error:
1. Move the default SQL authenticator to the top and make it sufficient
2. Don't throw any exception when UnsupportedCallbackException is caught during callback handler handle call

However you may need to watch out for the pros and cons of these solutions provided here.

Thursday, June 28, 2012

Default Transaction Attribute for EJBs

Default transaction attributes differ from container to container.
In Weblogic Server, default transaction attribute for MDB is NotSupported however for all other EJBs is Supports for version 10.0 onwards - if no attribute value is specified for trans-attribute in the ejb deployment descriptor.

Container-Managed Transaction Elements in ejb-jar.xml (WebLogic Server 10.x)

Element: transaction-type
Description: Allowable values are Bean or Container.
Default: None, EJB 2.x requires this attribute to be specified.


Element: trans-attribute
Description: 
Specifies how the container manages the transaction boundaries when delegating a method invocation to an enterprise bean's business method. Allowable values are:
  • NotSupported
  • With the NotSupported value, when an entity bean runs in an unspecified transaction, if a transaction exists, the EJB container suspends the transaction; when an entity bean runs in an unspecified transaction, and no transaction exists, the EJB container takes no action.
  • Supports
  • With the Supports value, when an entity bean runs in an unspecified transaction, if a transaction exists, the EJB container uses the current transaction; when an entity bean runs in an unspecified transaction, and no transaction exists, the EJB container takes no action.
  • Required
  • RequiresNew
  • Mandatory
  • Never
  • With the Never value, when an entity bean runs in an unspecified transaction, if a transaction exists, the EJB container throws an exception; when an entity bean runs in an unspecified transaction, and no transaction exists, the EJB container takes no action.
Note: In in pre-9.0 releases of WebLogic Server, the EJB container would start a new transaction when no transaction existed and the value of trans-attribute was NotSupported, Supports, and Never. Set entity-always-uses-transaction inweblogic-ejb-jar.xml to True if you want the EJB container to behave as it did in pre-9.0 releasesof WebLogic Server and create a new transaction.

Because clients do not provide a transaction context for calls to an MDB, MDBs that use container-managed transactions must have trans-attribute of Required.


Default: If not specified, the EJB container issues a warning, and usesNotSupported for MDBs and Supportsfor other types of EJBs.

Element: transaction-scope
Description: 
This optional element specifies whether an enterprise bean requires distributed transactions for its methods or whether the local transaction optimization may be used.
Allowable values are Local and Distributed.

Default: If not specified, the container assumes that distributed transactions must be used.


Reference: http://docs.oracle.com/cd/E11035_01/wls100/ejb/implementing.html#wp1150418

Wednesday, October 26, 2011

Helpful WLST Commands (Windows OS)


Open the WLST Prompt
Open command prompt and cd to weblogic server domain
Set the required classpaths by executing the setDomainEnv.cmd from domain/bin folder
java weblogic.WLST

Connect to the server
connect(‘username’, ‘password’,’AdminServer’)
This will connect to the server running on localhost:7001 by default, optionally these parameters can also be passed.

List applications including shared libraries
listApplications()

Deploy commands for shared library
deploy('shared-library-name',path='JAR/WAR/EAR full path', libraryModule='true')


Deploy commands for application
deploy('application-name',path='Application full path', libraryModule='false')

Undeploy applications/shared libraries
undeploy(‘application-name/shared-lib-name’)

Help command
help(), help('commandName')

Exit command
exit()

Disconnect command
disconnect()

Friday, October 21, 2011

ServiceInitializationException fatal internal error

Errors while starting weblogic server:


com.bea.common.engine.ServiceInitializationException: org.apache.openjpa.util.InternalException: There was an error when invoking the static getInstance method on the named factory class "kodo.jdbc.kernel.KodoJDBCBrokerFactory".  See the nested exception for details.
at com.bea.common.engine.internal.ServiceEngineImpl.findOrStartService(ServiceEngineImpl.java:365)
at com.bea.common.engine.internal.ServiceEngineImpl.findOrStartService(ServiceEngineImpl.java:315)
at com.bea.common.engine.internal.ServiceEngineImpl.lookupService(ServiceEngineImpl.java:257)
at com.bea.common.engine.internal.ServicesImpl.getService(ServicesImpl.java:72)
at weblogic.security.service.internal.WLSIdentityServiceImpl.initialize(WLSIdentityServiceImpl.java:47)
at weblogic.security.service.CSSWLSDelegateImpl.initializeServiceEngine(CSSWLSDelegateImpl.java:300)
at weblogic.security.service.CSSWLSDelegateImpl.initialize(CSSWLSDelegateImpl.java:221)
at weblogic.security.service.CommonSecurityServiceManagerDelegateImpl.InitializeServiceEngine(CommonSecurityServiceManagerDelegateImpl.java:1783)
at weblogic.security.service.CommonSecurityServiceManagerDelegateImpl.initializeRealm(CommonSecurityServiceManagerDelegateImpl.java:442)
at weblogic.security.service.CommonSecurityServiceManagerDelegateImpl.loadRealm(CommonSecurityServiceManagerDelegateImpl.java:840)
at weblogic.security.service.CommonSecurityServiceManagerDelegateImpl.initializeRealms(CommonSecurityServiceManagerDelegateImpl.java:869)
at weblogic.security.service.CommonSecurityServiceManagerDelegateImpl.initialize(CommonSecurityServiceManagerDelegateImpl.java:1028)
at weblogic.security.service.SecurityServiceManager.initialize(SecurityServiceManager.java:875)
at weblogic.security.SecurityService.start(SecurityService.java:141)
at weblogic.t3.srvr.SubsystemRequest.run(SubsystemRequest.java:64)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
Solution:
One of the possible solution for this is to check if the database port is correct in config.xml for <sec:connection-url> tag.

Friday, May 28, 2010

Side By Side Deployment for Applications

Why do we need "Side By Side Deployment" ?
In the past there has to be a downtime when a application needs to be deployed or a new version of the same application needs to be deployed.

Today application downtime has become zero. Zero downtime can be achieved in various ways. Oracle Weblogic Server provides a neat mechanism of deploying the new version of application without affecting the existing version of application and existing user sessions. At the same time it makes sure that once all the user sessions end (or after a specified timeout period) old version of application is retired automatically.

Once new version of application is deployed using "Side By Side Deployment" mechanism, all new user requests will be served by the new version of the application.

Prerequisite to deploy the application using "Side By Side Deployment" mechanism is that the previously deployed application has to be versioned. If previously deployed application is not versioned then the new application cannot be deployed using "Side By Side Deployment" mechanism. If attempted, it will throw weblogic.management.ManagementException: [Deployer:149081]You cannot deploy application, '[Your-App-Name]', with version '[App-Version]'. The application was previously deployed without version.

To version an application, the attribute "Weblogic-Application-Version: x.xx" should be present in manifest file.

Once the new version of application is deployed successfully and all user sessions requesting old version of application is closed, the old version of application will go into "Retired" state automatically. An application which is in "Retired" state can be made "Active" by clicking the "Start - Serving All Requests". If old version of application is made active, the new version of application will go into "Retired" state, provided all the user sessions requesting new application is closed.

Applications in "Retired" state has to be manually undeployed.

Thursday, January 14, 2010

How to encrypt password using weblogic?

Follow the following steps to encrypt a text using weblogic utility:



  1. Open a DOS or UNIX command prompt

  2. Change directory to the weblogic server domain home

  3. Set the weblogic server environment

  4. Run the command to encrypt text vinaybarnwal

  5. Command:/>java weblogic.security.Encrypt vinaybarnwal

  6. And it should print the encrypted value for vinaybarnwal

Thursday, December 24, 2009

Get a connection from datasource

Get a database connection from datasource: