Tuesday, October 16, 2012

How to use Spring inside Struts Actions?

Spring can be integrated into Struts actions to take advantage of seamless bean findings, here is how:
Step 1: 
Create a BaseAction class and extend this class to create struts actions.
 
BaseAction.java (add spring-webmvc-struts.jar to web-inf/lib)
 
import org.springframework.web.struts.DispatchActionSupport;
public class BaseAction extends DispatchActionSupport {
 protected Object getBean(String name) {
  return getWebApplicationContext().getBean(name);
 }
} 
 
Step 2: Action class sample: 
BalanceAction.java 
public class BalanceAction extends BaseAction {
 @Override
 public ActionForward execute(ActionMapping mapping, ActionForm form,
   HttpServletRequest request, HttpServletResponse response)
   throws Exception {
  try {
   BeanService handle = (BeanService)getBean("BeanName");
   handle.businessMethod();
  } catch (Exception ex) {
   System.out.println("Cannot find the bean...");
  }
  return mapping.findForward("success");
 }
}

Maven Build Script setup for various configurations

Steps to include a jar in the EAR package while building:
Scenario 1. If the jar project is part of same EAR project heirarchy and need to build before packaging
Follow the steps given here:
step1: Add plugin maven-ear-plugin
step2: Add <configuration> block, add <modules> as follows:
 <configuration>
  <modules>
   <javaModule>
    <groupId>myProjectGroup</groupId>
    <artifactId>myArtifact</artifactId>
    <bundleFileName>myArtifact-x.0.jar</bundleFileName>
    <bundleDir>[Destination-Path]</bundleDir>
   </javaModule>
  </modules>
 </configuration>
Step3: Add the dependency as follows:
 <dependency>
  <groupId>myProjectGroup</groupId>
  <artifactId>myArtifact</artifactId>
  <version>x.0</version>
  <type>jar</type>
 </dependency>
Note: Don't specify the <bundleDir> if you want the jar file to go to default folder.

Scenario 2. If the jar is external and not part of EAR project heirarchy
Follow the steps given here:
step1: Add plugin maven-ear-plugin
step2: Add <configuration> block, add <modules> as follows:
 <configuration>
  <modules>
   <javaModule>
    <groupId>externalGroup</groupId>
    <artifactId>externalJarArtifact</artifactId>
    <bundleFileName>externalJarArtifact-x.0.jar</bundleFileName>
    <bundleDir>[Destination-Path]</bundleDir>
   </javaModule>
  </modules>
 </configuration>
Step3: Add the dependency as follows:
 <dependency>
  <groupId>externalGroup</groupId>
  <artifactId>externalJarArtifact</artifactId>
  <version>x.0</version>
  <scope>system</scope>
  <systemPath>[external-jar-local-path]/externalJarArtifact-x.0.jar</systemPath>
 </dependency>
Note: Don't specify the <bundleDir> if you want the jar file to go to default folder.

Is it the right time to buy a home or rent ?

To analyze whether you should buy a home now or still rent it depends on so many factors including:
- How long you will live in the home?
- How big you want the home?
- How much you can afford?
- What is the market trend?
- How much rent you are paying?
- Property tax
- Mortgage rate

You can analyze here http://www.ginniemae.gov/

Monday, October 15, 2012

Deployment Error while publishing application in OEPE, WebLogic Portal 10.3.4

[HTTP:101216]Servlet: "wsrp-1.0-ServiceDescriptionPortComponent"
Exception Stack Trace:
weblogic.application.ModuleException: [HTTP:101216]Servlet: "wsrp-1.0-ServiceDescriptionPortComponent" failed to preload on startup in Web application: "portalWeb".java.lang.NullPointerException

