Wildfly 10 Not using database but getting a jpa error - eclipse

I recently installed Wildfly-10.0.0.Final. To get my feet wet, I created an elementary EJB that does not require a database connection. For some reason when I try to deploy the EJB, I get the following error:
Cannot upload deployment: {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"JavaEE_Wildfly1.jar\".
FIRST_MODULE_USE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.
\"JavaEE_Wildfly1.jar\".
FIRST_MODULE_USE: WFLYSRV0153: Failed to process phase FIRST_MODULE_USE of deployment \"JavaEE_Wildfly1.jar\"
Caused by: javax.persistence.PersistenceException: WFLYJPA0057: PersistenceProvider 'org.eclipse.persistence.jpa.PersistenceProvider' not found"}}
Since I am not using a database, do I still have to specify a Persistence provider? I do not have a persistence.xml because I did not think I needed one.

I don't think you need a persistence.xml. Check out this EJB-In-A-War wildfly quickstart for an example of a #Stateless EJB deployed without a persistence.xml.

Related

JBoss service failure

I get the following exception when I run JBoss:
Failed to start service org.wildfly.network.interface.cluster:
org.jboss.msc.service.StartException in service org.wildfly.network.interface.cluster:
WFLYSRV0082: failed to resolve interface cluster at
org.jboss.as.server.services.net.NetworkInterfaceService.start(NetworkInterfaceService.java:96)
This is rather generic. Does anyone know how to get more details about the root cause?
Any idea which jar file contains org.jboss.as.server.services.net.NetworkInterfaceService class?

Wildfly 11 Elytron - Properties File Based Authentication failing with required services not installed

I have a new instance of Wildfly 11, where I am trying to setup Properties File Based Authentication within Elytron. I'm using the Standalone-full.xml and manually deploying the application outside of an IDE.
https://docs.jboss.org/author/display/WFLY/Properties+File+Based+Authentication+Migration
I created the myApp-user and myApp-roles properties files with name valued pairs and included #$REALM_NAME=myAppPropRealm$
I ran the following CLI commands to create the
Create Prop Realm
/subsystem=elytron/properties-realm=myAppPropRealm:add(groups-attribute=groups,groups-properties={path=myApp-roles.properties,relative-to=jboss.server.config.dir},users-properties={path=myApp-users.properties,relative-to=jboss.server.config.dir,plain-text=true})
Configure Security-Domain
/subsystem=elytron/security-domain=myAppSecurityDomain:add(realms=[{realm=myAppPropRealm,role-decoder=groups-to-roles}],default-realm=myAppPropRealm,permission-mapper=default-permission-mapper)
Configure http-authentication-factory
/subsystem=elytron/http-authentication-factory=myApp-http-auth:add(http-server-mechanism-factory=global,security-domain=myAppSecurityDomain,mechanism-configurations=[{mechanism-name=BASIC,mechanism-realm-configurations=[{realm-name=myApp_ApplicationDomain}]}])
Configure application-security-domain in Undertow
/subsystem=undertow/application-security-domain=myApp_ApplicationDomain:add(http-authentication-factory=myApp-http-auth)
JBoss-web.xml
</jboss-web>
<security-domain>myApp_ApplicationDomain</security-domain>
</jboss-web>
I get the following error when my app tries to deploy
2018-11-29 09:06:55,695 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "MyApplication-ws.war")]) - failure description: {
"WFLYCTL0412: Required services that are not installed:" => ["jboss.security.security-domain.myApp_ApplicationDomain"],
"WFLYCTL0180: Services with missing/unavailable dependencies" => [
I suspect it is because I have not defined 'myApp_ApplicationDomain' but this is where I'm stuck. What commands do I run to add/reference
the myApp_ApplicationDomain?
Wildfly is looging for legacy security domain jboss.security.security-domain.myApp_ApplicationDomain for some reason. But seems you have correctly declared myApp_ApplicationDomain in undertow. Most probably you are using myApp_ApplicationDomain somewhere outside of undertow subsystem.

Wildfly 10: Cannot upload deployment, Required services that are not installed

Every time I deploy a war file in wildfly 10, I got this following error :
Cannot upload deployment: {"WFLYCTL0080: Failed services" =>
{"jboss.deployment.unit.\"member.war\".FIRST_MODULE_USE" =>
"org.jboss.msc.service.StartException in service
jboss.deployment.unit.\"member.war\".FIRST_MODULE_USE: WFLYSRV0153:
Failed to process phase FIRST_MODULE_USE of deployment \"member.war\"
Caused by:
org.jboss.as.server.deployment.DeploymentUnitProcessingException:
WFLYJCA0064: Exception deploying datasource java:/PostgresDS Caused
by: org.jboss.msc.service.DuplicateServiceException: Service
jboss.data-source.\"jboss.naming.context.java.PostgresDS\" is already
registered"},"WFLYCTL0412: Required services that are not installed:"
=> ["jboss.deployment.unit.\"member.war\".FIRST_MODULE_USE"],"WFLYCTL0180:
Services with missing/unavailable dependencies" => undefined}
It happens when I changed my persistence.xml and *-ds.xml which is telling my application to use the PostgresDS as its datasource.
Without looking at the files, it seems like you are registering your data source twice, once in the *-ds.xml and once in the persistence.xml (or maybe in the standalone.xml?).
Regarding missing/unavailable dependencies, are you certain the the Postgres SQL Module is installed in Wildfly and the driver is configured in the standalone.xml?
See also:
Wildfly DuplicateServiceException
How to add PostgreSQL datasource to WildFly 9.0?

Openshift - deploying simple Java EE app on Wildfly fails

I'm trying to deploy a very simple application on Openshift. It's an EAR project with a single WAR and EJB module. Inside the WAR there's a REST service that calls an EJB defined in EJB module. Locally and on Openshift I'm using Wildfly 9.0.0 CR2 and PostgreSQL 9.2. When deploying locally everything works fine. When the same code is deployed on Openshift I'm getting following errors in logs:
2015-06-28 18:23:04,574 WARN [org.jboss.as.clustering.jgroups] (MSC service thread 1-1) WFLYCLJG0006: property bind_addr for protocol org.jgroups.protocols.TCP attempting to override socket binding value 127.12.77.1 : property value 127.12.77.1 will be ignored
2015-06-28 18:23:04,574 WARN [org.jboss.as.clustering.jgroups] (MSC service thread 1-1) WFLYCLJG0006: property bind_port for protocol org.jgroups.protocols.TCP attempting to override socket binding value 7600 : property value 7600 will be ignored
2015-06-28 18:23:06,252 INFO [org.jboss.as.jpa] (ServerService Thread Pool -- 70) WFLYJPA0010: Starting Persistence Unit (phase 2 of 2) Service 'cooking.ear/cooking-ejb-1.0-SNAPSHOT.jar#cookingPU'
2015-06-28 18:23:08,165 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC000001: Failed to start service jboss.jgroups.channel.ee: org.jboss.msc.service.StartException in service jboss.jgroups.channel.ee: java.security.PrivilegedActionException: java.net.BindException: [TCP] /127.12.77.1 is not a valid address on any local network interface
at org.wildfly.clustering.jgroups.spi.service.ChannelBuilder.start(ChannelBuilder.java:79)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.security.PrivilegedActionException: java.net.BindException: [TCP] /127.12.77.1 is not a valid address on any local network interface
at org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:638)
at org.jboss.as.clustering.jgroups.JChannelFactory.createChannel(JChannelFactory.java:99)
at org.wildfly.clustering.jgroups.spi.service.ChannelBuilder.start(ChannelBuilder.java:77)
... 5 more
Caused by: java.net.BindException: [TCP] /127.12.77.1 is not a valid address on any local network interface
at org.jgroups.util.Util.checkIfValidAddress(Util.java:3480)
at org.jgroups.stack.Configurator.ensureValidBindAddresses(Configurator.java:902)
at org.jgroups.stack.Configurator.setupProtocolStack(Configurator.java:118)
at org.jgroups.stack.Configurator.setupProtocolStack(Configurator.java:57)
at org.jgroups.stack.ProtocolStack.setup(ProtocolStack.java:477)
at org.jgroups.JChannel.init(JChannel.java:854)
at org.jgroups.JChannel.<init>(JChannel.java:159)
at org.jboss.as.clustering.jgroups.JChannelFactory$1.run(JChannelFactory.java:96)
at org.jboss.as.clustering.jgroups.JChannelFactory$1.run(JChannelFactory.java:93)
at org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:634)
... 7 more
The address mentioned - 127.12.77.1 is $OPENSHIFT_WILDFLY_IP.
I have no idea what is causing this issue. First I thought it's a database connectivity issue because it happens when 2nd phase of starting persistence unit happens. I connected to DB on Openshift and saw that it was created successfully so maybe that's not it, but here's the persistence.xml I'm using:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="cookingPU">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<jta-data-source>java:jboss/datasources/PostgreSQLDS</jta-data-source>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQL9Dialect" />
</properties>
</persistence-unit>
</persistence>
The datasource used is the default one. I didn't change anything in standalone.xml.
Another thing I noticed is that the deploy problem happens when I add any EJB to the project.
This is a simple one I tried to use:
#Stateless
public class AnyEjb {
public String hello() {
return "Hi there!";
}
}
This is defined in EJB module. Then in web module I have this class calling it:
#Path("anything")
#Consumes(MediaType.APPLICATION_JSON)
#Produces(MediaType.APPLICATION_JSON)
public class AnyEndpoint {
#EJB
private AnyEjb anyEjb;
#GET
public String sayHi() {
return anyEjb.hello();
}
}
I'm not sure if and how it can be connected with this BindException.
I've tried running this application locally with both standalone and standalone-full-ha profile and it works in both cases. I just feel it has to be some issue with Openshift configuration but I have no idea where to look anymore. I'm very new to Openshift and Java EE. Please point me in a right direction. Any help will be much appreciated.
Might be https://issues.jboss.org/browse/JGRP-1928. Talk to Rado Husar to see how to resolve this.
It looks like the problem is (as #Bela Ban suggested) connected with the version of JGroups shipped with WildFly 9.0.0CR2. I will be waiting for the fix coming with the Final version of WildFly.
Meanwhile as a workaround to be able to deploy an application on WildFly 9.0.0CR2 on Openshift, I decided to disable clustering capabilities for my server.
In standalone.xml available in .openshift I have removed org.jboss.as.clustering.jgroups module and changed infinispan cache settings from distributed to local.
I have been basing on this solution (for WildFly 8): https://gist.github.com/fjuma/3df7f64fbaebd5506ef5#file-standalone-xml
But I had to modify it so that it works on Wildfly 9. Full standalone.xml that's been working for me is available here for reference http://pastebin.com/aANkPUWk

Play! war command - Is it possible to exclude certain jar from the application /lib folder

I'm trying to automate deployment of a play application as a .war file.
In the end the application will be run on JBOSS AS7.
The problem I'm running into right now is that when I deploy the war to JBOSS I get this exception.
14:52:39,728 INFO [org.jboss.as.server.deployment] (MSC service thread 1-2) Starting deployment of "my-test-app-server-0.0.2-SNAPSHOT.war"
14:52:43,822 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-7) MSC00001: Failed to start service jboss.deployment.unit."my-test-app-server-0.0.2-SNAPSHOT.war".PARSE: org.jboss.msc.service.Start
Exception in service jboss.deployment.unit."my-test-app-server-0.0.2-SNAPSHOT.war".PARSE: Failed to process phase PARSE of deployment "my-test-app-server-0.0.2-SNAPSHOT.war"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:121) [jboss-as-server-7.0.2.Final.jar:7.0.2.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_22]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_22]
at java.lang.Thread.run(Thread.java:662) [:1.6.0_22]
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: Failed to parse POJO xml ["/C:/jboss-as-web-7.0.2.Final/bin/content/my-test-app-server-0.0.2-SNAPSHOT.war/WEB-INF/lib/netty-3.2.5.Final.jar/META-INF/jboss-beans.xml"]
at org.jboss.as.pojo.KernelDeploymentParsingProcessor.parseDescriptor(KernelDeploymentParsingProcessor.java:130)
at org.jboss.as.pojo.KernelDeploymentParsingProcessor.parseDescriptors(KernelDeploymentParsingProcessor.java:104)
at org.jboss.as.pojo.KernelDeploymentParsingProcessor.deploy(KernelDeploymentParsingProcessor.java:76)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:115) [jboss-as-server-7.0.2.Final.jar:7.0.2.Final]
... 5 more
Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[17,1] Message: Unexpected element '{urn:jboss:bean-deployer:2.0}deployment'
at org.jboss.staxmapper.XMLMapperImpl.processNested(XMLMapperImpl.java:98) [staxmapper-1.0.0.Final.jar:1.0.0.Final]
at org.jboss.staxmapper.XMLMapperImpl.parseDocument(XMLMapperImpl.java:59) [staxmapper-1.0.0.Final.jar:1.0.0.Final]
at org.jboss.as.pojo.KernelDeploymentParsingProcessor.parseDescriptor(KernelDeploymentParsingProcessor.java:123)
... 8 more
I found that if I manually remove the lib/netty-3.2.5.Final.jar file from the war before deploying it to JBOSS the problem goes away.
Now is there a way to do this when I'm generating the war with the play war command?
Any information on this would be much appreciated.
Thanks
Not that I am aware of simply. The play war command allows you to pass an exclude list, which I have copied the comments from the python file below.
~ To exclude some directories, use the --exclude option and ':'-separator (eg: --exclude .svn:target:logs:tmp).
However, this suggests it will only work for directories.
The command that is executed is package_as_war in framework/pym/utils.py, so you can hack that to specifically delete the file, but obviously this will not be backward compatible if you update your version of Play.