読者です 読者をやめる 読者になる 読者になる

作業メモ

今日の作業メモ。
・Employeeの一覧取得完了
・Employeeの詳細取得完了
・Employeeの更新着手
 →データ更新は確認済
 →バリデータ未実装


・備考
DBFluteスキーマからファイルを生成するとき、Behaviorクラスは
AbstractBehaviorWritableを継承することが多いのだけど、
たまに、AbstractBehaviorReadableを継承することがある。

この場合、Lucyの場合、自動生成されるdbfluteBean.xml
setCommonColumnAutoSetupperの記述は不要になるので注意。
※そのままの場合、起動時にNoSuchMethodErrorが出て起動しない。



あと、lucy-extを使ってトランザクションをかけようと
メソッドに@RequiredTxをつけたら起動時にエラーになる。。。
これはまだ設定が足りないっぽいので要調査。

以下、lucy-config.xmlとエラーログ。

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE lucy-config PUBLIC "-//LUCY//DTD LUCY//EN" "http://www.lucy.org/dtd/lucy-config.dtd">
<lucy-config>
	 
	<include>"dbfluteBeans.xml"</include>
	
 	<component name="dataSource" class="com.atomikos.jdbc.AtomikosDataSourceBean" instance="singleton">
		<inject method="setXaDataSourceClassName">"org.h2.jdbcx.JdbcDataSource"</inject>
		<inject method="setUniqueResourceName">"jdbc/h2/xaDatasource"</inject>
		<inject method="setPoolSize">20</inject>
		<inject method="setBorrowConnectionTimeout">60</inject>
		<inject method="setXaProperties"><![CDATA[
			p = dataSource.XaProperties;
			p["URL"]="jdbc:h2:tcp://127.0.0.1:9095/t2db";
			p["User"]="sa";
			p["Password"]="";
			p;
		]]></inject>
		<destroy method="close"/>
	</component>
    
	<component name="txMan" class="com.atomikos.icatch.jta.UserTransactionManager" instance="singleton">
		<inject method="setForceShutdown">true</inject>
		<init method="init"/>
		<destroy method="close"/>
	</component>

	<component name="usrTx" class="com.atomikos.icatch.jta.UserTransactionImp" instance="singleton">
		<inject method="setTransactionTimeout">300</inject>
	</component>

	<component name="txPro" class="org.t2framework.lucy.tx.JTATransactionProcesser" instance="singleton">
		<inject method="setTxManager">txMan</inject>
		<inject method="setUserTx">usrTx</inject>
	</component>
  	
	<!-- Service -->
	<component name="employee" class="org.t2framework.samples.todo.service.impl.EmployeeServiceImpl" instance="singleton" />
	
	<!-- Page -->
	<component class="org.t2framework.samples.todo.page.EmployeePage" instance="request">
		<inject method="inject">employee</inject>
	</component>

</lucy-config>
2009/01/19 10:30:32 org.apache.catalina.core.StandardContext filterStart
致命的: フィルタ t2 の起動中の例外です
javax.servlet.ServletException: javax.servlet.ServletException: java.lang.NullPointerException
	at org.t2framework.t2.filter.T2Filter.init(T2Filter.java:97)
	at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275)
	at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397)
	at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108)
	at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3709)
	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4363)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
	at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:627)
	at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553)
	at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488)
	at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149)
	at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
	at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
	at org.apache.catalina.core.StandardService.start(StandardService.java:516)
	at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: javax.servlet.ServletException: java.lang.NullPointerException
	at org.t2framework.t2.filter.Initializer.getContainerAdapterClass(Initializer.java:65)
	at org.t2framework.t2.filter.Initializer.execute(Initializer.java:41)
	at org.t2framework.t2.filter.T2Filter.init(T2Filter.java:86)
	... 27 more