at weblogic.wsee.monitoring.WseeBaseRuntimeMBeanImpl.unregisterPorts(WseeBaseRuntimeMBeanImpl.java:285)
at weblogic.wsee.monitoring.WseeBaseRuntimeMBeanImpl.unregister(WseeBaseRuntimeMBeanImpl.java:255)
at weblogic.wsee.monitoring.WseeV2RuntimeMBeanImpl.unregister(WseeV2RuntimeMBeanImpl.java:14)
at weblogic.management.runtime.RuntimeMBeanDelegate.unregisterChildren(RuntimeMBeanDelegate.java:350)
at weblogic.management.runtime.RuntimeMBeanDelegate.unregister(RuntimeMBeanDelegate.java:274)
at weblogic.wsee.ws.WsRegistry$1.run(WsRegistry.java:325)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.wsee.ws.WsRegistry.unregisterMBean(WsRegistry.java:321)
at weblogic.wsee.ws.WsRegistry.unregisterMBean(WsRegistry.java:300)
at weblogic.wsee.deploy.DeployInfo.createWsPort(DeployInfo.java:381)
at weblogic.wsee.server.servlet.BaseWSServlet.init(BaseWSServlet.java:83)
at javax.servlet.GenericServlet.init(GenericServlet.java:241)
at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:283)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.internal.StubSecurityHelper.createServlet(StubSecurityHelper.java:64)
at weblogic.servlet.internal.StubLifecycleHelper.createOneInstance(StubLifecycleHelper.java:58)
at weblogic.servlet.internal.StubLifecycleHelper.(StubLifecycleHelper.java:48)
at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:539)
at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.java:1985)
at weblogic.servlet.internal.WebAppServletContext.loadServletsOnStartup(WebAppServletContext.java:1959)
at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1878)
at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:3153)
at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1508)
at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:482)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
at weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:200)
at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:247)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:27)
at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:636)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:205)
at weblogic.application.internal.EarDeployment.activate(EarDeployment.java:58)
at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:161)
at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:79)
at weblogic.deploy.internal.targetserver.operations.AbstractOperation.activate(AbstractOperation.java:569)
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.activateDeployment(ActivateOperation.java:150)
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doCommit(ActivateOperation.java:116)
at weblogic.deploy.internal.targetserver.operations.AbstractOperation.commit(AbstractOperation.java:323)
at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentCommit(DeploymentManager.java:844)
at weblogic.deploy.internal.targetserver.DeploymentManager.activateDeploymentList(DeploymentManager.java:1253)
at weblogic.deploy.internal.targetserver.DeploymentManager.handleCommit(DeploymentManager.java:440)
at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.commit(DeploymentServiceDispatcher.java:163)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doCommitCallback(DeploymentReceiverCallbackDeliverer.java:195)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$100(DeploymentReceiverCallbackDeliverer.java:13)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$2.run(DeploymentReceiverCallbackDeliverer.java:68)
at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:528)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:207)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:176)

