KK

Kim-'s-Blog.Object-Everything.I'm POJO.

.紀-錄.爲了忘卻的記憶..真的勇士,要敢于直面遇到的問題,敢于正視繁雜的原碼......在實踐中積累!

  BlogJava :: 首页 :: 联系 :: 聚合  :: 管理
  74 Posts :: 1 Stories :: 70 Comments :: 0 Trackbacks

#

同事配置Spring security 2,使用Ehcache 缓冲时出现如下错误
Caused by: java.lang.NoSuchMethodError: net.sf.ehcache.Cache.<init>(Ljava/lang/String;ILnet/sf/ehcache/store/MemoryStoreEvictionPolicy;ZLjava/lang/String;ZJJZJLnet/sf/ehcache/event/RegisteredEventListeners;Lnet/sf/ehcache/bootstrap/BootstrapCacheLoader;I)V

Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.userdetails.jdbc.JdbcUserDetailsManager#0.caching': Cannot resolve reference to bean 'userCache' while setting bean property 'userCache'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userCache' defined in ServletContext resource [/WEB-INF/spring-security.xml]: Cannot resolve reference to bean 'userEhCache' while setting bean property 'cache'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userEhCache' defined in ServletContext resource [/WEB-INF/spring-security.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: net.sf.ehcache.Cache.<init>(Ljava/lang/String;ILnet/sf/ehcache/store/MemoryStoreEvictionPolicy;ZLjava/lang/String;ZJJZJLnet/sf/ehcache/event/RegisteredEventListeners;Lnet/sf/ehcache/bootstrap/BootstrapCacheLoader;I)V
 
原因:使用ehcache-1.3.0.jar或者ehcache-1.5.0.jar替换 ehcache-1.2.3.jar
还需 backport-util-concurrent-3.1.jar
不然会报:java.lang.ClassNotFoundException: edu.emory.mathcs.backport.java.util.concurrent.Exe cutionException
backport-util-concurrent-3.1.jar 下载地址。
http://mirrors.ibiblio.org/pub/mirrors/maven/mule/dependencies/maven2/backport-util-concurrent/backport-util-concurrent/3.1/backport-util-concurrent-3.1.jar

 

posted @ 2009-08-31 09:32 Kim' 阅读(1494) | 评论 (0)编辑 收藏

同事遇到“StrutsUtils 未定义”错误
struts2.1.6
s:optiontransferselect
没有加载 Struts2 js

已加 <s:head />
源文件生产:
<script src="/xxxx/struts/utils.js" type="text/javascript"></script>

原因:
web.xml中
Struts没拦截js文件,需加如:

<filter-mapping>
 <filter-name>struts2</filter-name>
 <url-pattern>*.js</url-pattern>
</filter-mapping>

posted @ 2009-08-26 14:30 Kim' 阅读(1934) | 评论 (0)编辑 收藏

前段时间对 JBPM 4.0 Spring 2.6 进行了整合
方法有几种,经过比较感觉原生集成较好~
整合后的结构:
src\resources
src\resources\jbpm
src\resources\jbpm\jbpm.cfg.xml
src\resources\jbpm\jbpm.default.cfg.xml
src\resources\jbpm\jbpm.tx.hibernate.cfg.xml

src\resources\jbpm\jbpm.mail.properties
src\resources\jbpm\jbpm.mail.templates.examples.xml
src\resources\jbpm\logging.properties
src\resources\spring\applicationContext-jbpm.xml
src\resources\spring\applicationContext-hibernate.xml


重点是5个标色文件
jbpm.cfg.xml
<?xml version="1.0" encoding="UTF-8"?>

<jbpm-configuration>

  
<import resource="jbpm/jbpm.default.cfg.xml" />
  
<import resource="jbpm/jbpm.tx.hibernate.cfg.xml" />
  
<import resource="jbpm.jpdl.cfg.xml" />
  
<import resource="jbpm.identity.cfg.xml" />

  
<!-- Job executor is excluded for running the example test cases. -->
  
