Error when running a bpel process in ode - eclipse

I'm trying to learn to work with bpel. I choose Eclipse Bpel Designer and apache ode (on a tomcat server) in order to experiment. The process I tried to model was a loan process. It has 3 services: a creditRate service (written in eclipse bpel designer and deployed befo-hand an tested that it works), a currency converter service, and the main orchestration process. While I had no errors on deployment when testing the web service from eclipse following errors occur:
ERROR [ExternalService] Error sending message to Axis2 for ODE mex
{PartnerRoleMex#hqejbhcnphr87mcnd0np43 [PID
{CreditBuletinNamespace}CreditBuletin-137] calling
org.apache.ode.bpel.epr.WSAEndpoint#a64453.getRating(...) Status
REQUEST} org.apache.ode.axis2.OdeFault: Binding operation not found:
service {http://www.webserviceX.NET/}CurrencyConvertor port
CurrencyConvertorSoap name getRating. at
org.apache.ode.axis2.util.SoapMessageConverter.createSoapRequest(SoapMessageConverter.java:154)
and
Failure during invoke: Error sending message to Axis2 for ODE mex
{PartnerRoleMex#hqejbhcnphr87mcnd0np43 [PID
{CreditBuletinNamespace}CreditBuletin-137] calling
org.apache.ode.bpel.epr.WSAEndpoint#a64453.getRating(...) Status
REQUEST} 21:09:14,421 INFO [BpelRuntimeContextImpl] ActivityRecovery:
Registering activity 19, failure reason: Error sending message to
Axis2 for ODE mex {PartnerRoleMex#hqejbhcnphr87mcnd0np43 [PID
{CreditBuletinNamespace}CreditBuletin-137] calling
org.apache.ode.bpel.epr.WSAEndpoint#a64453.getRating(...) Status
REQUEST} on channel 33
Can someone help me out with a solution? I have searched for some solution but have not found one that works. It may be that due to my poor knowledge I am not searching right or not doing something right. Because this description may be confusing I have attached my solution because I believe they will tell more of what I'm trying to do and how wrong I am doing it. http://www.mediafire.com/?9bjgt44spln1zwr
Thank-you in advance
EDIT: after doing an iterative approach (as sugested in the first answer) it seems that the external conversion service was not responding from ode. This is strange because the service worked from the browser and no error was reported when deplying. Again because of my poor knowledge I believe code speaks better than my phrasing. I have made an eclipse project just with the external currency convertor. Any help / guidance is heartly appreciated. Thank you in advance. http://www.mediafire.com/?56csca1qgt5ka9a

Your CreditRating process works fine, the error lies in the CreditBuletin process. When I test this one with soapUI, I get a selectionFailure. This error in BPEL tells you that something is wrong with a from or to in your process.
To outline the problem here is a very simplified version of the activities of your CreditBuletin process, reduced to just the initial receive, the final reply and one of your assign activities inbetween. You can paste this into the main sequence of your process to reproduce the problem.
<bpel:receive name="receiveInput" partnerLink="clientInput" operation="getLoan" portType="tns:CreditBuletinPT" variable="receiveInput" createInstance="yes"></bpel:receive>
<bpel:assign validate="no" name="AssignFinal">
<bpel:copy>
<bpel:from>
<bpel:literal>
<tns:SumaRON xmlns:tns="CreditBuletinNamespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<output>0</output>
</tns:SumaRON>
</bpel:literal>
</bpel:from>
<bpel:to variable="outputResult" part="parameters"></bpel:to>
</bpel:copy>
<bpel:copy>
<bpel:from>
<![CDATA[$loanWithInterest * bpel:getVariableData('CurrencyRateInputResponse','parameters','ConversionRateResult')]]>
</bpel:from>
<bpel:to part="parameters" variable="outputResult">
<bpel:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0">
<![CDATA[output]]>
</bpel:query>
</bpel:to>
</bpel:copy>
</bpel:assign>
<bpel:reply name="outputResult" partnerLink="clientInput" operation="getLoan" portType="tns:CreditBuletinPT" variable="outputResult"></bpel:reply>
You are trying to assign the same variable twice, first with a default initialization. This doesn't make much sense, but for some reason the BPEL editor generates these initializations on default. You get a correct reply, if you change the from statement in the second copy to something else, for instance
<![CDATA[bpel:getVariableData('receiveInput','parameters','suma')]]>
So, your problem(s) come(s) from your from statements, most likely the ones that use the getVariableData() function. Now, I don't want to repair all expressions in your process (because there are many and that is your task), but I suggest to have a look at all of them. Start with a minimal working process, such as the one above with the from exchanged and do incremental updates of functionality while testing each increment. That way, you will eventually end up with something that works.

