我将尝试解释我的问题,我在这里和其他论坛中搜索解决方案已有几天,但最终我必须询问我的特定问题以寻求帮助。
我有一个用Spring Roo + Hibernate开发的应用程序,该应用程序在Tomcat上运行良好,但是由于某些原因,我需要迁移到JBoss,但目前无法。
该应用程序已正确部署并启动,我可以登录,但是注销后失败。应用程序尝试查找有关登录用户的信息,以将其保存在会话中,然后发生错误,特别是:
org.springframework.dao.InvalidDataAccessApiUsageException: Unable to locate persister Unable to locate persister: com.isc.maqueta.seguridad.domain.UsrNom; nested exception is java.lang.IllegalArgumentException: Unable to locate persister: com.isc.maqueta.seguridad.domain.UsrNom
错误跟踪如下:
===============================================================================
JBoss Bootstrap Environment
JBOSS_HOME: "C:\Program Files\EAP"
JAVA: "C:\Program Files\Java\jdk1.8.0_152\jre\bin\java"
JAVA_OPTS: "-Dprogram.name=standalone.bat -Xms1G -Xmx1G -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -Xloggc:"C:\Program Files\EAP\standalone\log\gc.log" -XX:GCLogFileSize=3M -XX:-TraceClassUnloading"
===============================================================================
09:28:24,154 INFO [org.jboss.modules] (main) JBoss Modules version 1.6.0.Final-redhat-1
09:28:27,139 INFO [org.jboss.msc] (main) JBoss MSC version 1.2.7.SP1-redhat-1
09:28:27,440 INFO [org.jboss.as] (MSC service thread 1-8) WFLYSRV0049: JBoss EAP 7.1.0.GA (WildFly Core 3.0.10.Final-redhat-1) iniciando
09:28:34,383 INFO [org.jboss.as.controller.management-deprecated] (Controller Boot Thread) WFLYCTL0028: El atributo 'security-realm' en el recurso en la dirección '/core-service=management/management-interface=http-interface' está depreciado y quizás sea retirado en una versión futura. Consulte la descripción de atributos en la salida de la operación read-resource-description para aprender más sobre la depreciación.
09:28:34,427 INFO [org.jboss.as.controller.management-deprecated] (ServerService Thread Pool -- 26) WFLYCTL0028: El atributo 'security-realm' en el recurso en la dirección '/subsystem=undertow/server=default-server/https-listener=https' está depreciado y quizás sea retirado en una versión futura. Consulte la descripción de atributos en la salida de la operación read-resource-description para aprender más sobre la depreciación.
09:28:34,440 INFO [org.wildfly.security] (ServerService Thread Pool -- 24) ELY00001: WildFly Elytron version 1.1.7.Final-redhat-1
09:28:34,564 INFO [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0039: Creando el servicio de administración http utilizando el enlace de socket (management-http)
09:28:34,631 INFO [org.xnio] (MSC service thread 1-6) XNIO version 3.5.4.Final-redhat-1
09:28:34,649 INFO [org.xnio.nio] (MSC service thread 1-6) XNIO NIO Implementation Version 3.5.4.Final-redhat-1
09:28:34,705 INFO [org.jboss.as.naming] (ServerService Thread Pool -- 50) WFLYNAM0001: Activando el subsistema de nominación
09:28:34,705 INFO [org.jboss.as.security] (ServerService Thread Pool -- 57) WFLYSEC0002: Activando el subsistema de seguridad
09:28:34,705 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 42) WFLYCLINF0001: Activando el subsistema Infinispan.
09:28:34,722 INFO [org.jboss.as.webservices] (ServerService Thread Pool -- 60) WFLYWS0002: Activando WebServices Extension
09:28:34,710 INFO [org.jboss.as.jsf] (ServerService Thread Pool -- 48) WFLYJSF0007: Se activaron las siguientes implementaciones JSF: [main]
09:28:34,697 WARN [org.jboss.as.txn] (ServerService Thread Pool -- 58) WFLYTX0013: El atributo node-identifier del /subsystem=transactions está configurado como el valor predeterminado. Esto es peligroso para los entornos que ejecutan varios servidores. Asegúrese de que el valor del atributo sea único.
09:28:34,746 INFO [org.jboss.as.jaxrs] (ServerService Thread Pool -- 43) WFLYRS0016: RESTEasy versión 3.0.24.Final-redhat-1
09:28:34,754 INFO [org.jboss.as.security] (MSC service thread 1-8) WFLYSEC0001: Versión PicketBox actual=5.0.2.Final-redhat-1
09:28:34,814 INFO [org.jboss.as.naming] (MSC service thread 1-1) WFLYNAM0003: Iniciando el servicio de nombrado
09:28:34,817 INFO [org.jboss.as.mail.extension] (MSC service thread 1-1) WFLYMAIL0001: Sesión de correo enlazada [java:jboss/mail/Default]
09:28:34,825 INFO [org.jboss.as.connector] (MSC service thread 1-4) WFLYJCA0009: Iniciando JCA subsistema (WildFly/IronJacamar 1.4.6.Final-redhat-1)
09:28:34,945 INFO [org.wildfly.extension.undertow] (MSC service thread 1-1) WFLYUT0003: Undertow 1.4.18.Final-redhat-2 iniciando
09:28:34,989 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 36) WFLYJCA0004: Implementación del controlador que cumple con los requerimientos de JDBC class org.h2.Driver (versión 1.4)
09:28:35,023 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-4) WFLYJCA0018: Servicio de controlador iniciado con driver-name = h2
09:28:35,310 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 36) WFLYJCA0004: Implementación del controlador que cumple con los requerimientos de JDBC class oracle.jdbc.OracleDriver (versión 11.2)
09:28:35,315 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-7) WFLYJCA0018: Servicio de controlador iniciado con driver-name = oracle
09:28:35,486 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-7) WFLYJCA0098: Fuente de datos non-transactional vinculada: java:jboss/datasources/siccir.dgsp.db
09:28:35,560 INFO [org.wildfly.extension.io] (ServerService Thread Pool -- 41) WFLYIO001: Worker 'default' ha configurado automáticamente los hilos de núcleo 8 con los hilos de tareas 64 en base a los procesadores 4 disponibles.
09:28:35,597 INFO [org.jboss.as.ejb3] (MSC service thread 1-5) WFLYEJB0481: El grupo estricto (slsb-strict-max-pool utiliza un tamaño de instancia máximo de 64 (por clase), el cual se deriva del tamaño de grupo del Worker de hilos.
09:28:35,601 INFO [org.jboss.as.ejb3] (MSC service thread 1-1) WFLYEJB0482: El grupo estricto mdb-strict-max-pool utiliza un tamaño de instancia máximo de 16 (por clase), el cual se deriva del número de CPUs en este host.
09:28:35,730 INFO [org.jboss.remoting] (MSC service thread 1-8) JBoss Remoting version 5.0.5.Final-redhat-1
09:28:35,875 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 59) WFLYUT0014: Creación de controlador de archivos para la ruta de acceso 'C:\Program Files\EAP/welcome-content' con las opciones s [directory-listing: 'false', follow-symlink: 'false', case-sensitive: 'true', safe-symlink-paths: '[]']
09:28:35,891 INFO [org.wildfly.extension.undertow] (MSC service thread 1-3) WFLYUT0012: El servidor ha iniciado default-server.
09:28:35,895 INFO [org.wildfly.extension.undertow] (MSC service thread 1-7) WFLYUT0018: Host default-host iniciando
09:28:35,895 INFO [org.jboss.as.ejb3] (MSC service thread 1-2) WFLYEJB0493: Suspensión del subsistema de EJB completa
09:28:35,923 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-7) WFLYJCA0001: Fuente de datos vinculados [java:jboss/datasources/ExampleDS]
09:28:36,015 INFO [org.wildfly.extension.undertow] (MSC service thread 1-3) WFLYUT0006: Undertow HTTP oyente default escuchando en 127.0.0.1:8080
jul 16, 2018 9:28:36 AM org.jboss.remoting3.EndpointImpl <clinit>
INFO: JBoss Remoting version 5.0.5.Final-redhat-1
jul 16, 2018 9:28:36 AM org.xnio.Xnio <clinit>
INFO: XNIO version 3.5.4.Final-redhat-1
jul 16, 2018 9:28:36 AM org.xnio.nio.NioXnio <clinit>
INFO: XNIO NIO Implementation Version 3.5.4.Final-redhat-1
jul 16, 2018 9:28:37 AM org.wildfly.security.Version <clinit>
INFO: ELY00001: WildFly Elytron version 1.1.7.Final-redhat-1
09:28:42,112 INFO [org.jboss.as.patching] (MSC service thread 1-2) WFLYPAT0050: El ID de parche acumulativo JBoss EAP es: base, parches one-off incluyen: none
09:28:42,147 WARN [org.jboss.as.domain.management.security] (MSC service thread 1-5) WFLYDM0111: No se encontró el KeyStore C:\Program Files\EAP\standalone\configuration\application.keystore, será autogenerado durante la primera utilización con un certificado firmado automáticamente para el host localhost
09:28:42,147 INFO [org.jboss.as.server.deployment.scanner] (MSC service thread 1-2) WFLYDS0013: Inició FileSystemDeploymentService para el directorio C:\Program Files\EAP\standalone\deployments
09:28:42,640 INFO [org.wildfly.extension.undertow] (MSC service thread 1-5) WFLYUT0006: Undertow HTTPS oyente https escuchando en 127.0.0.1:8443
09:28:44,238 INFO [org.jboss.ws.common.management] (MSC service thread 1-2) JBWS022052: Starting JBossWS 5.1.9.Final-redhat-1 (Apache CXF 3.1.12.redhat-1)
09:28:44,346 INFO [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0212: Reanudando el servidor
09:28:44,348 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Interfaz de administración http escuchando en http://127.0.0.1:9990/management
09:28:44,348 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Consola de administración escuchando en http://127.0.0.1:9990
09:28:44,348 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: JBoss EAP 7.1.0.GA (WildFly Core 3.0.10.Final-redhat-1) inició en 21181ms - Inició 300 de 561 servicios (348 servicios son perezosos, pasivos o por demanda)
Connected to server
[2018-07-16 09:28:44,414] Artifact siccir:war exploded: Artifact is being deployed, please wait...
09:28:44,841 INFO [org.jboss.as.server.deployment] (MSC service thread 1-6) WFLYSRV0027: Iniciando la implementación de siccir-0.1.0.BUILD-SNAPSHOT" (runtime-name: "siccir-0.1.0.BUILD-SNAPSHOT.war")
09:28:50,881 INFO [org.jboss.as.jpa] (MSC service thread 1-6) WFLYJPA0002: Leer persistence.xml para persistenceUnit
09:28:55,218 INFO [org.jboss.as.jpa] (ServerService Thread Pool -- 27) WFLYJPA0010: Iniciando unidad de persistencia (fase 1 de 2) Servicio 'siccir-0.1.0.BUILD-SNAPSHOT#persistenceUnit'
09:28:55,241 INFO [org.hibernate.jpa.internal.util.LogHelper] (ServerService Thread Pool -- 27) HHH000204: Processing PersistenceUnitInfo [
name: persistenceUnit
...]
09:28:55,592 INFO [org.hibernate.Version] (ServerService Thread Pool -- 27) HHH000412: Hibernate Core {5.1.10.Final-redhat-1}
09:28:55,593 INFO [org.hibernate.cfg.Environment] (ServerService Thread Pool -- 27) HHH000206: hibernate.properties not found
09:28:55,595 INFO [org.hibernate.cfg.Environment] (ServerService Thread Pool -- 27) HHH000021: Bytecode provider name : javassist
09:28:55,668 INFO [org.hibernate.annotations.common.Version] (ServerService Thread Pool -- 27) HCANN000001: Hibernate Commons Annotations {5.0.1.Final-redhat-2}
09:28:55,682 WARN [org.hibernate.orm.deprecation] (ServerService Thread Pool -- 27) HHH90000006: Attempted to specify unsupported NamingStrategy via setting [hibernate.ejb.naming_strategy]; NamingStrategy has been removed in favor of the split ImplicitNamingStrategy and PhysicalNamingStrategy; use [hibernate.implicit_naming_strategy] or [hibernate.physical_naming_strategy], respectively, instead.
09:28:56,084 INFO [org.infinispan.factories.GlobalComponentRegistry] (MSC service thread 1-2) ISPN000128: Infinispan version: Infinispan 'Chakra' 8.2.8.Final-redhat-1
09:28:56,205 WARN [org.jboss.as.ee] (MSC service thread 1-8) WFLYEE0007: No se está instalando el componente opcional org.springframework.web.context.request.async.StandardServletAsyncWebRequest debido a una excepción (active el nivel de registro DEBUG para ver la razón)
09:28:56,552 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-8) WFLYJCA0004: Implementación del controlador que cumple con los requerimientos de JDBC class oracle.jdbc.OracleDriver (versión 11.2)
09:28:56,552 WARN [org.jboss.weld.deployer] (MSC service thread 1-8) WFLYWELD0013: La implementación siccir-0.1.0.BUILD-SNAPSHOT.war contiene anotaciones de CDI, pero no se encontró ningún archivo bean (beans.xml o clase con anotaciones de definición de beans).
09:28:56,732 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-2) WFLYJCA0018: Servicio de controlador iniciado con driver-name = siccir-0.1.0.BUILD-SNAPSHOT.war_oracle.jdbc.OracleDriver_11_2
09:28:56,732 INFO [org.jboss.as.jpa] (ServerService Thread Pool -- 27) WFLYJPA0010: Iniciando unidad de persistencia (fase 2 de 2) Servicio 'siccir-0.1.0.BUILD-SNAPSHOT#persistenceUnit'
09:28:56,919 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 23) WFLYCLINF0002: Inició client-mappings caché del contenedor ejb
09:28:57,231 INFO [org.hibernate.dialect.Dialect] (ServerService Thread Pool -- 27) HHH000400: Using dialect: org.hibernate.dialect.Oracle10gDialect
09:28:57,368 INFO [org.hibernate.envers.boot.internal.EnversServiceImpl] (ServerService Thread Pool -- 27) Envers integration enabled? : true
09:28:59,662 WARN [org.hibernate.ejb.HibernatePersistence] (ServerService Thread Pool -- 100) HHH015016: Encountered a deprecated javax.persistence.spi.PersistenceProvider [org.hibernate.ejb.HibernatePersistence]; use [org.hibernate.jpa.HibernatePersistenceProvider] instead.
09:28:59,664 INFO [org.hibernate.jpa.internal.util.LogHelper] (ServerService Thread Pool -- 100) HHH000204: Processing PersistenceUnitInfo [
name: persistenceUnit
...]
09:28:59,674 WARN [org.hibernate.orm.deprecation] (ServerService Thread Pool -- 100) HHH90000006: Attempted to specify unsupported NamingStrategy via setting [hibernate.ejb.naming_strategy]; NamingStrategy has been removed in favor of the split ImplicitNamingStrategy and PhysicalNamingStrategy; use [hibernate.implicit_naming_strategy] or [hibernate.physical_naming_strategy], respectively, instead.
09:28:59,878 INFO [org.hibernate.dialect.Dialect] (ServerService Thread Pool -- 100) HHH000400: Using dialect: org.hibernate.dialect.Oracle10gDialect
09:28:59,909 INFO [org.hibernate.envers.boot.internal.EnversServiceImpl] (ServerService Thread Pool -- 100) Envers integration enabled? : true
09:29:00,103 INFO [javax.enterprise.resource.webcontainer.jsf.config] (ServerService Thread Pool -- 100) Inicializando Mojarra 2.2.13.SP4 para el contexto '/siccir'
09:29:30,713 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 100) WFLYUT0021: Contexto de Web registrado: '/siccir' para el servidor 'default-server'
09:29:30,751 INFO [org.jboss.as.server] (management-handler-thread - 4) WFLYSRV0010: Implementado "siccir-0.1.0.BUILD-SNAPSHOT" (runtime-name : "siccir-0.1.0.BUILD-SNAPSHOT.war")
[2018-07-16 09:29:30,774] Artifact siccir:war exploded: Artifact is deployed successfully
[2018-07-16 09:29:30,774] Artifact siccir:war exploded: Deploy took 46.360 milliseconds
09:29:42,126 ERROR [io.undertow.request] (default task-5) UT005023: Exception handling request to /siccir/index.jsp: org.apache.jasper.JasperException: org.springframework.dao.InvalidDataAccessApiUsageException: Unable to locate persister: com.isc.maqueta.seguridad.domain.UsrNom; nested exception is java.lang.IllegalArgumentException: Unable to locate persister: com.isc.maqueta.seguridad.domain.UsrNom
at ..........
Caused by: org.springframework.dao.InvalidDataAccessApiUsageException: Unable to locate persister: com.isc.maqueta.seguridad.domain.UsrNom; nested exception is java.lang.IllegalArgumentException: Unable to locate persister: com.isc.maqueta.seguridad.domain.UsrNom
at org.springframework.orm.jpa.EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(EntityManagerFactoryUtils.java:296)
at org.springframework.orm.jpa.aspectj.JpaExceptionTranslatorAspect.ajc$afterThrowing$org_springframework_orm_jpa_aspectj_JpaExceptionTranslatorAspect$1$18a1ac9(JpaExceptionTranslatorAspect.aj:33)
at com.isc.maqueta.seguridad.domain.UsrNom_Roo_Jpa_ActiveRecord.findUsrNom_aroundBody8(UsrNom_Roo_Jpa_ActiveRecord.aj:46)
at com.isc.maqueta.seguridad.domain.UsrNom_Roo_Jpa_ActiveRecord.ajc$interMethod$com_isc_maqueta_seguridad_domain_UsrNom_Roo_Jpa_ActiveRecord$com_isc_maqueta_seguridad_domain_UsrNom$findUsrNom(UsrNom_Roo_Jpa_ActiveRecord.aj:1)
at com.isc.maqueta.seguridad.domain.UsrNom.findUsrNom(UsrNom.java:1)
at com.isc.maqueta.seguridad.domain.UsrNom_Roo_Jpa_ActiveRecord.ajc$interMethodDispatch1$com_isc_maqueta_seguridad_domain_UsrNom_Roo_Jpa_ActiveRecord$com_isc_maqueta_seguridad_domain_UsrNom$findUsrNom(UsrNom_Roo_Jpa_ActiveRecord.aj)
at com.isc.maqueta.seguridad.bean.LoginBEAN.getLoginBeanByNamePrincipal(LoginBEAN.java:68)
at .....org.hibernate.jpa.spi.AbstractEntityManagerImpl.find(AbstractEntityManagerImpl.java:1075)
... 103 more
为了配置持久性,我有一个这样的persistence.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.0" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="persistenceUnit" transaction-type="RESOURCE_LOCAL">
<!--<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>-->
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:jboss/datasources/siccir.dgsp.db</jta-data-source>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/>
<!-- value="create" to build a new database on each run; value="update" to modify an existing database; value="create-drop" means the same as "create" but also drops tables when Hibernate closes; value="validate" makes no changes to the database -->
<!--<property name="hibernate.hbm2ddl.auto" value="validate"/>-->
<property name="hibernate.ejb.naming_strategy" value="org.hibernate.cfg.ImprovedNamingStrategy"/>
<property name="hibernate.connection.charSet" value="UTF-8"/>
<!-- Uncomment the following two properties for JBoss only -->
<property name="hibernate.validator.apply_to_ddl" value="false"/>
<property name="hibernate.validator.autoregister_listeners" value="false"/>
</properties>
</persistence-unit>
</persistence>
发生错误的函数是
public static UsrNom UsrNom.findUsrNom(String cod) {
if (cod == null || cod.length() == 0) return null;
return entityManager().find(UsrNom.class, cod);
}
在entityManager()。find(UsrNom.class,编码)中
实体UsrNom:
package com.isc.maqueta.seguridad.domain;
//import com.isc.maqueta.subastas.domain.Emp;
import flexjson.JSONSerializer;
import org.springframework.roo.addon.javabean.RooJavaBean;
import org.springframework.roo.addon.jpa.activerecord.RooJpaActiveRecord;
import org.springframework.roo.addon.json.RooJson;
import org.springframework.roo.addon.tostring.RooToString;
import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import java.util.List;
@RooJavaBean
@RooToString
@RooJson(deepSerialize = true)
@RooJpaActiveRecord(table = "SEG_USUARIOS", finders = {}, versionField = "")
public class UsrNom {
@Id
@Column(name = "USU_LOGIN")
private String cod;
@Column(name = "USU_PASSWORD")
private String password;
@Column(name = "USU_NOMBRE")
private String nombre;
@ManyToOne
@JoinColumn(name = "USU_ROL_COD")
private Rol rol;
public static String JsonUsrNom(UsrNom usrNom) {
return new JSONSerializer().serialize(usrNom);
}
..
}
在JBoss的standalone.xml中,我已经定义了:
<datasource jta="false" jndi-name="java:jboss/datasources/siccir.dgsp.db" pool-name="siccir.dgsp.db" enabled="true" use-java-context="true" spy="false" use-ccm="true">
<connection-url>jdbc:oracle:thin:@localhost:1521:xe</connection-url>
<driver>oracle</driver>
<pool>
<min-pool-size>5</min-pool-size>
<max-pool-size>10</max-pool-size>
<prefill>true</prefill>
</pool>
<security>
<user-name>SICCIR</user-name>
<password>*******</password>
</security>
</datasource>
<drivers>
<driver name="h2" module="com.h2database.h2">
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
</driver>
<driver name="oracle" module="com.oracle.ojdbc">
<xa-datasource-class>org.jdbc.OracleDriver</xa-datasource-class>
</driver>
</drivers>
和
<security-domain name="siccirRealm" cache-type="default">
<authentication>
<login-module code="Database" flag="required">
<module-option name="dsJndiName" value="java:jboss/datasources/siccir.dgsp.db"/>
<module-option name="principalsQuery" value="SELECT pck_encriptafaq.desencriptar(usu_password) FROM seg_usuarios WHERE usu_login = ? AND (usu_baja = 0 OR usu_baja IS NULL)"/>
<module-option name="rolesQuery" value="SELECT USU_ROL_COD role, '' RoleGroup FROM SEG_USUARIOS WHERE USU_LOGIN = ?"/>
</login-module>
</authentication>
</security-domain>
在此先感谢您的帮助!