java.lang.Security Exception



我实现了基于WebLogic 10.服务器中的调度程序运行的spring应用程序。当我部署它时。我正在超越异常。

这是我的堆栈跟踪

   java.lang.SecurityException: [Security:090398]Invalid Subject: principals=[bpm_weblogic, AdminChannelUsers, Administrators, AppTesters, CrossDomainConnectors, Deployers, Monitors, Operators, OracleSystemGroup]
    at weblogic.security.service.SecurityServiceManager.seal(SecurityServiceManager.java:833)
    at weblogic.security.service.IdentityUtility.authenticatedSubjectToIdentity(IdentityUtility.java:30)
    at weblogic.security.service.RoleManager.getRoles(RoleManager.java:183)
    at weblogic.security.service.AuthorizationManager.isAccessAllowed(AuthorizationManager.java:375)
    at weblogic.jndi.internal.ServerNamingNode.checkPermission(ServerNamingNode.java:442)
    at weblogic.jndi.internal.ServerNamingNode.checkLookup(ServerNamingNode.java:423)
    at weblogic.jndi.internal.ServerNamingNode.lookupHere(ServerNamingNode.java:180)
    at weblogic.jndi.internal.BasicNamingNode.unbind(BasicNamingNode.java:565)
    at weblogic.jndi.internal.WLEventContextImpl.unbind(WLEventContextImpl.java:173)
    at javax.naming.InitialContext.unbind(InitialContext.java:435)
    at com.tcs.controller.BpmController.run(BpmController.java:94)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:64)
    at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:53)
    at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:81)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:744)

我的 Spring 应用程序在一个 Weblogic 环境中运行,我调用在另一个 Weblogic 环境中运行的 BPM。在这里,如果不调用 bpm,我不会收到异常,如果我使用数据源而不是 jndi,它工作正常。但问题是我必须调用 BPM,并且我不能在生产中使用数据源配置。

这是我的控制器类

public String executeBpm(User user) {
        IBPMContext context = null;
        String status = null;
        if (logger.isDebugEnabled()) {
            logger.debug("executeBpm method starts");
        }
        try {
            if (user.getUserId() != null && !("").equals(user.getUserId())) {
                context = ITBABPMContext.getIBPMContextUsingName(user.getUserId());
            }
            HashMap<String, Object> elements = (HashMap<String, Object>) user.getMap();
            UpdateTaskDetails updates = new UpdateTaskDetails();
            if (user.getTaskId() != null && !("").equals(user.getTaskId())) {
                updates.setTaskID(user.getTaskId());
            }
            if (user.getTaskId() != null && !("").equals(user.getTaskId())) {
                updates.setTaskOutcome(user.getTaskOutcome());
            }
            if (user.getUserComment() != null && !("").equals(user.getUserComment())) {
                updates.setUserComment(user.getUserComment());
            }
            if (!elements.isEmpty() && elements.size() > 0) {
                updates.setElementList(elements);
            }
            if (logger.isDebugEnabled()) {
                logger.debug("executeBpm method ends");
            }
            status = ITBAACMUtil.updateTaskOutcome(updates, context);
            if (status.equalsIgnoreCase("success")) {
                bpmProcessorService.write(user.getUserId(), user.getSeqNo());
            }
        } catch (ITBABPMRuntimeException e) {
            e.printStackTrace();
        } catch (BPMServiceClientException e) {
            e.printStackTrace();
        } catch (BPMException e) {
            e.printStackTrace();
        }
        catch (Exception e) {
            e.printStackTrace();
        }
        return status;
    }

我的道类

public void write(String userId,Long seqNo){
        try{
            String query=messageSource.getMessage(BPMConstants.FAILED_QUERY,new Object[]{Long.toString(seqNo)},Locale.US);
            jdbcTemplate.update(query);
    }catch(Exception e){
        logger.error("exception at updating the status to failed ..");
        logger.error(e.getStackTrace());
    }

}

这里有一件事是跨域映射已经存在,其他应用程序运行良好。 所以我认为这不是跨域映射的问题。这是我的配置文件。

  <context:component-scan base-package="com.app" /> 
   <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
    <property name="jndiName" value="MCDataSource"/>
    </bean>  
     <bean id="txManager" class="org.springframework.transaction.jta.WebLogicJtaTransactionManager" /> 
     <bean id="transactionManager" class="org.springframework.transaction.jta.WebLogicJtaTransactionManager">
    <property name="transactionManagerName" value="javax.transaction.TransactionManager"/>
    </bean>

<!--   <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
    <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" />
    <property name="url" value="jdbc:oracle:thin:@172.19.8.159:1521/OIM.itba.gov.in" />
    <property name="username" value="AppDB"></property>
    <property name="password" value="AppDB"></property>
    <property name="initialSize" value="2" />
    <property name="maxActive" value="5" />
    </bean>     -->


    <bean id="messageSource"
        class="org.springframework.context.support.ResourceBundleMessageSource">
        <property name="basename">
            <value>messages</value>
        </property>
    </bean>
  <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
        <property name="dataSource" ref="dataSource" />
    </bean>  
   <bean id="runScheduler" class="com.app.controller.BpmController" />
       <task:scheduled-tasks>
    <task:scheduled ref="runScheduler" method="run" cron="0 0/5 * * * ?" />
   </task:scheduled-tasks>

嘿,看来你的问题是你没有正确切换上下文。打开 IBPM 上下文后,您将返回并尝试查找本地 jndi 树,但您拥有的 IBPM 上下文凭据不会在本地 Web 逻辑上进行身份验证。在对数据源执行 jndi 查找操作之前,需要打开一个新上下文。

下面是一些示例代码:

jndiTemplate(org.springframework.jndi.JndiTemplate) { bean ->
    bean.scope = "prototype"
    environment = [
      "java.naming.factory.initial":"weblogic.jndi.WLInitialContextFactory",
      "java.naming.security.principal"  : "username",
      "java.naming.security.credentials": "password"
      ]
}
dataSource(org.springframework.jndi.JndiObjectFactoryBean){
    jndiTemplate = ref(jndiTemplate)
    jndiName = "name"
    exposeAccessContext=true
}

然后,当您要查找jndi时,您可以像这样。注入 jndiTemplate 并:

jndiTemplate.context.getProperties()

InitialContext initialContext = new InitialContext(jndiTemplate.getEnvironment());

然后,您可以将其关闭。

相关内容

  • 没有找到相关文章

最新更新