<!-- To enable timers and messages in production use, this should be included. -->
  
<!--
  <import resource="jbpm.jobexecutor.cfg.xml" />
  
-->

  
<import resource="jbpm/jbpm.mail.templates.examples.xml" />
  
  
<process-engine-context>
    
<command-service>
      
<retry-interceptor />
      
<environment-interceptor />
      
<spring-transaction-interceptor />
    
</command-service>
  
</process-engine-context>

  
<transaction-context>
    
<transaction />
    
<hibernate-session />
  
</transaction-context>

</jbpm-configuration>

jbpm.default.cfg.xml
<?xml version="1.0" encoding="UTF-8"?>

<jbpm-configuration>

  
<process-engine-context>
  
    
<repository-service />
    
<repository-cache />
    
<execution-service />
    
<history-service />
    
<management-service />
    
<identity-service />
    
<task-service />
    
<!--kim
    <hibernate-configuration>
      <cfg resource="jbpm.hibernate.cfg.xml" />     
    </hibernate-configuration>

    <hibernate-session-factory />
    !
-->
    
<script-manager default-expression-language="juel"
                    default-script-language
="juel">
      
<script-language name="juel" factory="org.jbpm.pvm.internal.script.JuelScriptEngineFactory" />
    
</script-manager>
    
    
<authentication />

    
<id-generator />
    
<types resource="jbpm.variable.types.xml" />

    
<address-resolver />

    
<business-calendar>
      
<monday    hours="9:00-12:00 and 12:30-17:00"/>
      
<tuesday   hours="9:00-12:00 and 12:30-17:00"/>
      
<wednesday hours="9:00-12:00 and 12:30-17:00"/>
      
<thursday  hours="9:00-12:00 and 12:30-17:00"/>
      
<friday    hours="9:00-12:00 and 12:30-17:00"/>
      
<holiday period="01/07/2008 - 31/08/2008"/>
    
</business-calendar>
    
    
<mail-template name='task-notification'>
      
<to users="${task.assignee}"/>
      
<subject>${task.name}</subject>
      
<text><![CDATA[Hi ${task.assignee},
Task "${task.name}" has been assigned to you.
${task.description}

Sent by JBoss jBPM
]]></text>
    
</mail-template>
  
    
<mail-template name='task-reminder'>
      
<to users="${task.assignee}"/>
      
<subject>${task.name}</subject>
      
<text><![CDATA[Hey ${task.assignee},
Do not forget about task "${task.name}".
${task.description}

Sent by JBoss jBPM
]]></text>
    
</mail-template>
  
  
</process-engine-context>

  
<transaction-context>
    
<repository-session />
    
<db-session />
    
    
<message-session />
    
<timer-session />
    
<history-session />
    
<mail-session>
      
<mail-server>
        
<session-properties resource="jbpm.mail.properties" />
      
</mail-server>
    
</mail-session>
  
</transaction-context>

</jbpm-configuration>

jbpm.tx.hibernate.cfg.xml
<?xml version="1.0" encoding="UTF-8"?>

<jbpm-configuration>

  
<process-engine-context>
    
<command-service>
      
<retry-interceptor />
      
<environment-interceptor />
      
<!-- <standard-transaction-interceptor /> -->
      
<spring-transaction-interceptor current="true" /> 
    
</command-service>
  
</process-engine-context>
  
<!--kim  
  <transaction-context>
    <transaction />
    <hibernate-session />
  </transaction-context>
  
-->
  
<transaction-context>
    
<hibernate-session current="true"/>
  
</transaction-context>
  

</jbpm-configuration>

applicationContext-jbpm.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
<beans>

    
<bean id="jbpmConfiguration" class="org.jbpm.pvm.internal.cfg.SpringConfiguration">
           
<constructor-arg value="jbpm/jbpm.cfg.xml" />
    
</bean>
    
<bean id="processEngine" factory-bean="jbpmConfiguration" factory-method="buildProcessEngine" />
    
<bean id="repositoryService" factory-bean="processEngine" factory-method="getRepositoryService" />
    