java.lang.Exception: Exception received from deployment driver. See Error Log view for more detail.
at oracle.eclipse.tools.weblogic.server.internal.DeploymentProgressListener.watch(DeploymentProgressListener.java:190)
at oracle.eclipse.tools.weblogic.server.internal.WlsJ2EEDeploymentHelper.redeploy(WlsJ2EEDeploymentHelper.java:893)
at oracle.eclipse.tools.weblogic.server.internal.WlsJ2EEDeploymentHelper.redeploy(WlsJ2EEDeploymentHelper.java:762)
at oracle.eclipse.tools.weblogic.server.internal.WeblogicServerBehaviour.publishWeblogicModules(WeblogicServerBehaviour.java:1430)
at oracle.eclipse.tools.weblogic.server.internal.WeblogicServerBehaviour.publishToServer(WeblogicServerBehaviour.java:861)
at oracle.eclipse.tools.weblogic.server.internal.WeblogicServerBehaviour.publishOnce(WeblogicServerBehaviour.java:655)
at oracle.eclipse.tools.weblogic.server.internal.WeblogicServerBehaviour.publish(WeblogicServerBehaviour.java:522)
at org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publish(ServerBehaviourDelegate.java:775)
at org.eclipse.wst.server.core.internal.Server.publishImpl(Server.java:2889)
at org.eclipse.wst.server.core.internal.Server$PublishJob.run(Server.java:337)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: weblogic.application.ModuleException: [HTTP:101216]Servlet: "wsrp-1.0-ServiceDescriptionPortComponent" failed to preload on startup in Web application: "portalWeb".
java.lang.NullPointerException
at weblogic.wsee.monitoring.WseeBaseRuntimeMBeanImpl.unregisterPorts(WseeBaseRuntimeMBeanImpl.java:285)
at weblogic.wsee.monitoring.WseeBaseRuntimeMBeanImpl.unregister(WseeBaseRuntimeMBeanImpl.java:255)
at weblogic.wsee.monitoring.WseeV2RuntimeMBeanImpl.unregister(WseeV2RuntimeMBeanImpl.java:14)
at weblogic.management.runtime.RuntimeMBeanDelegate.unregisterChildren(RuntimeMBeanDelegate.java:350)
at weblogic.management.runtime.RuntimeMBeanDelegate.unregister(RuntimeMBeanDelegate.java:274)
at weblogic.wsee.ws.WsRegistry$1.run(WsRegistry.java:325)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.wsee.ws.WsRegistry.unregisterMBean(WsRegistry.java:321)
at weblogic.wsee.ws.WsRegistry.unregisterMBean(WsRegistry.java:300)
at weblogic.wsee.deploy.DeployInfo.createWsPort(DeployInfo.java:381)
at weblogic.wsee.server.servlet.BaseWSServlet.init(BaseWSServlet.java:83)
at javax.servlet.GenericServlet.init(GenericServlet.java:241)
at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:283)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.internal.StubSecurityHelper.createServlet(StubSecurityHelper.java:64)
at weblogic.servlet.internal.StubLifecycleHelper.createOneInstance(StubLifecycleHelper.java:58)
at weblogic.servlet.internal.StubLifecycleHelper.(StubLifecycleHelper.java:48)
at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:539)
at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.java:1985)
at weblogic.servlet.internal.WebAppServletContext.loadServletsOnStartup(WebAppServletContext.java:1959)
at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1878)
at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:3153)
at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1508)
at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:482)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
at weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:200)
at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:247)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:27)
at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:636)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:205)
at weblogic.application.internal.EarDeployment.activate(EarDeployment.java:58)
at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:161)
at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:79)
at weblogic.deploy.internal.targetserver.operations.AbstractOperation.activate(AbstractOperation.java:569)
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.activateDeployment(ActivateOperation.java:150)
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doCommit(ActivateOperation.java:116)
at weblogic.deploy.internal.targetserver.operations.AbstractOperation.commit(AbstractOperation.java:323)
at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentCommit(DeploymentManager.java:844)
at weblogic.deploy.internal.targetserver.DeploymentManager.activateDeploymentList(DeploymentManager.java:1253)
at weblogic.deploy.internal.targetserver.DeploymentManager.handleCommit(DeploymentManager.java:440)
at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.commit(DeploymentServiceDispatcher.java:163)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doCommitCallback(DeploymentReceiverCallbackDeliverer.java:195)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$100(DeploymentReceiverCallbackDeliverer.java:13)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$2.run(DeploymentReceiverCallbackDeliverer.java:68)
at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:528)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:207)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:176)

