martes, 28 de octubre de 2014

SOA Suite 12c Quick Start's JDeveloper (12.1.3) not showing SOA options

Since 12c, you can no longer install SOA Suite extensions to a vanilla JDeveloper. The JDeveloper with SOA Suite 12c support is installed as part of the SOA Suite Quick Start installation for developers (fmw_12.1.3.0.0_soaqs_Disk1_1of1.zip).

After install it, I ran JDeveloper (C:\oracle\Middleware\SOASuite12c_1\jdeveloper\jdeveloper.exe in my case) but I couldn't find options to create SOA applications (New ApplicationApplications didn't show "SOA Application", "Service Bus Application", etc.).

The cause of this problem is that I once had other (non-SOA Suite 12c) JDeveloper installation and by default, both use the same user dir. This is documented in the official documentation (2 Installing Oracle SOA Suite Quick Start for Developers, 2.4.1 Setting the JDEV_USER_DIR Variable) which I see I didn't read quite carefully.

In order to run SOA's JDeveloper correctly, you may want to create a .cmd (or .sh) file that sets the JDEV_USER_DIR variable to a unique location before running JDeveloper, for example:

set JDEV_USER_DIR=D:\etc\jdeveloper_soa_12c
c:\oracle\Middleware\SOASuite12c_1\jdeveloper\jdeveloper.exe

Now you can see the SOA options in JDeveloper.



P.S.: once, I ran JDeveloper again without setting the variable and got an error that said something like "some extensions cannot be found" offering to "Disable and continue" or Exit. This is one of the unpredictable errors that may happen if you don't use an exclusive user dir (I forgot to take an screenshoot and it hasn't happen to me again).


miércoles, 15 de octubre de 2014

ClassCastException: org.apache.xerces.parsers.XIncludeAwareParserConfiguration redeploying Hibernate app in WebLogic


The following error occured after redeploying (updating) an app in WebLogic (which worked OK in the first deployment) and trying to use some persistence functionality:

Caused by: java.lang.ClassCastException: org.apache.xerces.parsers.XIncludeAwareParserConfiguration
at org.apache.xerces.parsers.SAXParser.(Unknown Source)
at org.apache.xerces.parsers.SAXParser.(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl.(Unknown Source)
at org.apache.xerces.jaxp.SAXParserFactoryImpl.newSAXParser(Unknown Source)
at org.apache.openjpa.lib.xml.XMLFactory.getSAXParser(XMLFactory.java:81)
at org.apache.openjpa.lib.meta.XMLMetaDataParser.parseNewResource(XMLMetaDataParser.java:352)
at org.apache.openjpa.lib.meta.XMLMetaDataParser.parse(XMLMetaDataParser.java:320)
at org.apache.openjpa.lib.meta.XMLMetaDataParser.parse(XMLMetaDataParser.java:296)
at org.apache.openjpa.lib.meta.XMLMetaDataParser.parse(XMLMetaDataParser.java:268)
at org.apache.openjpa.persistence.PersistenceProductDerivation$ConfigurationParser.parse(PersistenceProductDerivation.java:591)
at org.apache.openjpa.persistence.PersistenceProductDerivation.parseResources(PersistenceProductDerivation.java:368)
at org.apache.openjpa.persistence.PersistenceProductDerivation.load(PersistenceProductDerivation.java:333)
at org.apache.openjpa.persistence.PersistenceProductDerivation.load(PersistenceProductDerivation.java:162)
at org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:77)
at org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:109)
at org.apache.openjpa.persistence.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:53)
at javax.persistence.Persistence.createEntityManagerFactory(Unknown Source)
at javax.persistence.Persistence.createEntityManagerFactory(Unknown Source)
at com.acme.jpa.EntityManagerSinglenton.(EntityManagerSinglenton.java:14)
    ...

The problematic line is:

EntityManagerFactory emf = javax.persistence.Persistence.createEntityManagerFactory(this.unitPersistence);

The application developers want to use Hibernate. Their persistence.xml's declare org.hibernate.ejb.HibernatePersistence as the persistence units provider. They are including the Hibernate jars in the app (through a WebLogic shared library). WebLogic version is 12.1.1. Besides the following configuration, they don't have any other related configuration in the app:

<wls:prefer-application-packages>
    <wls:package-name>antlr.*</wls:package-name>
</wls:prefer-application-packages>

Taking advantage of the fact that they just want to use Hibernate and the stack trace shows OpenJPA classes, I included the following configuration in weblogic-application.xml:

<wls:prefer-application-resources>
    <wls:resource-name>META-INF/services/javax.persistence.spi.PersistenceProvider</wls:resource-name>
</wls:prefer-application-resources>

Warning: I'm in the process of validating if this is a "good" solution or just a "dirty" one (as probably is).