<bean id="executionService" factory-bean="processEngine" factory-method="getExecutionService" />
    
<bean id="historyService" factory-bean="processEngine" factory-method="getHistoryService" />
    
<bean id="managementService" factory-bean="processEngine" factory-method="getManagementService" />
    
<bean id="taskService" factory-bean="processEngine" factory-method="getTaskService" />
    
<bean id="identityService" factory-bean="processEngine" factory-method="getIdentityService" />

</beans>

applicationContext-hibernate.xml (片段)

<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean" parent="AbstractSessionFactory">
        
<property name="annotatedClasses">
            
<list>
                
<value>xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</value>
</list>
        
</property>
        
<property name="mappingResources">
            
<list>
                
<value>jbpm.repository.hbm.xml</value>
                
<value>jbpm.execution.hbm.xml</value>
                
<value>jbpm.history.hbm.xml</value>
                
<value>jbpm.task.hbm.xml</value>
                
<value>jbpm.identity.hbm.xml</value>
            
</list>
        
</property>
        
    
</bean>

另外该有的Jar包都要有哦~
posted @ 2009-08-21 15:19 Kim' 阅读(1909) | 评论 (1)编辑 收藏

have different Class objects for the type javax/el/ExpressionFactory used in the signature

使用Tomcat发布时,需将jurl.jar,jurl-engine.jar,jurl-impl.jar替换Tomcat安装目录lib下的el-api.jar
并且项目中不能有这3个包。
Or you can still use Tomcat 6.0, but you must replace el-api.jar with juel.jar. And don't forget to remove juel.jar from your app lib(A duplicate import, ...

posted @ 2009-08-21 15:00 Kim' 阅读(1435) | 评论 (1)编辑 收藏

惊叹JBPM的更新速度
项目要使用工作流引擎
谈需求时JBPM 4.0还是beta版,现在我们需求谈好,JBPM 4.0也已经出到GA版
JBPM 4与3的差别相当大......,看来JBPM自己已经抛弃了3,我们项目也没必要犹豫了,选4吧~
下载地址:
http://downloads.sourceforge.net/project/jbpm/a%29%20jBPM%204/jbpm-4.0/jbpm-4.0.zip?use_mirror=nchc

1:JBPM 4  DB 里 居然没有 Sql server ,难道不支持Sqlserver。
因为JBPM 4使用Hibernate,不支持Sqlserver可能性不大,所以自己写相应的create.sql drop.sql 及 hibernate配置文件。
测试可以通过。

但还是遇到些许问题..
A:org.hibernate.exception.ConstraintViolationException: could not insert: [org.jbpm.pvm.internal.history.model.HistoryProcessInstanceImpl]
Caused by: java.sql.SQLException: 当 IDENTITY_INSERT 设置为 OFF 时,不能为表 'JBPM4_HIST_PROCINST' 中的标识列插入显式值。
JBPM4_HIST_PROCINST : DBID_ bigint not null IDENTITY, 改为 DBID_ bigint not null
经查系改Sql时没看仔细,该表非IDENTITY id。

B:org.hibernate.exception.ConstraintViolationException: could not insert: [org.jbpm.pvm.internal.model.ExecutionImpl]
Caused by: java.sql.SQLException: 违反了 UNIQUE KEY 约束 'UQ__JBPM4_EXECUTION__7D8391DF'。不能在对象 'dbo.JBPM4_EXECUTION' 中插入重复键。

ID_ ASC
Note that SQL Server doesn't allow multiple null values in a column with
a unique constraint (JBPM4_EXECUTION.ID_).
忍痛去掉该约束~

2:待续~

posted @ 2009-08-04 20:51 Kim' 阅读(2326) | 评论 (7)编辑 收藏

发布个rmi服务居然出现如下:

17.05.2009 10:19:50 [main] INFO  org.springframework.remoting.rmi.RmiServiceExporter  - Looking for RMI registry at port '1099'
17.05.2009 10:19:54 [main] DEBUG org.springframework.remoting.rmi.RmiServiceExporter  - RMI registry access threw exception
java.rmi.ConnectException: Connection refused to host: 
172.18.7.235; nested exception is: 
 java.net.ConnectException: Connection refused: connect
 at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:
