当前位置:编程学习 > JAVA >>

bae项目链接数据好难

com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException: Cannot load connection class because of underlying exception: 'java.security.AccessControlException: access denied (java.lang.RuntimePermission modifyThreadGroup)'.

在bae项目中执行个save·  就报错· 求大神指点·!!!

 <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://sqld.duapp.com:4050/aVZRex***wfEQRwv?createDatabaseIfNotExist=true&useUnicode=true&characterEncoding=utf8&autoReconnect=true" />
<property name="username" value="Yzb2h0***wqIkhgb"/>
<property name="password" value="6ZadCaLm*****kXobxbUdM6GSb"/>
</bean>
 <!-- 
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
<property name="jdbcUrl" value="jdbc:mysql://localhost:3306/shop6"></property>
<property name="user" value="root"></property>
<property name="password" value="root"></property>
<property name="driverClass" value="com.mysql.jdbc.Driver"></property>
</bean>
1: LocalSessionFactoryBean取代了HibernateSessionFactory
作用: 用来加载hibernate配置文件, 管理连接
 --> 
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">

<property name="configLocation" value="classpath:hibernate.cfg.xml" />
<property name="dataSource"  ref="dataSource"/>
</bean>

<!-- 2: 事务管理器,管理sessionFacotry -->
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>

<!-- 3: 配置通知 
 AOP: 面向切面编程,  首选需要一个切面, 前面里面的方法 就叫通知, 向哪里切 就要切入表达式
-->
<tx:advice id="advice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="save*" propagation="REQUIRED"/>
<tx:method name="update*" propagation="REQUIRED"/>
<tx:method name="delete*" propagation="REQUIRED"/>
<tx:method name="*" propagation="SUPPORTS" read-only="true"/>
</tx:attributes>
</tx:advice>

<!-- 4:配置切入表达式: 只是确定 包.类.方法, 上面的 advice 才能确认每个方法是否需要切入事务,所以两者结合-->
<aop:config>
<aop:pointcut expression="execution(* com.tuotem4.wxfw.service.impl.*.*(..))" id="pointcut"/>
<aop:advisor advice-ref="advice" pointcut-ref="pointcut"/>
</aop:config>
</beans>
补充:Java ,  Java EE
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,