[Persistence, JBoss/CMP, Hibernate, Database] - How to deploy EJB3 Entity Bean into PersistenceUnit dynamica
by emilrad
Hello,
I defined a persistence unit that manage various entity beans.
I need to find a way to deploy an entity bean into that persistence unit during runtime.
In other words, the Persistence Unit will load various entity beans at startup (as defined in persistence.xml),
but after startup, certain operations of the user would cause
the PersistenceUnit to mange additional entity beans.
One may ask, why I don't deploy everything from the begining,
and the answer is that these beans does not exist at that time.
My first try was to simply put the new generated class in the lookup directory and then redeploy the application
(touching application.xml within my code).
Indeed this cause the new entity bean to be deployed,
but then the application is down for certain time and all other clients lost their connection with the server.
Instead I'd like to write a method that will be called by the client (via session bean),
and will call an Hibernate/EJB3 methods that will hopefully "inject" another entity bean into the PersistenceUnit.
During that time other clients should be able use the application regulary.
The question is realy about how can I add Entity Beans to be manged by the Persistence Unit during runtime.
Thanks in advance.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3982367#3982367
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3982367
17Â years, 6Â months
[JBossCache] - Deadlock PojoCache.putObject()/org.apache.log4j.Category.cal
by dkapustin
Hi folks!
We are using JBossCache within JBoss for quite some time and encountered that it can freeze JBoss.
We have debugged one of such cases and discovered that there is deadlock which happens when the following conditions are met:
1. Aspectization for our POJOs is used
2. We add new element in a List field of a POJO
3. Concurrently there is some thread running within our app which simply logs via Log4j user activities
We found out that:
1. When our POJO's List field gets modified replication of corresponding TreeCache node starts. We could see that there is some marshalling process is executed recursively according to "object cache by reachability".
2. During the marshalling the cache even tries to marshall GmsImpl object with NON static field log which also gets marshalled. So, org.apache.log4j.Category.aai.appenderList.writeObject(...) gets invoked (actually, the category is the root category). Please note that this method is synchronized. Later within the same call chain some fatal error happen and the cache tries to log it and reaches Category.callAppenders() where synchronizes on root category.
At this point the active thread acquired two locks: a) Vector's Category.aai.appenderList and b) Category's root instance
3. Concurrently, our user activity logging thread tries to log as well. Here the locks are acquired in the opposite way which results in deadlock.
Looks like something goes wrong here :)
First, why GmsIml.log field is not static?
Second, could it be a reasult of JBossCache misuse from our side?
Thanks in advance for quite long reading :)
Best regards,
Dmitry.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3982362#3982362
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3982362
17Â years, 6Â months
[JBoss jBPM] - Assigning to one of many elements (maxOccurs="unbounded")
by miket
I've just started to investigating the JBoss jBPM/BPEL piece (so please excuse me if my use of the terminology is a little flaky) and I'm trying to adapt it to work with the following complex message type (SWMSubmission):
| <types>
|
| <schema targetNamespace="urn:samples:swmessage" xmlns="http://www.w3.org/2001/XMLSchema">
|
| <complexType name="SWMKeyValuePair">
| <sequence>
| <element name="swmName" type="xsd:string" minOccurs="1" maxOccurs="1"/>
| <element name="swmValue" type="xsd:string" minOccurs="1" maxOccurs="1"/>
| </sequence>
| </complexType>
|
| <complexType name="SWMSubmission">
| <sequence>
| <element name="swmEventName" type="xsd:string" minOccurs="1" maxOccurs="1"/>
| <element name="swmEventData" type="typ:SWMKeyValuePair" minOccurs="1" maxOccurs="unbounded"/>
| </sequence>
| </complexType>
|
| </schema>
|
| </types>
|
In my bpel process document I declare a variable:
| <variable name="swmSubmission" messageType="swm:swmSubmission" />
|
and attempt to assign values to it:
| <assign name="fillSWMessage">
| <copy>
| <from variable="balanceChange" part="customerName" />
| <to variable="swmSubmission" part="body"
| query="/body/swmEventName" />
| </copy>
| <copy>
| <from variable="balanceChange" part="customerName"/>
| <to variable="swmSubmission" part="body"
| query="/body/swmEventData[1]/swmName" />
| </copy>
| <copy>
| <from variable="balanceChange" part="customerName" />
| <to variable="swmSubmission" part="body"
| query="/body/swmEventData[1]/swmValue" />
| </copy>
| </assign>
|
When fully deployed and the service invoked I get an error. If I remove the parts of the 'assign' that access the (possible) multiple elements then everything works:
| <assign name="fillSWMessage">
| <copy>
| <from variable="balanceChange" part="customerName" />
| <to variable="swmSubmission" part="body"
| query="/body/swmEventName" />
| </copy>
| </assign>
|
so I'm assuming I've made some basic error in my use of this complex type somewhere. The error I get is shown below:
| 2006-11-01 10:47:00,462 DEBUG [org.jboss.ws.server.ServiceEndpoint] Outgoing SOAPMessage
| <env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>
| <env:Header/>
| <env:Body>
| <env:Fault>
| <faultcode>env:Server</faultcode>
| <faultstring>The service is not in an appropiate state for the requested operation</faultstring>
| </env:Fault>
| </env:Body>
| </env:Envelope>
| 2006-11-01 10:47:00,462 ERROR [org.jboss.ws.server.ServiceEndpoint] Cannot process metrics
| java.lang.ClassCastException: org.jboss.ws.soap.SOAPBodyElementDoc
| at org.jboss.ws.soap.SOAPBodyImpl.getFault(SOAPBodyImpl.java:121)
| at org.jboss.ws.server.ServiceEndpoint.handleRequest(ServiceEndpoint.java:262)
| at org.jboss.ws.server.ServiceEndpointServlet.doPost(ServiceEndpointServlet.java:120)
| at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
| at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
| at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
| at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
| at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
| at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
| at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
| at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
| at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
| at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
| at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
| at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
| at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
| at java.lang.Thread.run(Thread.java:595)
|
|
but this seems to be the response to any kind of problem (in fact I get this error intermittently using the tutorial as boxed).
I wasn't sure whether indexing of swmEventData should start at 0 or 1 so I tried them both with no joy. Is there some sort of intialisation I should be doing? Any help would be appreciated.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3982360#3982360
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3982360
17Â years, 6Â months