2022年7月15日金曜日

移動先

新しい記事はこちらに投稿します。




あと、資料まとめ

2020年9月26日土曜日

TypeScriptとjestの組み合わせで、テスト実行するとエラーが発生(test is not defined、describe is not defined)

【エラー】test is not defined、describe is not defined
【概要】
TypeScriptとjestの組み合わせで、テスト実行するとエラーが発生(test is not defined、describe is not defined)

【詳細】
node.jsのバージョンが低いのが問題だった模様。
「v12.18.4」はOKだった。
 v10.16.2以上ならOKぽい

(参考)
https://stackoverflow.com/questions/59927799/referenceerror-describe-is-not-defined-in-jest-typescript

【残課題】
なし

2019年7月28日日曜日

There was no object available for injection at SystemInjecteeImpl(requiredType=

【エラー】
There was no object available for injection at SystemInjecteeImpl(requiredType=YYYYYY,parent=XXXXX,qualifiers={},position=-1,optional=false,self=false,unqualified=null,519305832)
【概要】
jersey(Dropwizard)でInjectに失敗。
コンテナに登録していないことが問題。

以下で解決
environment.jersey().register(new AbstractBinder() {    @Override    protected void configure() {        bind(YYYYYY.class).to(YYYYYY.class);
    }});


【詳細】
特になし

【残課題】
特になし

2018年11月20日火曜日

Unresolved function or method Array()

【エラー】
Unresolved function or method Array()
【概要】
IntelliJ でtypescriptを記述していたが、tslintのチェックで
「Unresolved function or method Array()」
が表示されていくら設定変えても消えない。
【対応】
IntelliJを再起動で解決。

【残課題】
なし

2018年8月13日月曜日

ElasticbeansTalkのヘルスチェックとセキュリティグループ

【エラー】
ElasticBeansTalkのヘルスチェックで重大が発生する。
※デプロイ自体はうまくいく

【概要】
RDS接続のためにセキュリティグループをいじっていたら、ElasticBeansTalkのヘルスチェックで重大が発生するようになった。
エラー内容はデータなし。
【詳細】
アウトバウンドがデフォルト、なんでもOKになっていたのを消したために、ヘルスチェックの応答?がうまくできなくなっていた。
アウトバウンドにすべてのトラフィックを追加したら解消。

【残課題】
なし。

2018年5月29日火曜日

【エラー】
2018-05-29 23:25:39,958 [main] INFO  org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean -  Closing JPA EntityManagerFactory for persistence unit 'default'
2018-05-29 23:25:39,958 [main] INFO  org.apache.catalina.core.StandardService -  Stopping service Tomcat
2018-05-29 23:25:39,974 [main] INFO  org.springframework.boot.autoconfigure.logging.AutoConfigurationReportLoggingInitializer - 

Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2018-05-29 23:25:39,990 [main] ERROR org.springframework.boot.SpringApplication -  Application startup failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'responseEntityBuilder' defined in file [C:\Users\masaf\git\ApiLogic\target\classes\com\platfolio\api\builder\ResponseEntityBuilder.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type 'java.lang.Object' available: more than one 'primary' bean found among candidates: [org.springframework.context.annotation.internalConfigurationAnnotationProcessor, org.springframework.context.annotation.internalAutowiredAnnotationProcessor, org.springframework.context.annotation.internalRequiredAnnotationProcessor, org.springframework.context.annotation.internalCommonAnnotationProcessor, org.springframework.context.annotation.internalPersistenceAnnotationProcessor, org.springframework.context.event.internalEventListenerProcessor, org.springframework.context.event.internalEventListenerFactory, application, org.springframework.boot.autoconfigure.internalCachingMetadataReaderFactory, loginController, parentController, preschoolController, pushController, loginLogic, parentLogic, pushLogic, schoolLogic, childService, familyService, notificationHistoryService, parentService, pushService, schoolInfoService, loggingFilter, org.springframework.boot.autoconfigure.AutoConfigurationPackages, org.springframework.data.jpa.repository.config.JpaRepositoryConfigExtension#0, org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport_Predictor, emBeanDefinitionRegistrarPostProcessor, jpaMappingContext, jpaContext, loginUserRepository, schoolRepository, personRepository, familyRepository, childSchoolScheduleRepository, schoolUnitRepository, schoolEventScheduleRepository, notificationHistoryRepository, schoolGroupRepository, childRepository, org.springframework.boot.autoconfigure.domain.EntityScanPackages, org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration, org.springframework.boot.autoconfigure.condition.BeanTypeRegistry, propertySourcesPlaceholderConfigurer, org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration$Jackson2ObjectMapperBuilderCustomizerConfiguration, standardJacksonObjectMapperBuilderCustomizer, spring.jackson-org.springframework.boot.autoconfigure.jackson.JacksonProperties, org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor, org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.store, org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration$JacksonObjectMapperBuilderConfiguration, jacksonObjectMapperBuilder, org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration$JacksonObjectMapperConfiguration, jacksonObjectMapper, org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration, jsonComponentModule, org.springframework.boot.autoconfigure.websocket.WebSocketAutoConfiguration$TomcatWebSocketConfiguration, websocketContainerCustomizer, org.springframework.boot.autoconfigure.websocket.WebSocketAutoConfiguration, org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration$EmbeddedTomcat, tomcatEmbeddedServletContainerFactory, org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration, embeddedServletContainerCustomizerBeanPostProcessor, errorPageRegistrarBeanPostProcessor, org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfiguration$DispatcherServletConfiguration, dispatcherServlet, spring.mvc-org.springframework.boot.autoconfigure.web.WebMvcProperties, org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfiguration$DispatcherServletRegistrationConfiguration, dispatcherServletRegistration, org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfiguration, org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration, error, beanNameViewResolver, org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration, errorAttributes, basicErrorController, errorPageCustomizer, conventionErrorViewResolver, preserveErrorControllerTargetClassPostProcessor, spring.resources-org.springframework.boot.autoconfigure.web.ResourceProperties, org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$EnableWebMvcConfiguration, requestMappingHandlerAdapter, requestMappingHandlerMapping, mvcPathMatcher, mvcUrlPathHelper, mvcContentNegotiationManager, viewControllerHandlerMapping, beanNameHandlerMapping, resourceHandlerMapping, mvcResourceUrlProvider, defaultServletHandlerMapping, mvcConversionService, mvcValidator, mvcUriComponentsContributor, httpRequestHandlerAdapter, simpleControllerHandlerAdapter, handlerExceptionResolver, mvcViewResolver, org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter$FaviconConfiguration, faviconHandlerMapping, faviconRequestHandler, org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter, defaultViewResolver, viewResolver, welcomePageHandlerMapping, requestContextFilter, org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration, hiddenHttpMethodFilter, httpPutFormContentFilter, org.springframework.boot.autoconfigure.jmx.JmxAutoConfiguration, mbeanExporter, objectNamingStrategy, mbeanServer, org.springframework.boot.autoconfigure.admin.SpringApplicationAdminJmxAutoConfiguration, springApplicationAdminRegistrar, org.springframework.boot.autoconfigure.aop.AopAutoConfiguration$JdkDynamicAutoProxyConfiguration, org.springframework.aop.config.internalAutoProxyCreator, org.springframework.boot.autoconfigure.aop.AopAutoConfiguration, org.springframework.boot.autoconfigure.transaction.jta.JtaAutoConfiguration, spring.jta-org.springframework.boot.autoconfigure.transaction.jta.JtaProperties, org.springframework.boot.autoconfigure.jdbc.DataSourceConfiguration$Tomcat, dataSource, org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration$PooledDataSourceConfiguration, org.springframework.boot.autoconfigure.jdbc.metadata.DataSourcePoolMetadataProvidersConfiguration$TomcatDataSourcePoolMetadataProviderConfiguration, tomcatPoolDataSourceMetadataProvider, org.springframework.boot.autoconfigure.jdbc.metadata.DataSourcePoolMetadataProvidersConfiguration, org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration, dataSourceInitializer, spring.datasource-org.springframework.boot.autoconfigure.jdbc.DataSourceProperties, dataSourceInitializerPostProcessor, org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration$JpaWebConfiguration$JpaWebMvcConfiguration, openEntityManagerInViewInterceptor, org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration$JpaWebConfiguration, org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration, transactionManager, jpaVendorAdapter, entityManagerFactoryBuilder, entityManagerFactory, spring.jpa-org.springframework.boot.autoconfigure.orm.jpa.JpaProperties, dataSourceInitializedPublisher, org.springframework.boot.autoconfigure.context.ConfigurationPropertiesAutoConfiguration, org.springframework.boot.autoconfigure.dao.PersistenceExceptionTranslationAutoConfiguration, persistenceExceptionTranslationPostProcessor, org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration$StringHttpMessageConverterConfiguration, stringHttpMessageConverter, spring.http.encoding-org.springframework.boot.autoconfigure.web.HttpEncodingProperties, org.springframework.boot.autoconfigure.web.JacksonHttpMessageConvertersConfiguration$MappingJackson2HttpMessageConverterConfiguration, mappingJackson2HttpMessageConverter, org.springframework.boot.autoconfigure.web.JacksonHttpMessageConvertersConfiguration, org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration, messageConverters, org.springframework.data.web.config.SpringDataWebConfiguration, pageableResolver, sortResolver, org.springframework.data.web.config.SpringDataJacksonConfiguration, jacksonGeoModule, org.springframework.boot.autoconfigure.data.web.SpringDataWebAutoConfiguration, org.springframework.boot.autoconfigure.info.ProjectInfoAutoConfiguration, spring.info-org.springframework.boot.autoconfigure.info.ProjectInfoProperties, org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration, org.springframework.transaction.config.internalTransactionAdvisor, transactionAttributeSource, transactionInterceptor, org.springframework.transaction.config.internalTransactionalEventListenerFactory, org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration$TransactionManagementConfiguration, org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration$DataSourceTransactionManagerConfiguration, org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration, org.springframework.boot.autoconfigure.jdbc.JdbcTemplateAutoConfiguration, jdbcTemplate, namedParameterJdbcTemplate, org.springframework.boot.autoconfigure.transaction.TransactionAutoConfiguration, transactionTemplate, org.springframework.boot.autoconfigure.web.HttpEncodingAutoConfiguration, characterEncodingFilter, localeCharsetMappingsCustomizer, org.springframework.boot.autoconfigure.web.MultipartAutoConfiguration, multipartConfigElement, multipartResolver, spring.http.multipart-org.springframework.boot.autoconfigure.web.MultipartProperties, org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration, serverProperties, duplicateServerPropertiesDetector, org.springframework.boot.autoconfigure.web.WebClientAutoConfiguration$RestTemplateConfiguration, restTemplateBuilder, org.springframework.boot.autoconfigure.web.WebClientAutoConfiguration, org.springframework.orm.jpa.SharedEntityManagerCreator#0, autoConfigurationReport, springApplicationArguments, springBootBanner, springBootLoggingSystem, environment, systemProperties, systemEnvironment, org.springframework.context.annotation.ConfigurationClassPostProcessor.importRegistry, messageSource, applicationEventMulticaster, servletContext, contextParameters, contextAttributes]
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:749)
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:189)
【概要】
DIの失敗

【詳細】
DIに失敗したエラー

Spring bootでクラスに@Componentアノテーションをつけて、DI可能にしたにもかかわらず
引数無しコンストラクタをなくしてしまった場合に発生する。

引数ありコンストラクタと、合わせて引数無しコンストラクタを記述することで解決する。

メッセージみてもさっぱり。

※引数ありコンストラクタがなければ、自動で引数無しコンストラクタが生成されるのでその場合は問題なし。(これは単にjavaの仕様)

2018年4月9日月曜日

【AWS】APIのレスポンスがなぜかgzipになる

Accept-Encoding が設定されているわけでもないリクエストに対して、レスポンスがgzipになってしまう事象が発生。
APIGatewayのsdkを使ってAPIを呼び出していたが、JavaClientではjson形式で受信。
Objective-cのsdkではなぜかヘッダーがgzipとなって受信エラーになっていた。

調査の結果
elasticbeansTalkでapache-tomcatで構成されたspringboot環境でAPIサーバーを構築していたが、elastickBeansTalkのWEBサーバー設定で、gzip圧縮有効にしていたこことが判明。

たぶんそれで解決、のはず・・・


ちなみに、なぜ、sdkによって差異が出るかは不明。微妙にレスポンスボディのサイズが違う?


2018年1月29日月曜日

Let's Encryptでの更新でエラー

80ポートをListenしていなかったのが原因。

出たエラー


Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator webroot, Installer None
Cert is due for renewal, auto-renewing...
Renewing an existing certificate
Performing the following challenges:
http-01 challenge for xxxxxxxxx.jp
Using the webroot path /var/www for all unmatched domains.
Waiting for verification...
Cleaning up challenges
Failed authorization procedure. xxxxxxxxx.jp (http-01): urn:acme:error:connection ::
The server could not connect to the client to verify the domain ::
Fetching http://xxxxxxxxx.jp/.well-known/acme-challenge/xxxxxxxxxxxxxxxxxxxx-wk-xxxxxxxxxxxx: Connection refused

IMPORTANT NOTES:
 - The following errors were reported by the server:

   Domain: xxxxxxxxx.jp
   Type:   connection
   Detail: Fetching
   http://xxxxxxxxx.jp/.well-known/acme-challenge/xxxxxxxxxxxxxxxxx-wk-xxxxxxxxxxxxxxx:
   Connection refused

   To fix these errors, please make sure that your domain name was
   entered correctly and the DNS A/AAAA record(s) for that domain
   contain(s) the right IP address. Additionally, please check that
   your computer has a publicly routable IP address and that no
   firewalls are preventing the server from communicating with the
   client. If you're using the webroot plugin, you should also verify
   that you are serving files from the webroot path you provided.

2016年2月22日月曜日

java.lang.IllegalArgumentException: Setter not found for property class


【エラー】
java.lang.IllegalArgumentException: Setter not found for property class
【概要】
ローカルでは出なかったが、サーバーでデプロイすると発生


【原因】
jsfもしくはprimefacesのタグにclassを指定したことが原因の模様
なぜローカル実行で発生しないのかは不明。
指定する場合はstyleClassを指定しろとのこと。
 
サンプルコード
a
b
c
【残課題】
htmlのタグを使うときはとりあえず、
passThroughをつけておいたほうがよさそう。
というか今回はclassは削除して、それ以外は全部つけてからやったので、実際にどのタグで起きたのかは不明・・・
もしかしたらprimefacesだけ?

【参考】
http://stackoverflow.com/questions/16935343/java-lang-illegalargumentexception-setter-not-found-for-property-class
【エラー】
java.lang.IllegalArgumentException: Setter not found for property class

【概要】

【詳細】
 
サンプルコード
a
b
c
【残課題】

2016年1月21日木曜日

PrimeFacesのrenderedをOFFにしたタグを、AJAX(update)で更新しても描画されない!!

【概要】
PrimeFacesのrenderedをOFFにしたタグを、AJAX(update)で更新しても描画されない!!

【詳細】
概要の通り。renderedに要素が空かどうかで表示非表示を切り替えようとしたが、updateで更新しても表示されない。
調べてみると、どうやらrenderedがfalesの場合、そもそもブラウザ上に表示されない。つまり、「タグも生成されない」
なので、いくらajaxで更新しても何もおこらないと・・・

update要素で存在しないIDを指定するとエラーになるがそれはあくまでfaceletのチェックのようなのでスルーされる模様。

ダメなコード
<p:fileUpload fileUploadListener="#{controller.handleFileUpload}" mode="advanced" dragDropSupport="true"
                  update="messages,buttonEffect,labelFileName" sizeLimit="100000" allowTypes="/(\.)(csv)$/"/>
    <p:panelGrid columns="2">
        <p:outputLabel value="#{disp.Name}"/>
        <p:outputLabel id="labelFileName" value="#{controller.file.fileName}" rendered="#{!empty controller.file}"/>
    </p:panelGrid>

正解サンプル
<p:panel visible="#{!empty controller.file}">
<p:outputLabel id="labelFileName" value="#{controller.file.fileName}" />
</p:panel>

PrimeFacesのpanelタグにはvisible属性があるようなので↑のようなコードであれば表示非表示を簡単に切り替えられる。
あとは、styleにdisplayかvisibleをしていするか。(true:falseで指定できないのでめんどくさいかな)

【残課題】
なし

2015年12月22日火曜日

JPAで金額を扱うぞ!ジョジョーーッ!!



Javaで金額を扱うならBigDecimalですよね。
というわけで、JPAの機能でMYSQLのDECIMAL型で定義したフィールドを持つテーブルのエンティティを自動生成したら、long型になりやがった。
ふざけんなー。

というわけで、エンティティを手動で修正したのですが、BigDecimalの場合@Sizeアノテーションが使えないことがわかりました。

調べた結果以下のようなアノテーションで範囲を定義することに。


【詳細】
@DecimalMin("0")
    @DecimalMax("99999999999")
    @Column(name = "SALES_AMOUNT", nullable = false)
    private BigDecimal salesAmount;
【残課題】
なし!

2015年12月18日金曜日

【エラー】
WELD-000054: Producers cannot produce non-serializable instances for injection into non-transient fields of passivating beans Producer: Producer Method [Logger] with qualifiers [@Any @Default] declared as [[BackedAnnotatedMethod] @Produces public com.xxx.common.cdi.LoggerProducer.createLogger()] Injection Point: [BackedAnnotatedField] @Inject com.xxx.jsf.Menu.log
【概要】
【詳細】
 
サンプルコード
a
b
c
【残課題】

2015年12月11日金曜日

javax.validation.UnexpectedTypeException: HV000030: No validator could be found for type: java.math.BigDecimal.

【エラー】
javax.validation.UnexpectedTypeException: HV000030: No validator could be found for type: java.math.BigDecimal.
【概要】
BigDecimalフィールドのアノテーションに変なのがある。

【詳細】
sizeを指定したのがダメだったっぽい。
というわけで↓みたいにしたらエラーが消えた。

 
サンプルコード
    @DecimalMin("0") @DecimalMax("9999999") 

【残課題】
なし!

2015年12月2日水曜日

samepropertyvaluesas で 「java.lang.NoSuchFieldError: NONE」

【エラー】
java.lang.NoSuchFieldError: NONE

【概要】
hamcrestのsamepropertyvaluesas を使用すると「java.lang.NoSuchFieldError: NONE」というエラーが出力されてテストが失敗する。


【原因】
junitライブラリに含まれているhamcrestクラスと、ダウンロードしたhamcrestライブラリに含まれるクラスがは競合いる。その為(おそらく)samepropertyvaluesasが呼び出しているクラスMatcher関連?が本来呼び出すべきバージョンと違うものになっていた為エラーが発生していた。
pom.xmlのjunitに関する定義ははnetbeansで自動生成されたものを使っていたが、それだとjunitライブラリにhamcrestのクラスが一部含まれてしまう為、除外する必要がある。
もしくは、依存関係の優先度をhamcrestライブラリ⇒junitの順にすればよいはず。


【対応】
pomを以下のように修正する。

案1 junit関連より先にhamcrestの依存性を定義する。

<dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>java-hamcrest</artifactId>
            <version>2.0.0.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <!-- org.hamcrestより上にしないこと!! -->
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>6.8.1</version>
            <scope>test</scope>
        </dependency>


案2 hamcrestが含まれないjunitライブラリを使用する。※junitのartifactIDをjunit-depにする
<dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>java-hamcrest</artifactId>
            <version>2.0.0.0</version>
            <scope>test</scope>
        </dependency>
<!--        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>6.8.1</version>
            <scope>test</scope>
        </dependency>
-->
        <dependency>
            <groupId>junit</groupId>
        <!-- artifactIDがjunit-dep -->
            <artifactId>junit-dep</artifactId>
            <version>4.11</version>
            <scope>test</scope>
        </dependency>

どっちもうまくいったけど、まあ案1の方が、junit単独で使いたい時に簡単に戻せるので楽かな。



【残課題】
案1の場合、ふっと気を抜いてタグの順番を入れ替えたりしないようにしないといけない。
(忘れないようにコメントを追加しておく)

2015年11月4日水曜日

PrimeFaceのバグ? 「Cannot find component with expression ":growl" referenced from "SampleListForm:datalist:deleteButton".」

【エラー】
「Cannot find component with expression ":growl" referenced from "SampleListForm:datalist:deleteButton".」
【概要】
PrimeFacesでエンティティからJSFファイルを自動生成した時に必ず出る。
テンプレートのバグ?

growlタグを追加すれば解決

【詳細】
以下のタグを<body>タグの直下に作成する。(id="growl")

<p:growl id="growl" autoUpdate="false"/>

update要素で:growlと指定しているがこれはどこのformにも属さないgrowlを示している。
同じタグ内(formとか)の場合は「:」をつけない。
別の親タグの中に置くときは「:anotherTagId:growl」とか
<p:commandButton id="deleteButton" icon="ui-icon-trash"  value="#{bundle.Delete}" 
actionListener="#{SampleController.destroy}" 
update=":growl,datalist" 
disabled="#{empty SampleController.selected}"/> 

IDは別にgrowlでなくてもいいけど。自動生成結果とずれるので面倒

【残課題】
そもそもPrimeFacesのテンプレートを直したほうがよさそう。

java.net.BindException: Address already in use: bind

【エラー】
glassfish起動時に発生。(アプリケーションは起動した)
java.net.BindException: Address already in use: bind
【概要】
起動時に使おうとしたポートが既に別アプリにて使用中。
他のアプリを停止する。
他に動いてなくてもたまに出る?
エラーは出てもアプリケーションは起動した。
【詳細】
サンプルコード
a
b
c
【残課題】

Name XXXXXController resolves to beans CDIでNameが解決できない。

【エラー】
Exception while loading the app : CDI deployment failure:WELD-001414: Bean name is ambiguous. Name XXXXXController resolves to beans: [Managed Bean [class com.jsf.XXXXXController] with qualifiers [@Default @Named @Any], Managed Bean [class com.jsf.XXXXXController] with qualifiers [@Default @Named @Any]]
org.jboss.weld.exceptions.DeploymentException: WELD-001414: Bean name is ambiguous. Name XXXXXController resolves to beans: [Managed Bean [class com.jsf.XXXXXController] with qualifiers [@Default @Named @Any], Managed Bean [class com.jsf.XXXXXController] with qualifiers [@Default @Named @Any]]

【概要】
CDIで定義した別名が重複している!!
クラスがないはずなのに消えない!!

【対策】
glassFish(orその他WEBアプリケーションサーバー)を停止

クリーンビルド

glassfish起動

【詳細】
なし

【残課題】
なし

2015年10月30日金曜日

MySQLのデータベースの文字コードを変更する。

【エラー】
MySQLで日本語が使えない。

【概要】
データベースの文字コードを変更する。
※データベース作成時の文字コードが未指定だった為に、初期設定のlatin1になっていた。
【詳細】
○mysqlコンソールで以下のDDLを発行

ALTER DATABASE `hogehogeDB` default character set utf8;

○MySQLの設定を変更する。
my.ini
または
my.cnfを修正

[mysqld]
port   = 3306
socket = C:/Program Files/mysql/mysql.sock
character-set-server=utf8

[client]
port   = 3306
socket = C:/Program Files/mysql/mysql.sock
default-character-set=utf8

[mysql]
default-character-set=utf8



【残課題】
環境作るときにやっとかな。

【補足】
確認コマンド
status

show variables like 'character%';

PrimeFacesコンポーネントが動かない!

【エラー】
PrimeFacesが動かない!
原因はバージョンの異なるjqueryの混在。
【概要】
(参考サイト)
http://www.primefaces.org/showcase/ui/message/growl.xhtml

で書かれている通りに、ソースを書いても想定通りに動かない。
具体的にはSelectOneMenuとcalendar。
画面にコンポーネントは表示されるがコンボボックスやカレンダーがポップアップ表示で出てこない。


 【詳細】
なし
<p:calendar id="saledate" value="#{aaa.sampleDate}"></p:calendar>
<p:selectonemenu id="seriesName" value="#{aaa.selected.titleId}">
<f:selectitems itemlabel="#{title.titleName}" itemvalue="#{title.titleId}" value="#{aaa.titleMsts}" var="title">
</f:selectitems>
</p:selectonemenu>


【原因】
自分が明示的に読み込んでいるjqueryとprimeFacesが独自に読み込んでいるjqueryの
バージョンが異なっており、primeFacesのイベントがことごとく無効になっていた。

primeFacesを使うときは注意。

【残課題】
なし