SpringSide是以Spring Framework为核心,提供一个Pragmatic的企业应用KickStart 与Full-Stack 的开源构件库。它以RoR式的简约风格,将Java社区众多优秀轻量级开源项目整军为一个黏合的框架,以构件式的开发架构,配合Ant与Eclipse plugin的生成工具,作为大家开发Java企业应用的方便起点。
可以访问springside.org.cn获取更多信息.
下载springside-all-one 后,里面有很详细的文档, 本文主要记录作者使用springside构建ssh的步骤,作为个人的总结及备忘.
注意:
ss2_home表示springside的根目录
1.安装springSide2插件
在$ss2_home/target目录下,存在eclipse目录
将其拷贝到Eclipse的plugin中
或者采用link的方式建立plugin
2.启动Eclipse,点击 windows->preference,选择左边springside,设置SpringSide2 Home:
3.新建项目,选择springside向导,按照提示选择相关的components,参照视频
4.新建成功后,默认使用的web服务器是springSide自带的tomcat,可以修改相关配置文件(sshDemo/bin/build_user.properties,
sshDemo/bin/build_tomcat.xml),使用指定的tomcat
(1)
修改build_user.properties文件中的tomcat.home=指定的tomcat目录
(2)
修改sshDemo/bin/build_tomcat.xml
<propertyfile file="bin/build_user.properties">
<entry
key="tomcat.port" default="80"/>
<entry
key="tomcat.home" default="指定的tomcat目录"/>
</propertyfile>
5. 执行ant quickstart,访问http://localhost/sshDemo/,可以出现"Hello World!!!" 但出现下列问题:
[java] 2007-06-17 16:05:41,718 WARN [org.hibernate.util.JDBCExceptionReport
er] - <SQL Error: 0, SQLState: null>
[java] 2007-06-17 16:05:41,734 ERROR [org.hibernate.util.JDBCExceptionRepor
ter] - <Cannot create PoolableConnectionFactory (File input/output error: java.i
o.IOException: Stream closed)>
[java] 2007-06-17 16:05:41,750 WARN [org.hibernate.cfg.SettingsFactory] - <
Could not obtain connection metadata>
[java] org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableCo
nnectionFactory (File input/output error: java.io.IOException: Stream closed)
[java] at org.apache.commons.dbcp.BasicDataSource.createDataSource(Basi
cDataSource.java:855)
[java] at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDa
taSource.java:540)
[java] at org.springframework.orm.hibernate3.LocalDataSourceConnectionP
rovider.getConnection(LocalDataSourceConnectionProvider.java:81)
[java] at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFacto
ry.java:76)
[java] at org.hibernate.cfg.Configuration.buildSettings(Configuration.j
ava:1933)
[java] at org.hibernate.cfg.Configuration.buildSessionFactory(Configura
tion.java:1216)
[java] at org.springframework.orm.hibernate3.LocalSessionFactoryBean.ne
wSessionFactory(LocalSessionFactoryBean.java:807)
[java] at org.springframework.orm.hibernate3.LocalSessionFactoryBean.bu
ildSessionFactory(LocalSessionFactoryBean.java:740)
[java] at org.springframework.orm.hibernate3.AbstractSessionFactoryBean
.afterPropertiesSet(AbstractSessionFactoryBean.java:131)
[java] at org.springframework.beans.factory.support.AbstractAutowireCap
ableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1062)
[java] at org.springframework.beans.factory.support.AbstractAutowireCap
ableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1029)
[java] at org.springframework.beans.factory.support.AbstractAutowireCap
ableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:420)
[java] at org.springframework.beans.factory.support.AbstractBeanFactory
$1.getObject(AbstractBeanFactory.java:245)
[java] at org.springframework.beans.factory.support.DefaultSingletonBea
nRegistry.getSingleton(DefaultSingletonBeanRegistry.java:141)
[java] at org.springframework.beans.factory.support.AbstractBeanFactory
.getBean(AbstractBeanFactory.java:242)
[java] at org.springframework.beans.factory.support.AbstractBeanFactory
.getBean(AbstractBeanFactory.java:156)
[java] at org.springframework.beans.factory.support.BeanDefinitionValue
Resolver.resolveReference(BeanDefinitionValueResolver.java:246)
解决办法:
因为默认的jdbc.properties,使用的是
jdbc.driverClassName=org.hsqldb.jdbcDriver
jdbc.url=jdbc:hsqldb:res:dbname
将其注释掉,修改为自己的
jdbc.driverClassName=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost/sshDemo?useUnicode=true&characterEncoding=utf8
重新启动tomcat,错误提示消失,页面正确显示"hello world!!"
至此,可以使用它继续做后面的扩展了.
关于如何扩展,可以参考springside的doc.