[JBoss jBPM] - Re: TaskInstance Problem
by anuragpaliwal
For some reason, jBPM stores bytes in block of 1024. Hence if your class file size is greater than 1024 bytes than it will break it in to multiple of 1024 and save it.
It seems you have just extracted 1 block only.
To fetch all the blocks of particular class file(if size is greater than 1024) you have to first fetch the ID_ of your class from the BYTEARRAY table and then use following query to get all the byte blocks of your class by putting the value of ID_ fetched earlier
select * from jbpm_byteblock where processfile_ = ?
I am just wondering tha there is another way to load class by using JBPM classloader(parent of process class loader) i.e by putting class file in WEB-INF/classes folder. I am not sure if it can do trick for you.
CHEERS!!!!!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4117820#4117820
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4117820
18 years, 3 months
[EJB 3.0] - Re: EJB 2.1 client adapters not working
by stfkbf
I have now corrected the code to follow the samples that come with the JBoss source code:
public interface TestBeanRemote {
| public int getId();
| }
|
| public interface TestBeanRemoteHome extends EJBHome {
| public TestBeanRemote create() throws CreateException, RemoteException;
| }
|
| @Stateful(name="TestBean")
| @Remote(TestBeanRemote.class)
| @RemoteHome(TestBeanRemoteHome.class)
| public class TestBean implements TestBeanRemote{
| ...
| }
Using the above code (and switching to 4.2.2.GA) the bean can now be created and business methods be called. However the remote interface does not extend EJBObject and hence the getHandle method is not available.
None of the samples that come with the JBoss source code illustrate how to get the serializable handle returned by getHandle. Is this a bug in the implementation? (as it seems the JBoss implementation differs from for instance the glassfish implementation)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4117819#4117819
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4117819
18 years, 3 months
[JBoss Seam] - ConcurrentModificationException
by tony.herstell@gmail.com
I have some markup:
| <f:view>
| <a4j:form styleClass="general_form">
|
| <fieldset class="general_form_fieldset">
|
| <legend class="general_form_legend">
| <h:outputText value="#{messages.booking_fieldset_resources}" />
| </legend>
|
| <s:validateAll>
| <div>
| <center>
| <rich:dataTable id="resourceAddedTable" var="eachResource" value="#{bookingResources}">
| <rich:column>
| <f:facet name="header">
| <h:outputText value="#{messages.booking_resource_column_header}" />
| </f:facet>
| <h:outputText value="#{messages[eachResource.inlLabel]}" />
| </rich:column>
| <rich:column>
| <f:facet name="header">
| <h:outputText value="#{messages.booking_action_column_header}" />
| </f:facet>
| <a4j:commandButton styleClass="general_form_button"
| action="#{bookingController.removeResource(eachResource)}"
| value="#{messages.general_button_remove}" type="submit" reRender="resourceAddedTable">
| </a4j:commandButton>
| </rich:column>
| </rich:dataTable>
| </center>
| </div>
|
| <div>
| <rich:messages id="resourceAdditionAttemptMessages" errorClass="error" warnClass="warn"
| infoClass="info" for="resourceAddedTable" />
| </div>
|
| <div>
| <br />
| </div>
|
| <div>
| <a4j:commandButton id="addResidentTrainer" value="#{messages.resource_resident_trainer}"
| action="#{bookingController.addResource('resource_resident_trainer')}"
| reRender="resourceAddedTable, resourceAdditionAttemptMessages" />
|
The table is simple updated by the back end when you click add.
When you click remove its supposed to remove the item from the list.
However.. I get
| Caused by: java.util.ConcurrentModificationException
| at java.util.AbstractList$Itr.checkForComodification(AbstractList.java:372)
| at java.util.AbstractList$Itr.next(AbstractList.java:343)
|
| @DataModel
| private List<ResourceKind> bookingResources;
|
| ...
|
| /* (non-Javadoc)
| * @see nz.co.selwynequestriancentre.action.booking.BookingController#addResource(java.lang.String)
| */
| public String addResource(String resource) {
| log.info(">addResource " + resource);
| ResourceKind resourceKind = resourceHelper.getResourceKind(resource);
| boolean isAlreadyAdded = false;
| for (ResourceKind eachExistingResourceKind : bookingResources) {
| if (resourceKind.getInlLabel().equalsIgnoreCase(eachExistingResourceKind.getInlLabel())) {
| facesMessages.addToControlFromResourceBundle("resourceAdditionAttemptMessages", FacesMessage.SEVERITY_ERROR, "booking_resource_already_added");
| isAlreadyAdded = true;
| }
| }
| if (!isAlreadyAdded) {
| bookingResources.add(resourceKind);
| }
| log.info("<addResource");
| return null;
| }
|
| /* (non-Javadoc)
| * @see nz.co.selwynequestriancentre.action.booking.BookingController#removeResource(nz.co.selwynequestriancentre.model.entity.Resource.ResourceKind)
| */
| public String removeResource(ResourceKind resourceKind) {
| for (ResourceKind eachExistingResourceKind : bookingResources) {
| if (resourceKind.getInlLabel().equalsIgnoreCase(eachExistingResourceKind.getInlLabel())) {
| bookingResources.remove(resourceKind);
| }
| }
| return null;
| }
| ...
|
Any ideas?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4117811#4117811
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4117811
18 years, 3 months
[EJB/JBoss] - Can I lock a table in a session bean?
by keithbannister
Hi,
I'm trying to create a session bean that checks the contents of a potential new record against a table before adding that record to the table. The table is a list of (funnily enough) hotel bookings. I want to make sure that the booking dates don't clash for a particular room. Because a booking has a start date and end date, it's not sufficient to have a compound primary key based on dates.
I'm using EJB3 on JBOSS 4
If I were doing it in normal java it would look something like:
| List<Booking> bookings = ....
| Object bookingLock = new Object();
|
|
| public void create(Boooking booking) {
| synchronized(bookingLock) {
| if (!roomBookedForInterval(booking)) {
| saveBooking(booking)
| }
| }
| }
|
| private boolean roomBookedForInterval(Booking booking) {
| for(Booking b : bookings) {
| if (b.endDate() > booking.startDate() ||
| b.startDate() < booking.endDate() ) {
|
| return true;
| }
| }
|
| return false;
| }
|
| private void saveBooking(Booking booking) {
| bookings.add(booking);
| }
|
|
|
My question is, what is the EJB3 equivalent of the synchronized{} block? IS it a transaction? If so, how does it work?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4117809#4117809
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4117809
18 years, 3 months
[EJB 3.0] - EJB 2.1 client adapters not working
by stfkbf
Hi
I have attempted to create an EJB with a remote home interface as follows:
public interface TestBeanRemote extends EJBObject {
| public int getId();
| }
|
| public interface TestBeanRemoteHome extends EJBHome {
| public TestBeanRemote create() throws CreateException, RemoteException;
| }
|
| public interface TestBeanEJB3 {
| public int getId();
| }
|
| @Stateful(name="TestBean")
| @Remote(TestBeanEJB3.class)
| @RemoteHome(TestBeanRemoteHome.class)
| public class TestBean implements TestBeanEJB3{
|
| private int id = 5;
|
| @Init
| public void create() throws CreateException, RemoteException{}
|
| public int getId() {
| return id;
| }
|
|
| }
Basically following the tutorials here:
https://glassfish.dev.java.net/javaee5/ejb/examples/Adapted.html
and here:
http://docs.jboss.org/ejb3/app-server/tutorial/ejb21_client_adaptors/ejb2...
This however results in the following exception (using JBoss 4.2.0.GA_CP01):
09:15:56,642 ERROR [STDERR] java.lang.IllegalStateException: Container null is not registered
| 09:15:56,642 ERROR [STDERR] at org.jboss.ejb3.Ejb3Registry.getContainer(Ejb3Registry.java:149)
| 09:15:56,642 ERROR [STDERR] at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:70)
| 09:15:56,642 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| 09:15:56,642 ERROR [STDERR] at org.jboss.ejb3.stateful.StatefulHomeRemoteProxy.invoke(StatefulHomeRemoteProxy.java:110)
| 09:15:56,642 ERROR [STDERR] at $Proxy105.create(Unknown Source)
| 09:15:56,642 ERROR [STDERR] at dk.services.TestService.test(TestService.java:36)
The code used to invoke the bean looks as follows:
TestBeanRemoteHome t;
| Context context = new InitialContext();
| t = (TestBeanRemoteHome) context.lookup("TestBean/home");
| tr = t.create();
The line that fails is the create call.
Am i doing something obvious wrong?
The reason for using EJB2.1 instead of EJB3 is that i need to obtain a EJB handle that can be returned by a web service. Serializing the EJB3 remote interface does not seem to work (see http://www.jboss.org/index.html?module=bb&op=viewtopic&t=73311).
Hope someone can help :)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4117808#4117808
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4117808
18 years, 3 months