Related

Vertx Form Login Handler with Postgresql Failure

I am trying to authenticate user using FormLoginHandler and Postgresql Database with SqlAuthentication.
But I get the following error:
Jun 15, 2022 1:14:34 PM io.vertx.ext.web.RoutingContext
SEVERE: Unhandled exception in router
io.vertx.ext.web.handler.HttpException: Unauthorized
Caused by: io.vertx.core.impl.NoStackTraceThrowable: Invalid username/password
I am providing the right credentials.
The code snippet is:
SqlAuthenticationOptions sauthopts = new SqlAuthenticationOptions();
sauthopts.setAuthenticationQuery(AUTHENTICATE_QUERY);
SqlAuthentication authenticationProvider = SqlAuthentication.create(sqlClient, sauthopts);
router.route("/secure/*").handler(RedirectAuthHandler.create(authenticationProvider, "/login.html"));
FormLoginHandler formLoginHandler = FormLoginHandler.create(authenticationProvider);
router.route("/loginhandler").handler(formLoginHandler);
Please let me know if I am missing something here; or point me to a sample example.
Thanks in Advance.
Your setup doesn't show anything abnormal at first sight. For security reasons, we cannot "just" log the authentication data, as it would be a critical OWASP bug and security vulnerability.
My best guess is that probably is something not totally correct with the query, so this means you have now 2 options:
debug the application and see the query that is being sent + the arguments
prepare a small complete example that shows the bug and open an issue in vert.x so we can debug it further.
If you're upgrading from an older version, be aware that in vert.x 4.2.0 some changes were made to the base64 encoding to keep it consistent across modules. This could be a reason why authentication could fail as the encoded hashes may be slightly different. If you're just doing 4.3.0 from the start, then this would not be a problem.

Eclipse, Tomcat, Jersey /JAXB: Hot redeployment problems

I'm using a setup specified in the title. Nothing unusual.
Many times (almost always), after saving a file (HTML or JS! Not even Java!), and re-loading the webpage hosted on this Tomcat (which uses Jersey & Jaxb etc), I get a bunch of:
Apr 10, 2014 12:52:23 PM com.sun.jersey.spi.container.ContainerResponse logException
SEVERE: Mapped exception to response: 500 (Internal Server Error)
javax.ws.rs.WebApplicationException: javax.xml.bind.JAXBException - with linked exception:
[java.io.FileNotFoundException: ... loader/META-INF/services/javax.xml.bind.JAXBContext (No such file or directory)]
at com.sun.jersey.core.provider.jaxb.AbstractRootElementProvider.writeTo(AbstractRootElementProvider.java:159)
What have I done to deserve this? :-)
The implication is that I have to stop, and re-start Tomcat every time, and that wastes a lot of time.
PS
'Automatic publish after build event' = true
module--> auto reload = false
I spent hours trying to solve this, googling the hell out of these terms, and getting back a lot of irrelevant stuff.
Thank you!

Migrating JMS Queue from Hypersonic to MSSQL

