- 浏览: 428894 次
- 性别:
- 来自: 北京
文章分类
- 全部博客 (144)
- java (32)
- Flex (11)
- linux (15)
- 思维至上 (2)
- 生活 (4)
- spring2.5.5 (3)
- Design pattern (0)
- jdk1.6 (1)
- erlang (14)
- mysql (5)
- nginx (10)
- 互联网 (1)
- 用户体验 (0)
- jvm (8)
- hibernate (0)
- oracle (0)
- mvn (2)
- 23种常用设计模式详细讲解及实例 (1)
- nosql (1)
- mongodb (2)
- thrift (1)
- 负载均衡 (1)
- Objective-c (1)
- fuck (1)
- resin (3)
- log4j (2)
- android (1)
- jps (0)
- lucene (2)
- rsync (1)
- python (1)
- java性能分析 (1)
- spring (1)
- zookeeper (2)
- error (1)
- 算法 (1)
- hudson (1)
- svn (1)
- maven (1)
- svn server (2)
- swap linux (1)
- 协同过滤 (1)
- 邮件系统 (1)
最新评论
-
cheetah747:
我也遇到这个问题了,不过我是直接把第三方jar放到工程文件的l ...
JAVA NoClassDefFoundError: -
dxm1986:
hillfallshore 写道亲 你这是杜撰的小说吗?完全是 ...
面试有感 -
dxm1986:
mengda1027 写道从实习生到高级java到架构师,是在 ...
面试有感 -
dxm1986:
kljjack 写道一个编程十几年,每年看几十本技术书籍,技术 ...
面试有感 -
dxm1986:
轻指飞扬 写道呵呵,挺好玩的~ 我怎么感觉你招人不是很有诚意嘛 ...
面试有感
Flex+Spring+Hibernate环境的配置
昨天到今天发了我整整两天配置Flex+Spring+Hibernate,开始一直报一个错误,
nested exception is java.lang.NoSuchMethodError: org.objectweb.asm.ClassVisitor.visit(IILjava/lang/String;Ljava/lang/String;
[Ljava/lang/String;Ljava/lang/String;)V
我在网上查了资料原因是因为Hibernate中用到asm与spring aop 中用到Asm冲突,当时我犯一个很大的错误,那就是我除了在classpath中引入了相关的spring,hibernate包以外,还把那些jar包全拷贝到了WEB-INF/lib下面,我在删除WEB-INF/lib下面,Hibernate中的如下包:
asm.jar
asm-attrs.jar
cglib-2.1.3.jar
留下了spring aop 中的如下包:
asm.jar
asm-commons.jar
asm-util.jar
cglib-nodep.jar
本来按道理可以运行了,但还是报同样的错误,我试了一次又一次,每次都是失败.直到刚我才发现,原来用myeclipse引入Hibernate与spring时,它会把上面所提到的所有jar包全部引入进来.这样就导致了错误的开始...所以我觉得我们配置上述环境的时候,最好还是自己设置自己的user lib(window-->preferences-->Java-->Buildpath-->Usre Librayries-->new)在这里分别创建user_spring与user_hibernate,其中usr_spring中要引入spring aop libraries,spring core libraries,spring persistence jdbc libraries,spring persisitence core libraries.
user_hibernate包下要引入除了
asm.jar
asm-attrs.jar
cglib-2.1.3.jar
之外的所有Hibernate jar包.
包图如下:
其中spring aop 中的包如下:
而hibernate包中,已经没有了
asm.jar
asm-attrs.jar
cglib-2.1.3.jar
spring+hibenate+flex的配置过程,还需要一个SpringFactory
它的代码如下:
package dxm.blog.common; import org.springframework.beans.BeansException; import org.springframework.beans.factory.NoSuchBeanDefinitionException; import org.springframework.context.ApplicationContext; import org.springframework.web.context.support.WebApplicationContextUtils; import flex.messaging.FactoryInstance; import flex.messaging.FlexFactory; import flex.messaging.config.ConfigMap; import flex.messaging.services.ServiceException; public class SpringFactory implements FlexFactory { private static final String SOURCE = "source"; /** * This method can be used to initialize the factory itself. It is called with configuration * parameters from the factory tag which defines the id of the factory. */ public void initialize(String id, ConfigMap configMap) {} /** * This method is called when we initialize the definition of an instance * which will be looked up by this factory. It should validate that * the properties supplied are valid to define an instance. * Any valid properties used for this configuration must be accessed to * avoid warnings about unused configuration elements. If your factory * is only used for application scoped components, this method can simply * return a factory instance which delegates the creation of the component * to the FactoryInstance's lookup method. */ public FactoryInstance createFactoryInstance(String id, ConfigMap properties) { SpringFactoryInstance instance = new SpringFactoryInstance(this, id, properties); instance.setSource(properties.getPropertyAsString(SOURCE, instance.getId())); return instance; } // end method createFactoryInstance() /** * Returns the instance specified by the source * and properties arguments. For the factory, this may mean * constructing a new instance, optionally registering it in some other * name space such as the session or JNDI, and then returning it * or it may mean creating a new instance and returning it. * This method is called for each request to operate on the * given item by the system so it should be relatively efficient. * <p> * If your factory does not support the scope property, it * report an error if scope is supplied in the properties * for this instance. */ public Object lookup(FactoryInstance inst) { SpringFactoryInstance factoryInstance = (SpringFactoryInstance) inst; return factoryInstance.lookup(); } static class SpringFactoryInstance extends FactoryInstance { SpringFactoryInstance(SpringFactory factory, String id, ConfigMap properties) { super(factory, id, properties); } public String toString() { return "SpringFactory instance for id=" + getId() + " source=" + getSource() + " scope=" + getScope(); } public Object lookup() { ApplicationContext appContext = WebApplicationContextUtils.getWebApplicationContext(flex.messaging.FlexContext.getServletConfig().getServletContext()); String beanName = getSource(); try { return appContext.getBean(beanName); } catch (NoSuchBeanDefinitionException nexc) { ServiceException e = new ServiceException(); String msg = "Spring service named '" + beanName + "' does not exist."; e.setMessage(msg); e.setRootCause(nexc); e.setDetails(msg); e.setCode("Server.Processing"); throw e; } catch (BeansException bexc) { ServiceException e = new ServiceException(); String msg = "Unable to create Spring service named '" + beanName + "' "; e.setMessage(msg); e.setRootCause(bexc); e.setDetails(msg); e.setCode("Server.Processing"); throw e; } } } }
以上代码显然是在网上找的,你把这个java文件放到你的某个包下,然后再到services-config.xml中的最后加入如入代码:
<factories> <factory id="spring" class="dxm.blog.common."/> </factories>
然后你在远程方法的配置中WEB-INF/flex/remoting-config.xml中配置你的远程方法时如下:
<destination id="userHandler"> <properties> <factory>spring</factory> <source>userHandler</source> </properties> </destination>
其中的spring对应上面配置的SpringFactory至于其它spring与hibernater的集成与javaweb工程里面是一样的.
在web.xml中配置要添加对flex的一些配置,其它的与以前一样,具体如下:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> <web-app> <display-name>Flex</display-name> <description> LiveCycle Data Services Application </description> <context-param> <param-name>flex.class.path</param-name> <param-value> /WEB-INF/flex/hotfixes,/WEB-INF/flex/jars </param-value> </context-param> <context-param> <param-name> contextConfigLocation </param-name> <param-value> /WEB-INF/applicationContext-*.xml </param-value> </context-param> <!-- hibernate --> <filter> <filter-name>hibernateFilter</filter-name> <filter-class> org.springframework.orm.hibernate3.support. OpenSessionInViewFilter </filter-class> </filter> <filter-mapping> <filter-name>hibernateFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <listener> <listener-class> flex.messaging.HttpFlexSession </listener-class> </listener> <listener> <listener-class> org.springframework.web.context.ContextLoaderListener </listener-class> </listener> <!-- MessageBroker Servlet --> <servlet> <servlet-name>MessageBrokerServlet</servlet-name> <display-name>MessageBrokerServlet</display-name> <servlet-class> flex.messaging.MessageBrokerServlet </servlet-class> <init-param> <param-name>services.configuration.file</param-name> <param-value> /WEB-INF/flex/services-config.xml </param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>MessageBrokerServlet</servlet-name> <url-pattern>/messagebroker/*</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.htm</welcome-file> </welcome-file-list> </web-app>
以附件中,我将
一:flex第一步的配置文件(包括flexbuilder的安装,以前flex web环境的搭建,还有简单的flex与java通信)以 二:flex+hibernate+spring的简单工程 (我的个人博客设计)
发给大家,有兴趣的朋友可以下载,希望能为你们节省一些时间.不要重走我的弯路.
这个东西整整花了我两天,到最后还是把问题给解决了,有一种体会,那就是不管遇到什么困难,只要你肯坚持,到最后没有战胜不了的,最大的困难其实是你自己.
评论
发表评论
-
纪念我的狼之梦
2010-10-28 23:39 1091如题 -
谈FLEX与JAVA通信及前端表现的反应速度
2010-07-09 12:39 1636在我的FLEX博客中(www.wolfdream. ... -
"RSL Error 1 of 1"问题剖析
2010-06-09 19:40 3380因为我的博客有人向我反应出现这样的问题,所以在网上搜了一下原因 ... -
Flex中鼠标滑轮控制图片大小
2010-06-07 18:58 2349前两天给我的FLEX博客(www.wolfdr ... -
Flex画虚线
2010-06-07 18:49 5648个人博客:狼之梦---爱乌及屋 今天项目需要,需要画虚线, ... -
Flex与后台(JSP)交互
2010-06-07 18:36 2885在我的FLEX博客(www.wolfdream.cn)用到了F ... -
FLEX手写在线签名及手写签名墙
2009-10-17 07:43 1839一个FLEX在线手绘签名的东东。用户可以在线签 ... -
记我的FLEX博客(二)
2009-08-19 16:43 946接着上篇写: 朋友详细信息,弹出效果如下: ... -
Flex与Severlet(Jsp)通信传递中文参数乱码问题的解决
2009-08-09 14:36 6740这两天在做FLEX上传的时候,遇到一个问题 ... -
在tomcat中部署安装Flex Data Services (LiveCycle DS)
2008-11-20 09:59 4064目前来说 Flex Data Services (最近又升级并 ...
相关推荐
hibernate+flex+spring 整合,hibernate+flex+spring 集成
Flex+Spring+Hibernate 整合的方式有多种,本文是利用flex builder插件,将flex与javaEE服务器端整合到一个工程里面,以便程序员可以在一个IDE里完成开发。
自己写的Flex+spring+hibernate示例,精简易懂
使用flex 4.5 + Spring 3.0 + Hibernate 3.3 + Cairngorm 2.2.1 + BlazeDS 3.3.0 + Spring BlazeDS Integration 1.0.3整合出的一个登录的小demo·
Flex PureMVC Flex BlazeDS Spring Hibernate 整合 里面一些图标是包双击可查看源代码
MyEclipse7.5+flex4+spring3.0.5+struts2.2.1+hibernate3.6.0+blazeds4.0.0.14931完美整合方案 内附所需jar包和源代码
Flex+spring+hibernate视屏,Flex+spring+hibernate视屏
使用Flex Builder+MyEclipse搭建的Flex+Spring+Hibernate环境,写了一个简单的登录,可以实现前台到后台,后台回到前台的基本流程,懒着搭建环境的人可以直接部署运行。
flex+spring+hibernate+mysql
配置flex+bleazeds+spring+hibernate
Flex+spring+hibernate框架配置详解啊,包含源文件的
用flex+spring+hibernate整合的一个小小的登陆实例,希望对学习flex+java通信开发的有点帮助吧
配置flex+bleazeds+spring+hibernate框架
flex+bleazeds+spring+hibernate配置的教程,有详尽过程,是flex与spring结合的不错的教程
flex+bleazeds+spring+hibernate的整合,中文版简单易懂
flex 4.5+BlazseDS+Spring3+Hibernate3.3开发环境搭建
flex+cairgorm+hibernate+spring项目配置源码
flex+java+spring+hibernate+blazeds整合
flex整合hibernate,spring,详细配置
花了四天终于搭好flex+spring+hibernate。。。 我是初学者。。希望多点交流