Can't get JBoss to start, deployment missing - java

I'm having this strange error with JBoss. It's strange because it's looking for some old projects that aren't even related to my current project and are also deleted from my workspace in eclipse.
When I try to get the current project to run, I get this error:
DEPLOYMENTS MISSING DEPENDENCIES:
Deployment "jboss.j2ee:ear=BibliotheekEAR.ear,jar=BibliotheekEJB.jar,name=Bibliotheek,service=EJB3" is missing the following dependencies:
Dependency "" (should be in state "Described", but is actually in state "** UNRESOLVED Demands 'persistence.unit:unitName=BibliotheekEAR.ear/BibliotheekJPA.jar#BibliotheekJPA' **")
Deployment "jboss.j2ee:ear=BibliotheekEAR.ear,jar=BibliotheekEJB.jar,name=Bibliotheek,service=EJB3_endpoint" is missing the following dependencies:
Dependency "jboss.j2ee:ear=BibliotheekEAR.ear,jar=BibliotheekEJB.jar,name=Bibliotheek,service=EJB3" (should be in state "Configured", but is actually in state "PreInstall")
DEPLOYMENTS IN ERROR:
Deployment "" is in error due to the following reason(s): ** UNRESOLVED Demands 'persistence.unit:unitName=BibliotheekEAR.ear/BibliotheekJPA.jar#BibliotheekJPA' **
Deployment "persistence.unit:unitName=BibliotheekEAR.ear/BibliotheekJPA.jar#BibliotheekJPA" is in error due to the following reason(s): org.hibernate.HibernateException: Hibernate Dialect must be explicitly set
Any ideas?
I have deleted all these projects, so I don't know why it's looking for them...

I have deleted all these projects, so I don't know why it's looking for them
Deleted from where? Maybe double check that they aren't any remaining traces under the deploy or tmp directories of the server configuration you're using.
See also
2.1. Server Structure

It seems that you haven't set the Hibernate database dialect property correctly for the database your using in your application. Try setting your database dialect in your persistence.xml file like this:
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
In case you're using MySQL. Here is a list of the most common hibernate dialects used.

Related

is Hibernate Elasticsearch compatible with wildfly 14

I am trying to index my entities on AWS Elasticsearch cluster, I am currently using hibernate search and local file for it. Therefore, the hibernate integration with elasticsearch is the only option I have, I've followed the hibernate search doc but it ends up with
Caused by: java.util.ServiceConfigurationError: org.hibernate.search.bridge.spi.IndexManagerTypeSpecificBridgeProvider: Provider org.hibernate.search.elasticsearch.bridge.impl.ElasticsearchBridgeProvider not a subtype
I tried to remove all the jars and clean install maven once again, it didn't change anything
I've tried to add the hibernate-search-elasticsearch as a module in wildfly but ends up with many issues as well like Lucene query parser is not found in the class loader (maybe I missed up something while adding the jar as a module )
As I understood I don't need server provisioning since I am using the version which is supported by wildfly (correct me if I am wrong).
I am using:
Wildfly server 14.0.1
Hibernate core 5.3.6.Final
Hibernate search orm 5.10.3.Final
Hibernate search elasticsearch 5.10.3.Final
any ideas what could be wrong? and the better question am I adding the correct dependencies for wildfly?
P.S I know the similar question was asked before but the answer didn't help at all.
All that needed to be done is to add the dependency for hibernate elasticsearch as compile scope and add those properties in persistence.xml.
<property name="jboss.as.jpa.providerModule" value="org.hibernate" />
<property name="wildfly.jpa.hibernate.search.module" value="org.hibernate.search.orm" />

WFLYEE0040: A component named '...' is already defined in this module

