一、JBOSS 5.1使用 jdk 1.7 會報錯,換成6就行了java
二、使用JBOSS 5.1 在 Eclipse 下建立 EJB 項目,EJB Module version只有2.0,2.1和3.0可選,沒有3.1mysql
三、Could not obtain connection to any of these urls: localhost:1099web
緣由:jboss未啓動spring
四、javax.naming.NameNotFoundException: MySqlDS not boundsql
修改 D:\program\jboss-eap-5.0\jboss-as\server\default\deploy 下的 mysql-ds.xml數據庫
在<jndi-name>MySqlDS</jndi-name> 後面加入bootstrap
<use-java-context>false</use-java-context>tomcat
JBoss默認將數據源綁定在本地JNDI命名空間下,因此不能從JBoss運行的JVM以外查找到改數據源,要解決這個問題就是配置JBoss將數據源綁定在全局命名空間下session
更簡單的辦法是改爲<jndi-name>java:/MySqlDS</jndi-name>oracle
這兩個辦法只能選擇一個,若是同時使用仍是會報錯
五、jboss的執行關閉時報錯:
Exception in thread "main" java.lang.SecurityException: Failed to authenticate principal=null, securityDomain=jmx-console
由於在deploy目錄下的jmx-invoker-service.xml中有下面這麼一句:
<interceptor code="org.jboss.jmx.connector.invoker.AuthenticationInterceptor"
securityDomain="java:/jaas/jmx-console"/>
這個攔截器在jboss EAP中默認是打開的,也就是說默認必須設置jmx-console的用戶名和密碼,而且用shutdown.sh -s 127.0.0.1:1099 -u admin -p admin才能關閉(-u -p 後面的就是jmx-console的用戶名和密碼)
把這個攔截器註釋掉便可
六、You have not defined a jta-data-source for a JTA enabled persistence context named
persistence.xml文件中persistence-unit標籤下沒定義了這個<jta-data-source>java:/MySqlDS</jta-data-source>
七、 The Network Adapter could not establish the connection
jdbc:oracle:thin:10.8.12.78:1521:ORCL 改爲
jdbc:oracle:thin:@10.8.12.78:1521:ORCL 加了個@
八、須要將數據庫的jdbc驅動包放到D:\program\jboss-eap-5.0\jboss-as\server\default\lib 目錄下
不然驅動註冊失敗
九、jboss在MyEclipse下啓動報錯
Exception in thread "main" java.lang.NoClassDefFoundError: org/jboss/bootstrap/BaseServerConfig
解決辦法:修改MyEclipse下JBoss的JDK選項,選擇本身安裝的jdk1.6,不選用默認的1.7。
十、jboss啓動後只能經過localhost或者127.0.0.1來訪問,不能經過ip來訪問
解決辦法:修改C:\Program\jboss-eap-5.0\jboss-as\server\default\deploy\jbossweb.sar下的server.xml
<!-- A HTTP/1.1 Connector on port 8080 --> <Connector protocol="HTTP/1.1" port="8080" address="${jboss.bind.address}" connectionTimeout="20000" redirectPort="8443" /> <Connector protocol="AJP/1.3" port="8009" address="${jboss.bind.address}" redirectPort="8443" />
將${jboss.bind.address}修改成0.0.0.0,重啓後生效
十一、tomcat上能夠正常跑的項目到jboss上報錯:
org.hibernate.AnnotationException: java.lang.NoSuchMethodException: org.hibernate.validator.ClassValidator<init>
解決辦法:
<!-- Hibernate配置 --> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> <property name="dataSource" ref="dataSource" /> <property name="namingStrategy"> <bean class="org.hibernate.cfg.ImprovedNamingStrategy" /> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">${hibernate.dialect}</prop> <prop key="hibernate.show_sql">${hibernate.show_sql}</prop> <prop key="hibernate.format_sql">${hibernate.format_sql}</prop> <prop key="hibernate.connection.release_mode">after_transaction</prop> <prop key="hibernate.validator.apply_to_ddl">false</prop> <prop key="hibernate.validator.autoregister_listeners">false</prop> <!-- <prop key="hibernate.hbm2ddl.auto">create-drop</prop> --> </props> </property> <property name="packagesToScan"> <list> <value>org.snaker.framework.security.entity</value> <value>org.snaker.framework.form.entity</value> <value>org.snaker.framework.dictionary.entity</value> </list> </property> <property name="mappingResources"> <list> <value>hbm/snaker.task.hbm.xml</value> <value>hbm/snaker.order.hbm.xml</value> <value>hbm/snaker.ccorder.hbm.xml</value> <value>hbm/snaker.process.hbm.xml</value> <value>hbm/snaker.taskactor.hbm.xml</value> <value>hbm/snaker.workitem.hbm.xml</value> <value>hbm/snaker.surrogate.hbm.xml</value> </list> </property> </bean>
其中:
<prop key="hibernate.validator.apply_to_ddl">false</prop> <prop key="hibernate.validator.autoregister_listeners">false</prop>
是新增的配置