Caused by: java.lang.NullPointerException
	at org.t2framework.commons.util.Reflections$ConstructorUtil.newInstance(Reflections.java:264)
	at org.t2framework.lucy.ConfigBinderFactory$DefaultConfigBinderImpl.createBehavior(ConfigBinderFactory.java:261)
	at org.t2framework.lucy.ConfigBinderFactory$DefaultConfigBinderImpl.createBehavior(ConfigBinderFactory.java:235)
	at org.t2framework.lucy.ConfigBinderFactory$DefaultConfigBinderImpl$3.bind(ConfigBinderFactory.java:198)
	at org.t2framework.lucy.ConfigBinderFactory$DefaultConfigBinderImpl$3.bind(ConfigBinderFactory.java:192)
	at org.t2framework.lucy.ConfigBinderFactory$DefaultConfigBinderImpl.bind(ConfigBinderFactory.java:229)
	at org.t2framework.lucy.ConfigBinderFactory$DefaultConfigBinderImpl.bind(ConfigBinderFactory.java:192)
	at org.t2framework.t2.configuration.T2LucyConfiguration$1.bind(T2LucyConfiguration.java:67)
	at org.t2framework.lucy.impl.LucyImpl.bind(LucyImpl.java:284)
	at org.t2framework.lucy.impl.LucyImpl.register(LucyImpl.java:276)
	at org.t2framework.lucy.config.stax.LucyConfigTagHandler.end(LucyConfigTagHandler.java:22)
	at org.t2framework.lucy.config.stax.StAXParser.parse(StAXParser.java:58)
	at org.t2framework.lucy.impl.XMLLucyComponentRegistrar.register(XMLLucyComponentRegistrar.java:32)
	at org.t2framework.lucy.impl.XMLLucyComponentRegistrar.register(XMLLucyComponentRegistrar.java:16)
	at org.t2framework.lucy.impl.LucyImpl.load(LucyImpl.java:369)
	at org.t2framework.lucy.LucyBootstrap.init(LucyBootstrap.java:81)
	at org.t2framework.t2.adapter.LucyContainerAdapter.init(LucyContainerAdapter.java:50)
	at org.t2framework.t2.filter.Initializer.getContainerAdapterClass(Initializer.java:63)
	... 29 more

[追記]
web.xml

<?xml version="1.0"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
	<display-name>T2 Application Example</display-name>
	<context-param>
		<param-name>t2.encoding</param-name>
		<param-value>UTF-8</param-value>
	</context-param>
	<filter>
		<filter-name>uploadFilter</filter-name>
		<filter-class>org.t2framework.t2.filter.MultiPartRequestFilter
		</filter-class>
		<init-param>
			<param-name>uploadMaxSize</param-name>
			<param-value>100m</param-value>
		</init-param>
		<init-param>
			<param-name>uploadMaxFileSize</param-name>
			<param-value>100m</param-value>
		</init-param>
		<init-param>
			<param-name>uploadThresholdSize</param-name>
			<param-value>100k</param-value>
		</init-param>
		<init-param>
			<param-name>uploadRepositoryPath</param-name>
			<param-value>C:/temp/</param-value>
		</init-param>
	</filter>
	<filter>
		<filter-name>t2</filter-name>
		<filter-class>org.t2framework.t2.filter.T2Filter</filter-class>
		<init-param>
			<param-name>t2.rootpackage</param-name>
			<param-value>org.t2framework.samples.todo.page</param-value>
		</init-param>
		<init-param>
			<param-name>t2.config</param-name>
			<param-value>lucy-config.xml</param-value>
		</init-param>
		<init-param>
			<param-name>t2.container.adapter</param-name>
			<param-value>org.t2framework.t2.adapter.LucyContainerAdapter</param-value>
		</init-param>
		<init-param>
			<param-name>t2.eagerload</param-name>
			<param-value>false</param-value>
		</init-param>
		<init-param>
			<param-name>t2.exclude-resources</param-name>
			<param-value>css, js</param-value>
		</init-param>
	</filter>
	<filter-mapping>
		<filter-name>uploadFilter</filter-name>
		<url-pattern>/*</url-pattern>
	</filter-mapping>
	<filter-mapping>
		<filter-name>t2</filter-name>
		<url-pattern>/*</url-pattern>
	</filter-mapping>
	<welcome-file-list>
		<welcome-file>index.jsp</welcome-file>
	</welcome-file-list>
    <jsp-config>
		<jsp-property-group>
			<url-pattern>*.jsp</url-pattern>
			<el-ignored>false</el-ignored>
			<page-encoding>UTF-8</page-encoding>
			<scripting-invalid>false</scripting-invalid>
			<include-prelude>/WEB-INF/pages/common.jsp</include-prelude>
			<!-- trim white spaces (JSP 2.1 or higher)
			<trim-directive-whitespaces>true</trim-directive-whitespaces>
			-->
		</jsp-property-group>
	</jsp-config>
</web-app>