I get this error in a Java maven project. The weird thing is, it doesn't appear on every machine so I assume it has something to do with a configuration issue.
The class RoleKeyCacheImpl is a #Startup #Singleton:
#Startup
#Singleton
public class RoleKeyCacheImpl implements RoleKeyCache { ... }
That's the error Wildfly triggers when deploying the service.
Caused by: java.lang.IllegalArgumentException: WFLYEE0040: A component
named 'RoleKeyCacheImpl' is already defined in this module at
org.jboss.as.ee.component.EEModuleDescription.addComponent(EEModuleDescription.java:167)
at
org.jboss.as.ejb3.deployment.processors.EJBComponentDescriptionFactory.addComponent(EJBComponentDescriptionFactory.java:58)
I've tried:
installing a new Wildfly (V10, V13) on the same machine -> doesn't help
installing a completely new Eclipse on this machine -> doesn't help
cleaning & rebuilding all related projects
making sure the deployments-folder is empty and doesn't contain old versions of the same WAR
read the related question here which also didn't help (they use Spring): A component named 'XXX' is already defined in this module in JBoss 7.1.1
read and tried this q&a: Wrong dependencies with EJB in JBoss Wildfly (server-clean) -> doesn't help
deleted and rebuilt the local maven rep (".m2") -> no effect
checking out the same source on another computer -> does work on one machine, on another it gives the same error
I have absolutely no clue what the issue is or even could be. On one machine, we check it out and it runs without errors. On others, the exact same error happens.
Does anybody have an idea?
I had this same issue multiple times with EAP 7.1 and now again with WildFly 21.0.0. I know by experience this is an issue caused by Eclipse who tries to deploy automatically to a configured WildFly instance. During the deployment (or undeployment) some concurrent file issue arises and files who should be removed, are still on the filesystem, causing this error that a component is already defined.
In fact it is not already defined, it is just WildFly that is confused because it finds in his temporary directories some old files which shouldn't be there and reference your exact same component.
Solution: remove in the WildFly standalone directory the content in the 'deployments' directory and the 'tmp' directory. Rest assured, all what is there is okay to remove safely. Reboot and the error message will be gone ;-)
You should pay attention to not have two #Stateless EJB annotations on top of two classes with the same name - in the same module.
You may differentiate them by using the name attribute in the annotation and put different values in each class
Looks like the class already exists. Check if it does...you may have to rewrite that part of EEModuleDescription to use its own private methods (which would be what you would write) rather than overriding methods in RoleKeyCacheImpl. If the class actually does not exist then right-click on the project -> Maven 2 Tools -> Generate Eclipse Artifacts (Check for Updates). That will regenerate all of the dependencies that the project uses. Also please be sure that you have not added any new projects to the classpath by mistake as that may also cause this error.
I just ran into this today when a colleague added a maven dependency.
Turns out this dependency was a jar with a nasty classpath entry or "../" in the manifest.
I edited the jar's manifest.mf that was cached in my local maven repository using 7-zip and removed the "../" classpath entry.
Then re-packaged my war file (maven clean install) and bingo, it works!
In my case it was caused by org.libreoffice jurt version 5.4.2 (but other versions I checked also have the classpath nastiness).
Unfortunately I was lucky we pinpointed it to a dependency, YMMV!

javax.faces.FacesException . It is a exception belongs to Spring Security 3.x

I am developing an application using Struts 2.x. I am using Spring Security to provide security to my application. However, when I am not connect to the internet I always get an exception. If I have internet connect, there will be no exception. The exception is:
javax.faces.FacesException: Can't parse configuration file:
jar:file:/home/dev7/springsource/vfabric-tc-server-developer-2.8.2.RELEASE/base-instance/wtpwebapps/UNHPM_5/WEB-INF/lib/skyway-spring-utils-7.1.3.jar!/META-INF/faces-config.xml:
Error at line 5 column 16: cvc-elt.1: Cannot find the declaration of
element 'faces-config'.
I have also added the jar file skyway-spring-utils-7.1.3.jar to project but the exception remains when I am not connected to the internet. What may be the solution?
Probably this problem belongs to jar version miss-match.because it's create incompatibility between the DTD version.
Another problem may be you have multiple versions of jar in your build-path.
My suggestion is use maven to add the dependency jar

Hibernate and EclipseLink Providers