601)
 at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:
198)
 at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:
184)
 at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:
322)
 at sun.rmi.registry.RegistryImpl_Stub.list(Unknown Source)
 at org.springframework.remoting.rmi.RmiServiceExporter.testRegistry(RmiServiceExporter.java:
411)
 at org.springframework.remoting.rmi.RmiServiceExporter.getRegistry(RmiServiceExporter.java:
391)
 at org.springframework.remoting.rmi.RmiServiceExporter.getRegistry(RmiServiceExporter.java:
370)
 at org.springframework.remoting.rmi.RmiServiceExporter.getRegistry(RmiServiceExporter.java:
331)
 at org.springframework.remoting.rmi.RmiServiceExporter.prepare(RmiServiceExporter.java:
263)
 at org.springframework.remoting.rmi.RmiServiceExporter.afterPropertiesSet(RmiServiceExporter.java:
227)
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:
1369)
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:
1335)
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:
473)
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$
1.run(AbstractAutowireCapableBeanFactory.java:409)
 at java.security.AccessController.doPrivileged(Native Method)
 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:
380)
 at org.springframework.beans.factory.support.AbstractBeanFactory$
1.getObject(AbstractBeanFactory.java:264)
 at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:
222)
 at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:
261)
 at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:
185)
 at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:
164)
 at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:
429)
 at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:
728)
 at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:
380)
 at org.springframework.context.support.ClassPathXmlApplicationContext.
<init>(ClassPathXmlApplicationContext.java:139)
 at org.springframework.context.support.ClassPathXmlApplicationContext.
<init>(ClassPathXmlApplicationContext.java:93)
 at cn.edu.hust.mes.webservice.CallWebServices.
<clinit>(CallWebServices.java:31)
 at cn.edu.hust.mes.opcapp.OpcApplication.main(OpcApplication.java:
15)
Caused by: java.net.ConnectException: Connection refused: connect
 at java.net.PlainSocketImpl.socketConnect(Native Method)
 at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:
333)
 at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:
195)
 at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:
182)
 at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:
366)
 at java.net.Socket.connect(Socket.java:
519)
 at java.net.Socket.connect(Socket.java:
469)
 at java.net.Socket.
<init>(Socket.java:366)
 at java.net.Socket.
<init>(Socket.java:180)
 at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:
22)
 at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:
128)
 at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:
595)
  
28 more
17.05.2009 10:19:54 [main] INFO  org.springframework.remoting.rmi.RmiServiceExporter  - Could not detect RMI registry - creating new one
17.05.2009 10:19:54 [main] DEBUG org.springframework.remoting.rmi.RmiServiceExporter  - RMI service [cn.edu.hust.mes.webservice.OpcPlcRmiServiceImpl@dac21] is an RMI invoker
17.05.2009 10:19:54 [main] DEBUG org.springframework.aop.framework.JdkDynamicAopProxy  - Creating JDK dynamic proxy: target source is SingletonTargetSource for target object [cn.edu.hust.mes.webservice.OpcPlcRmiServiceImpl@dac21]
17.05.2009 10:19:54 [main] INFO  org.springframework.remoting.rmi.RmiServiceExporter  - Binding service 'opcManager' to RMI registry: RegistryImpl[UnicastServerRef [liveRef: [endpoint:[172.18.7.235:1099](local),objID:[0:0:00]]]]

--------------------------------------------------
可见:Binding service 'opcManager' to RMI registry: RegistryImpl[UnicastServerRef [liveRef: [endpoint:[172.18.7.235:1099](local),objID:[0:0:0, 0]]]]
RMI其实发布成功了...
为什么开始有错呢?
查看源代码发现:其实是Spring的Debug log
他会先看有没rmi注册

