Page 1 of 1

BroadLeaf and Glassfish

Posted: Mon Mar 28, 2011 8:17 pm
by idont
I have been working as you know trying to get BroadLeaf up and running, I took a break. I now realize some of my issues are actually GlassFish related. For instance, I had to change the transaction type of blPU and blSecurePU from "RESOURCE_LOCAL" to "JTA"; otherwise, Glassfish would not work. I now notice that similarly there are errors in regard to Date Columns not being marked in regard to being Temporal (see error below)....

I am curious should I simply change all this core code myself, or will this be released soon as a fix in soon to come versions? Is there any plan to make this project available to a GlassFish Server Implementation?

Btw, The error that I have seen is as follows (though it is likely applicable to every EJB without the @Temporal annotation, which I think is standard notation now):

SEVERE: Exception while invoking class org.glassfish.persistence.jpa.JPADeployer prepare method
javax.persistence.PersistenceException: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.0.1.v20100213-r6600): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Predeployment of PersistenceUnit [blSecurePU] failed.
Internal Exception: Exception [EclipseLink-7212] (Eclipse Persistence Services - 2.0.1.v20100213-r6600): org.eclipse.persistence.exceptions.ValidationException
Exception Description: The attribute [reivewSubmittedDate] from the entity class [class org.broadleafcommerce.rating.domain.ReviewDetailImpl] does not specify a temporal type. A temporal type must be specified for persistent fields or properties of type java.util.Date and java.util.Calendar.
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:991)
at org.eclipse.persistence.jpa.PersistenceProvider.createContainerEntityManagerFactory(PersistenceProvider.java:202)
at org.glassfish.persistence.jpa.PersistenceUnitLoader.loadPU(PersistenceUnitLoader.java:181)
at org.glassfish.persistence.jpa.PersistenceUnitLoader.<init>(PersistenceUnitLoader.java:96)
at org.glassfish.persistence.jpa.JPADeployer.prepare(JPADeployer.java:121)
at com.sun.enterprise.v3.server.ApplicationLifecycle.prepareModule(ApplicationLifecycle.java:644)
at org.glassfish.javaee.full.deployment.EarDeployer.prepareBundle(EarDeployer.java:269)
at org.glassfish.javaee.full.deployment.EarDeployer.access$200(EarDeployer.java:79)
at org.glassfish.javaee.full.deployment.EarDeployer$1.doBundle(EarDeployer.java:131)
at org.glassfish.javaee.full.deployment.EarDeployer$1.doBundle(EarDeployer.java:129)
at org.glassfish.javaee.full.deployment.EarDeployer.doOnBundles(EarDeployer.java:197)
at org.glassfish.javaee.full.deployment.EarDeployer.doOnAllTypedBundles(EarDeployer.java:206)
at org.glassfish.javaee.full.deployment.EarDeployer.doOnAllBundles(EarDeployer.java:235)
at org.glassfish.javaee.full.deployment.EarDeployer.prepare(EarDeployer.java:129)
at com.sun.enterprise.v3.server.ApplicationLifecycle.prepareModule(ApplicationLifecycle.java:644)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:296)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:183)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:272)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:305)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:320)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1176)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$900(CommandRunnerImpl.java:83)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1235)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1224)
at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:365)
at com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:204)
at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:166)
at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:100)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:245)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
at java.lang.Thread.run(Thread.java:637)

Re: BroadLeaf and Glassfish

Posted: Tue Mar 29, 2011 10:04 am
by idont
I have been working on trying to make the code ready for GlassFish, so far I have changed quite a few classes:

@Temporal
org.broadleafcommerce.catalog.domain.BasePriceImpl
org.broadleafcommerce.offer.domain.OfferImpl
org.broadleafcommerce.catalog.domain.CategoryImpl
org.broadleafcommerce.content.domain.ContentImpl
org.broadleafcommerce.offer.domain.OfferCodeImpl
org.broadleafcommerce.order.domain.OrderImpl
org.broadleafcommerce.catalog.domain.ProductImpl
org.broadleafcommerce.rating.domain.RatingDetailImpl
org.broadleafcommerce.rating.domain.ReviewDetailImpl
org.broadleafcommerce.inventory.domain.SkuAvailabilityImpl
org.broadleafcommerce.catalog.domain.SkuImpl
org.broadleafcommerce.marketing.domain.TargetContentImpl

@Embeddable
org.broadleafcommerce.media.domain.CategoryMediaMapPK
org.broadleafcommerce.catalog.domain.CategoryXref





But I am a little stuck here.... Because to make CategoryXref to work, CategoryXrefPK must be declared with @Embeddable, but it is referenced as an @EmbeddableId; however, @EmbeddableId does not allow for complex annotations like joins, changing it from @EmbeddableId to a simple embedded object of course makes CategoryXref no longer have any id to itself.

I guess I am a little over my head here in regard to Hibernate and EJBs in this framework. Any advice of how to solve this issue and make it Glassfish ready?

The error:
Exception Description: The mapping [category] from the embedded ID class [class org.broadleafcommerce.catalog.domain.CategoryXrefPK] is an invalid mapping for this class. An embeddable class that is used with an embedded ID specification (attribute [categoryXrefPK] from the source [class org.broadleafcommerce.catalog.domain.CategoryXref]) can only contain basic mappings. Either remove the non basic mapping or change the embedded ID specification on the source to be embedded.

Re: BroadLeaf and Glassfish

Posted: Tue Mar 29, 2011 7:47 pm
by idont
I really do need help.... I cannot seem to solve this otherwise....

Re: BroadLeaf and Glassfish

Posted: Thu Mar 31, 2011 6:06 am
by jefffischer
I think this is what you're looking for. The trick I think is to get Glassfish to use Hibernate as the JPA provider instead of its own internal JPA provider. Take a look at this link:

http://blogs.sun.com/GlassFishPersisten ... a_provider

Of course, once you've made this change, If I were you I would try to see if Broadleaf back in its original state (before your changes) works, as you should no longer be battling the default JPA provider.