at weblogic.wsee.monitoring.WseeBaseRuntimeMBeanImpl.unregisterPorts(WseeBaseRuntimeMBeanImpl.java:285)
at weblogic.wsee.monitoring.WseeBaseRuntimeMBeanImpl.unregister(WseeBaseRuntimeMBeanImpl.java:255)
at weblogic.wsee.monitoring.WseeV2RuntimeMBeanImpl.unregister(WseeV2RuntimeMBeanImpl.java:14)
at weblogic.management.runtime.RuntimeMBeanDelegate.unregisterChildren(RuntimeMBeanDelegate.java:350)
at weblogic.management.runtime.RuntimeMBeanDelegate.unregister(RuntimeMBeanDelegate.java:274)
at weblogic.wsee.ws.WsRegistry$1.run(WsRegistry.java:325)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.wsee.ws.WsRegistry.unregisterMBean(WsRegistry.java:321)
at weblogic.wsee.ws.WsRegistry.unregisterMBean(WsRegistry.java:300)
at weblogic.wsee.deploy.DeployInfo.createWsPort(DeployInfo.java:381)
at weblogic.wsee.server.servlet.BaseWSServlet.init(BaseWSServlet.java:83)
at javax.servlet.GenericServlet.init(GenericServlet.java:241)
at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:283)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.internal.StubSecurityHelper.createServlet(StubSecurityHelper.java:64)
at weblogic.servlet.internal.StubLifecycleHelper.createOneInstance(StubLifecycleHelper.java:58)
at weblogic.servlet.internal.StubLifecycleHelper.(StubLifecycleHelper.java:48)
at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:539)
at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.java:1985)
at weblogic.servlet.internal.WebAppServletContext.loadServletsOnStartup(WebAppServletContext.java:1959)
at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1878)
at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:3153)
at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1508)
at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:482)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
at weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:200)
at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:247)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:27)
at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:636)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:205)
at weblogic.application.internal.EarDeployment.activate(EarDeployment.java:58)
at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:161)
at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:79)
at weblogic.deploy.internal.targetserver.operations.AbstractOperation.activate(AbstractOperation.java:569)
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.activateDeployment(ActivateOperation.java:150)
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doCommit(ActivateOperation.java:116)
at weblogic.deploy.internal.targetserver.operations.AbstractOperation.commit(AbstractOperation.java:323)
at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentCommit(DeploymentManager.java:844)
at weblogic.deploy.internal.targetserver.DeploymentManager.activateDeploymentList(DeploymentManager.java:1253)
at weblogic.deploy.internal.targetserver.DeploymentManager.handleCommit(DeploymentManager.java:440)
at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.commit(DeploymentServiceDispatcher.java:163)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doCommitCallback(DeploymentReceiverCallbackDeliverer.java:195)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$100(DeploymentReceiverCallbackDeliverer.java:13)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$2.run(DeploymentReceiverCallbackDeliverer.java:68)
at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:528)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:207)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:176)
at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1510)
at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:482)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
at weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:200)
at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:247)
at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:27)
at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:636)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:205)
at weblogic.application.internal.EarDeployment.activate(EarDeployment.java:58)
at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:161)
at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:79)
at weblogic.deploy.internal.targetserver.operations.AbstractOperation.activate(AbstractOperation.java:569)
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.activateDeployment(ActivateOperation.java:150)
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doCommit(ActivateOperation.java:116)
at weblogic.deploy.internal.targetserver.operations.AbstractOperation.commit(AbstractOperation.java:323)
at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentCommit(DeploymentManager.java:844)
at weblogic.deploy.internal.targetserver.DeploymentManager.activateDeploymentList(DeploymentManager.java:1253)
at weblogic.deploy.internal.targetserver.DeploymentManager.handleCommit(DeploymentManager.java:440)
at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.commit(DeploymentServiceDispatcher.java:163)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doCommitCallback(DeploymentReceiverCallbackDeliverer.java:195)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$100(DeploymentReceiverCallbackDeliverer.java:13)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$2.run(DeploymentReceiverCallbackDeliverer.java:68)
at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:528)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:207)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:176)
Caused by: java.lang.NullPointerException:
at weblogic.wsee.monitoring.WseeBaseRuntimeMBeanImpl.unregisterPorts(WseeBaseRuntimeMBeanImpl.java:285)
at weblogic.wsee.monitoring.WseeBaseRuntimeMBeanImpl.unregister(WseeBaseRuntimeMBeanImpl.java:255)
at weblogic.wsee.monitoring.WseeV2RuntimeMBeanImpl.unregister(WseeV2RuntimeMBeanImpl.java:14)
at weblogic.management.runtime.RuntimeMBeanDelegate.unregisterChildren(RuntimeMBeanDelegate.java:350)
at weblogic.management.runtime.RuntimeMBeanDelegate.unregister(RuntimeMBeanDelegate.java:274)
at weblogic.wsee.ws.WsRegistry$1.run(WsRegistry.java:325)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.wsee.ws.WsRegistry.unregisterMBean(WsRegistry.java:321)
at weblogic.wsee.ws.WsRegistry.unregisterMBean(WsRegistry.java:300)
at weblogic.wsee.deploy.DeployInfo.createWsPort(DeployInfo.java:381)
at weblogic.wsee.server.servlet.BaseWSServlet.init(BaseWSServlet.java:83)
at javax.servlet.GenericServlet.init(GenericServlet.java:241)
at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:283)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.internal.StubSecurityHelper.createServlet(StubSecurityHelper.java:64)
at weblogic.servlet.internal.StubLifecycleHelper.createOneInstance(StubLifecycleHelper.java:58)
at weblogic.servlet.internal.StubLifecycleHelper.(StubLifecycleHelper.java:48)
at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:539)
at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.java:1985)
at weblogic.servlet.internal.WebAppServletContext.loadServletsOnStartup(WebAppServletContext.java:1959)
at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1878)
at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:3153)
at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1508)