org.springframework.remoting.rmi.RmiServiceExporter.testRegistry(RmiServiceExporter.java:411)
没有log下再
Could not detect RMI registry - creating new one
所以屏蔽该Log4j配置文件中加如:
log4j.logger.org.springframework.remoting.rmi.RmiServiceExporter=INFO
posted @ 2009-05-17 11:03 Kim' 阅读(10291) | 评论 (2)编辑 收藏

在我看来最有用的要属:Reverse ajax 反转Ajax的变更了.
DWR2 时,一般这样使用:
ScriptBuffer script = new ScriptBuffer();
script.appendScript("alert(1)");
ServerContext sctx = ServerContextFactory.get(servletContext ); //FIXME WCTX
if(sctx!=null)
{
 Collection<ScriptSession> pages = sctx.getScriptSessionsByPage("/HustMes/pages/menu/pbsZoneLayoutAction.action");
 );  
 for (ScriptSession session : pages)
 {
  session.addScript(script);
 }
}

并且如果是非页面调用的话 要给类注入 servletContext

现在简单多了,不管页面调用还是其他如WebService调用只需:
String page = ServerContextFactory.get().getContextPath() + "xxx.jsp";
 Browser.withPage(page,new Runnable() {
         public void run() {
      ScriptSessions.addScript("alert(1)");
         }
});
其他方法的使用,请参照API..
posted @ 2009-04-15 10:41 Kim' 阅读(944) | 评论 (0)编辑 收藏

在使用Spring Aop的时候,有时会拦截不到希望拦截的方法...

有时2.0可以但2.5却不可以~

Spring Aop 代理 有两种:Java动态代理和Cglib代理

一般我用的是Cglib代理..<aop:config proxy-target-class="true">

 

只要在被spring拦截的方法中再调用其他被代理的对象的方法就可以实现嵌套拦截,

如果调用自己对象的方法(包括继承的),

只是普通对象的方法调用(这时自己是被剥去了代理的壳的原始对象),

是不能被拦截的。

 

Debug下,看一下是不是proxy的类,被proxy的才有可能被拦截..

 

另外: 使用groovy时,不能对注入groovy Bean的java类进行AOP.(接口编程)

会报以下错误:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'messenger': BeanPostProcessor before instantiation of bean failed; nested exception is org.springframework.aop.framework.AopConfigException: Could not generate CGLIB subclass of class [class $Proxy74]: Common causes of this problem include using a final class or a non-visible class; nested exception is java.lang.IllegalArgumentException: Cannot subclass final class class $Proxy74

 

<lang:groovy id="messenger" refresh-check-delay="5000" script-source="classpath:groovy/Messenger.groovy">
        <lang:property name="message" value="I Can Do The Frug" />
</lang:groovy>


<bean id="testPageAction" class="cn.edu.hust.mes.test.TestPageAction">
  <dwr:remote javascript="test"></dwr:remote>
  <property name="messenger" ref="messenger"></property>
</bean>

posted @ 2009-04-12 15:25 Kim' 阅读(1982) | 评论 (0)编辑 收藏

在网上下了 Groovy Eclipse 插件

但怎么都不出来~

Groovy Eclipse 官网显示支持Eclipse3.4

后来发现:

org.testng.eclipse,5.7.0.1,file:/E:\Genuitec\kimplug\GroovyEclipse\plugins\org.testng.eclipse_5.7.0.1\,4,false

 

这句 Myeclipse 自带testing ng......

将这句删掉OK了 ......

posted @ 2009-03-28 17:46 Kim' 阅读(636) | 评论 (2)编辑 收藏

以前使用的Web开发监视工具,

今天要用怎么都找不到了,

只有在网上下了,

这些工具不太好下,一不小心就会中毒

传在空间里备用。

具体使用网上很多不多做介绍了

附上软件及经典使用的Flash视频,Flash可用暴风影音全屏拖动观看

 

posted @ 2009-03-27 23:20 Kim' 阅读(162) | 评论 (0)编辑 收藏

仅列出标题
共8页: 上一页 1 2 3 4 5 6 7 8 下一页 
jj