-
1. Re: Trying to disable @EJB and @PersistentContext
rogerparkinson Oct 23, 2014 10:57 PM (in response to rogerparkinson)I have found an answer but not one I like much.
I can edit standalone.xml and comment out the ejb and jpa stuff.
That works but, of course, if I want to deploy another war file which does use JPA I can't, or not on that server anyway.
So I'm happy to hear a better answer.
-
2. Re: Trying to disable @EJB and @PersistentContext
jaikiran Oct 24, 2014 1:05 AM (in response to rogerparkinson)There's a portable way of doing this. Just set the metadata-complete attribute to true in the deployment descriptor of your application. The application.xml, web.xml and ejb.xml all have that attribute on their root element. Take a look at the relevant xsd to get it right. Setting it to true, tells the container to ignore any annotation based components and instead rely just on the deployment descriptors for components.
-
3. Re: Trying to disable @EJB and @PersistentContext
rogerparkinson Oct 26, 2014 1:39 AM (in response to jaikiran)When I try metadata-complete it fails to deploy:
18:32:30,732 INFO [org.jboss.as.jpa] (MSC service thread 1-11) JBAS011401: Read persistence.xml for ghiDatabase
18:32:30,858 ERROR [org.jboss.as.controller.management-operation] (DeploymentScanner-threads - 1) JBAS014613: Operation ("deploy") failed - address: ([("deployment" => "com.ghiplus.knowledge.res.war")]) - failure description: {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.persistenceunit.\"com.ghiplus.knowledge.res.war#ghiDatabase\".__FIRST_PHASE__ is missing [jboss.naming.context.java.jdbc.ghi]"]}
So it is still looking for the persistence stuff. What I did was add metadata-complete="true" to the web-app tag in my web.xml file.
I'm okay with the edits in the standalone, though.
-
4. Re: Trying to disable @EJB and @PersistentContext
jaikiran Oct 28, 2014 4:07 AM (in response to rogerparkinson)That doesn't look like an annotation based issue. It looks like your application (war?) has a persistence.xml which is expecting a datasource at certain JNDI name. You'll either have to setup that datasource or remove that persistence.xml if you don't need it.
-
5. Re: Trying to disable @EJB and @PersistentContext
rogerparkinson Oct 28, 2014 7:09 PM (in response to jaikiran)That is the case. The persistence.xml is inside a jar file I am dependent on, and I don't have control over.
Okay, well I can go with the edit of standalone.xml then, and I understand what is happening too.
Thanks
-
6. Re: Trying to disable @EJB and @PersistentContext
rogerparkinson Oct 30, 2014 10:16 PM (in response to rogerparkinson)I made more progress and I have it solved now. This is what I needed to do:
1) add metadata-complete="true" to the web-app tag in my web.xml file (as suggested by Jaikiran Pai). This suppresses instantiating beans I don't need.
2) add <subsystem name="jpa" /> to the exclusions in jboss-deployment-structures.xml. That suppresses the persistence.xml file triggering a database requirement.
3) I also added a dependency to hibernate.core because it complained about a missing org.hibernate.exception.SQLGrammarException
Now it loads with an unedited standalone.xml file