My Observations:
Most of the time I have run into this exception because I have modified resources (JSP, portlet, portal, java etc.) and compiled and tried to publish the application changes through OEPE.

Solution:
If you application compiles fine and does not throw any build errors, you should be able to do another publish and it should publish like a snap without any error. Try two to three times - you should be good.

If you are still facing this error, try removing the project from the server, build, compile again and add the project to the server - publish again.

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.

Default Roles not listed when using RolePolicyManager api


When using RolePolicyManager api, default roles are not listed
If no roles are created by default following two roles are provided for each portal web application:
- AnonymousVisitor
- AuthenticatedVisitor
These can be verified using portal admin console, however these never appear when using the following api:
RolePolicyManager.listRolesForResource(EARName, WEBName, EntitlementConstants.P13N_ROLE_POLICY_POOL);
To make these default roles visible, create a custom role in the web application and same api will list all the three roles:
- AnonymousVisitor
- AuthenticatedVisitor
- Custom role

Find out if database sessions are locked


To Check if there is any database session locked

SELECT s1.username || '@' || s1.machine
    || ' ( SID=' || s1.sid || ' )  is blocking '
    || s2.username || '@' || s2.machine || ' ( SID=' || s2.sid || ' ) ' AS blocking_status
    FROM v$lock l1, v$session s1, v$lock l2, v$session s2
    WHERE s1.sid=l1.sid AND s2.sid=l2.sid
    AND l1.BLOCK=1 AND l2.request > 0
    AND l1.id1 = l2.id1
    AND l2.id2 = l2.id2 ;

select * from v$lock
select * from v$session

Display the session count, max sessions, highwater etc.
select sessions_max, sessions_current, sessions_highwater from v$license;

Oracle sample queries


Sample Oracle queries run on 11g (and 10g comparisons)

Query to display stored procedures:
select OBJECT_NAME from user_procedures
select OBJECT_NAME from user_objects where object_type = 'PROCEDURE'
both returns list of stored procedures
"select OBJECT_NAME from user_procedures" returns the stored procedures and triggers as well for Oracle 11g while
"select OBJECT_NAME from user_objects where object_type = 'PROCEDURE'" returns list of stored procedures only

select * from user_sequences
select * from user_objects where object_type = 'SEQUENCE'

select * from user_tables
select * from user_objects where object_type = 'TABLE'

select * from user_triggers
select * from user_objects where object_type = 'TRIGGER'

select * from user_indexes in 10g returns the LOB as well
select * from user_objects where object_type = 'INDEX'

Display all the roles, previleges, tables
select * from user_tab_privs order by grantee, table_name

Display all the synonyms for the table owner
SELECT * FROM all_synonyms where table_owner = 'XYZ' order by owner, synonym_name;

Select from a table and concat two or more columns
SELECT column1_name || ' # ' || column2_name  as column_both FROM table_name

Grant Privileges on tables/sequences to a role
grant select/insert/update/delete on [Schema].[Table/Sequence] to [Role_Name];