I have a Hibernate running in my project and I am trying to set it up to be switchable to EclipseLink. I have added all EclipseLink classes in Maven, but it seems that they are not running at all. When I try to run the project, it ends up with:
Exception in thread "main" javax.persistence.PersistenceException:
No Persistence provider for EntityManager named test
My persistence.xml file: https://gist.github.com/1676280
The pom.xml file with the dependencies: https://gist.github.com/1676282
Once I switch the providers in the persistence.xml back to Hibernate, everything works correctly.
I see one significant issue and a couple of minor problems in your persistence.xml.
The big issue is the your persistence unit is named "org.knyttl" but the error message says persistence unit "test" can't be found. If you're looking for "test" and the pu is "org.knyttl" then you're not going to find anything. :)
The minor issues are that you have a couple of the EclipseLink properties misnamed. "javax.persistence.target-database" should be "eclipselink.target-database" and "javax.persistence.logging.level" should be "eclipselink.logging.level".
Shaun

GWT with JPA - no persistence provider

GWT with JPA
There are two projects in my eclipse workspace, let's name them:
-JPAProject
-GWTProject
JPAProject contains JPA configuration stuff (persistence.xml, entity classes and so on). GWTProject is an examplary GWT project (taken from official GWT tutorial).
Both projects work fine alone. That is, I can create EMF (EntityManagerFactory) in JPAProject and get entities from the database. GWTProject works fine too, I can run it, fill the field text in the browser and get the response.
My goal is to call JPAProject from GWTProject to get entities. But the problem is that when calling DAO, I get the following exception:
[WARN] Server class 'com.emergit.service.dao.profile.ProfileDaoService' could not be found in the web app, but was found on the system classpath
[WARN] Adding classpath entry 'file:/home/maliniak/workspace/emergit/build/classes/' to the web app classpath for this session
[WARN] /gwttest/greet
javax.persistence.PersistenceException: No Persistence provider for EntityManager named emergitPU
at javax.persistence.Persistence.createEntityManagerFactory(Unknown Source)
at javax.persistence.Persistence.createEntityManagerFactory(Unknown Source)
at com.emergit.service.dao.profile.JpaProfileDaoService.<init>(JpaProfileDaoService.java:19)
at pl.maliniak.server.GreetingServiceImpl.<init>(GreetingServiceImpl.java:21)
...
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)
[ERROR] 500 - POST /gwttest/greet (127.0.0.1) 3812 bytes
I guess that the warnings at the beginning can be omitted for now.
Do you have any ideas? I guess I am missing some basic point. All hints are highly appreciated.
Update: My persistence provider is well defined, the JPA project works well by itself.
I guess it's classpath related problem too. When running the GWT project, in WEB-INF/lib there is only gwt-servlet.jar.
Do you think that making custom Ant file to build whole thing up is the only solution (i.e. make jar out of the JPA project and copying it to WEB-INF/lib)? Or is there any Eclipse solution, so I could set the GWT project properties properly so GWT project would know to include persistence.xml file?
Update: OK, I got it working. I tried to put persitence.xml everywhere in war/WEB-INF where it was possible, but kept getting 'no persistence provider' error. It turned out that it wasn't about persistence.xml. I didn't copy the eclipselink jar to WEB-INF/lib, so it couldn't find provider class defined in persistence.xml. Copying all the jars did the thing.
Thank you very much Pascal.
Struggling a lot with the same error message, I solved the problem with copying all jars (eclipselink.jar, eclipselink-jpa-modelgen_2.1.0.v20100614-r7608.jar, javax.persistence_1.0.0.jar, javax.persistence_2.0.1.v201006031150.jar) from the EclipseLink zip to the .../war/WEB-INF/lib folder of my GWT project to make everything available for the Jetty in hosted mode.
As you can see from the list of files, I was using EclipseLink 2.1. Please adapt this list to your JPA implementation, if necessary.
Hoping, that this may help you as well.
Do you have a persistence provider declared in your persistence.xml? Something like this (I'm using Hibernate here, adapt it to whatever persistence provider you're using):
<persistence
<persistence-unit name="emergitPU" transaction-type="...">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
...
</persistence-unit>
</persistence>
If you do, then I suspect a classpath problem. Did you package the JPA project correctly in the webapp i.e. in WEB-INF/lib?

Categories