I am currently trying to replace Hypersonic with MS-SQL 2008 R2 in JBoss AS 5.1.0GA.
I have followed the instructions in the JBoss Server Configuration Guide, however the server fails to load with this error:
2013-09-26 17:06:04,479 WARN [org.jboss.resource.adapter.jms.inflow.JmsActivation] (WorkManager(2)-3) Failure in jms activation org.jboss.resource.adapter.jms.inflow.JmsActivationSpec#8bb1eb(ra=org.jboss.resource.adapter.jms.JmsResourceAdapter#c54851 destination=queue/iam/im/jms/queue/wpUtilQueue destinationType=javax.jms.Queue tx=true durable=false reconnect=10 provider=DefaultJMSProvider user=null maxMessages=1 minSession=1 maxSession=15 keepAlive=30000 useDLQ=true DLQHandler=org.jboss.resource.adapter.jms.inflow.dlq.GenericDLQHandler DLQJndiName=queue/DLQ DLQUser=null DLQMaxResent=10)
javax.naming.NameNotFoundException: DLQ not bound
(I left out the stack trace for brevity; it isn't important.)
I have checked, and DLQ is defined in destinations-service.xml
I'm not sure where to proceed from here; every response I can find on Google seems to suggest that defining the queue in destinations-service.xml has solved the issue for almost everyone.
Any help would be appreciated.
It turns out that the instructions in the Configuration Guide aren't 100% complete. The issue was that a ChannelFactory was referenced in the mssql-persistence-service.xml; however, this environment is not clustered, and so there were no ChannelFactory objects defined.
Removing the reference to the ChannelFactory was sufficient to resolve the issue.

Atmosphere Jersey - Server messages

Is it possible to let the server send messages to all connected clients without waiting for any action from them? Let me explain it :-) I've been reading the docs/examples and I have found nothing that satifies my needs: the flow is always the same; a client connects (e.g: a GET call to a Rest API), the connection is suspendend and until a new API call is received (e.g.: a POST call) the server simply waits (or at least this is what I have understood). My use case is pretty different: I want the server to send some "notifications" once new data become available. This would be my use case (pretty simplifed):
Client A connects to server
Connection is suspended since no new data is available at the moment
The server gets notified new data is available from an external
source and broadcasts it to client A
Go to step 2
What I have achieved so far is getting the connection successfully established. The next step is to solve this server issue. I must say this technology is completely new to me so it is possible I misunderstood how something works. If that's the case, let me know!
This is my stack:
Spring 3.2.0 RELEASE
Jersey 1.8
Atmosphere Jersey 1.0.13
Tomcat 7.0.40
Thank you all in advance!
UPDATE: After following this I get this warning, which I have no idea how to get rid of:
2013-06-04 09:40:36,284 WARN [org.atmosphere.cpr.AtmosphereFramework] - Failed using comet support: org.atmosphere.container.Tomcat7AsyncSupportWithWebSocket, error: Tomcat failed to detect this is a Comet application because context.xml is missing or the Http11NioProtocol Connector is not enabled.
If that's not the case, you can also remove META-INF/context.xml and WEB-INF/lib/atmosphere-compat-tomcat.jar Is the Nio or Apr Connector enabled?
2013-06-04 09:40:36,285 WARN [org.atmosphere.cpr.AtmosphereFramework] - Using org.atmosphere.container.Tomcat7BIOSupportWithWebSocket
I followed the app structure commented here, so this should not be a problem. I have noticed that by changing the transport to "websocket" instead of "long-polling" shows no errors. The server finally sends data tough :)
I followed your link and modified the code a little.
When you are in the step 3 "The server gets notified new data is available from an external source and broadcasts it to client A", you have to write a line like this:
BroadcasterFactory.getDefault().lookup("/*").broadcast(response);
At first I used the TextMessage received from my ActiveMQ Queue but I get this error, so I used a Jackson class as an object response and everything worked fine.
SEVERE: A message body writer for Java class org.apache.activemq.command.ActiveMQTextMessage, and Java type class org.apache.activemq.command.ActiveMQTextMessage, and MIME media type application/json was not found
jun 03, 2014 11:32:21 AM com.sun.jersey.spi.container.ContainerResponse write
SEVERE: The registered message body writers compatible with the MIME media type are:
application/json (JSONJAXBElementProvider, JSONArrayProvider, JSONObjectProvider, JSONRootElementProvider, JSONListElementProvider, ...)

Attaching Apache HTTP Client to RESTlet client

I'm using RESTlet as Server and Client. Server is running over Tomcat and I can access it from browser.
For Client, I'm using org.restlet.resource.ClientResource. It works fine if I send a few requests to that server, but if I send a few hundred calls it breaks:
Fev 20, 2013 12:59:43 PM org.restlet.engine.connector.ClientConnectionHelper start
INFO: Starting the internal [HTTP/1.1] client
(some calls work)
Fev 20, 2013 1:00:49 PM org.restlet.util.SelectionRegistration block
WARNING: The thread blocked at the cyclic barrier has timed out
java.util.concurrent.TimeoutException
at java.util.concurrent.CyclicBarrier.dowait(CyclicBarrier.java:250)
at java.util.concurrent.CyclicBarrier.await(CyclicBarrier.java:427)
at org.restlet.util.SelectionRegistration.block(SelectionRegistration.java:191)
at org.restlet.engine.io.NbChannelInputStream.onFill(NbChannelInputStream.java:230)
at org.restlet.engine.io.Buffer.process(Buffer.java:601)
at org.restlet.engine.io.NbChannelInputStream.read(NbChannelInputStream.java:307)
at java.io.InputStream.read(InputStream.java:101)
at org.restlet.engine.io.BioUtils.copy(BioUtils.java:80)
at org.restlet.engine.io.NioUtils.copy(NioUtils.java:147)
at org.restlet.representation.ReadableRepresentation.write(ReadableRepresentation.java:104)
at org.restlet.representation.ChannelRepresentation.write(ChannelRepresentation.java:76)
at org.restlet.representation.ChannelRepresentation.write(ChannelRepresentation.java:82)
Exception in thread "main" java.io.IOException: The thread blocked at the cyclic barrier has timed out.
at org.restlet.util.SelectionRegistration.block(SelectionRegistration.java:197)
at org.restlet.engine.io.NbChannelInputStream.onFill(NbChannelInputStream.java:230)
at org.restlet.engine.io.Buffer.process(Buffer.java:601)
at org.restlet.engine.io.NbChannelInputStream.read(NbChannelInputStream.java:307)
at java.io.InputStream.read(InputStream.java:101)
at org.restlet.engine.io.BioUtils.copy(BioUtils.java:80)
at org.restlet.engine.io.NioUtils.copy(NioUtils.java:147)
at org.restlet.representation.ReadableRepresentation.write(ReadableRepresentation.java:104)
at org.restlet.representation.ChannelRepresentation.write(ChannelRepresentation.java:76)
at org.restlet.representation.ChannelRepresentation.write(ChannelRepresentation.java:82)
Caused by: java.util.concurrent.TimeoutException
at java.util.concurrent.CyclicBarrier.dowait(CyclicBarrier.java:250)
at java.util.concurrent.CyclicBarrier.await(CyclicBarrier.java:427)
at org.restlet.util.SelectionRegistration.block(SelectionRegistration.java:191)
... 11 more
I wanna use Apache HTTP Client to be able to do more calls, but I can't find documentation on how to attach it.
I had the same problem but on a live production machine which caused my server to eat up 100% of CPU. I was able to solve it by going back to using restlet 2.1.0 instead of 2.1.2. Not really an answer to the underlying problem, but definitely a solution.
Every evidence points this error to be internal in RESTlet client. Instead of using it, I used URL.getInputStream(), and with that I was able to easily do 10K sequential calls to my RESTlet server. Of course URL is way simple, it's unable to handle errors and shouldn't be used in production, but it proved RESTlet isn't worth it.
I also managed to make Benchmark comparing Axis2 and RESTlet as server, and they had same performance taking 3-5 milisecs to answer a request, I expected REST to be faster... I implemented REST server directly from Servlet and it too 0-1 milisecs to respond. Because of that I decided to drop REST and stick with SOAP Axis2, it's not slower than RESTlet and just a few milisecs slower than Servlet, but it way more flexible and powerful.