Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!

Gerben Feenstra

Greenhorn
+ Follow
since Feb 21, 2011
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Gerben Feenstra

Hello,

I made a (custom) ww_verify_function to attach to a profile of users. It is based on one provided by Oracle and it's only slightly modified here and there. The errorhandling is untouched, so this is all 'vanilla'.
For those who don't know, the code does all kinds of checks on a newly entered password. For instance the minimum length of the password.
If it is not correct it raises:




Now, on the other end inside the application we have a (headstart?) form, QMS0004F that allows the user to change their password. The way this form does this is through a forms_dll call:


(This will trigger the ww_verify_function in the background and verify the entered password. I know the checks work, because I have tested them.)


After that the form does a check on form_success:



However, the user never sees the raise_application_error from the ww_verify_function, only the above messages. Password change either succeeded or it didn't.



How do I show the raise application error to the user, so they know what is wrong in their new password?

I figured the raised application errors would end up on an errorstack, so I searched some and tried getting them from the errorstack:





But nothing returned. Then I examined the cg$errors package some more, and found:





Nothing again. But this gave me the idea to do a little test with:




Now, if I modify my ww_verify_function and push an errormessage on the stack, I can 'pop' them in the form to present them to the user. This seems to work, but I am not at all sure this would be the right way to do it.
Or is it?...


Can anybody explain to me what would be the correct way to show the user the raised_application_error?
2 years ago
So, I found out something. If this is the solution, I'm not expecting any feedback from our customer and I will probably forget all about this post, so here's my findings for future reference and/or for anyone with a similar problem:

Although the checkbox (under timezone settings) for "Adjust to Daylight Saving Time" does not seem to do anything in wintertime (Which is standard time), it does seem to be having effect on my problem. I am able to reproduce the problem once again depending on wether the checkbox is on or off. I gave this information to our customer, but as usual I'll probably hear little from them if this is indeed the solution...
5 years ago
I'd say that chance is pretty slim, since my country is entirely in one timezone, so their timezone must be the same as mine, and the date comes from the same DB, so same timezone.
I do not think the problem is with the db (sql date) since it comes out trunced, plus many other locations report no problems on the same data.
5 years ago
Thank you for your analysis Winston. I have in fact tried this myself (Changing the timezone from +1:00 to 0:00), and it is the only way I can reproduce this problem on my local machine here. I figured since java dates always has a time (since java data is based on milliseconds from epoch), the trunced sql date will end up being at midnight, the first millisecond of that date sorta speak. When the timezone differs -1, it will become 23:00 (11PM) the previous day, so the date ends up displayed as the day before.

So, yes, timezone difference can cause this same problem.

However, the people I am dealing with here ensure me their timezones are set correctly :S
Not sure how credible this response is though...
5 years ago
This piece of java software I am responsible for is running throughout numerous locations in my country, there is only 1 location which has trouble with the dates being displayed incorrectly, birthdates of clients are displayed as a day earlier. It seems pretty safe to say it is a problem on their end... But still, they're asking me for an explanation as to why java would treat a date differently in this rare case.

The date (a birthdate) comes from an oracle database, it is a date without a time (trunced date). It enters the application as a member of the client-class, it is NOT being set or changed after that. It goes through several layers in the application, then ends up in a GUI class which unwraps it from the "client"-object and puts a SimpleDateFormat (new SimpleDateFormat("dd-MM-yyyy")) on it.

My first and only hunch was the timezone settings, but that seems to be OK!

Does anyone here have any clue as to what might cause this strange behaviour?

5 years ago
Got 2 webservices running on Weblogic 12c.

Both needed conversion from oracle EnterpriseManager/java6 to Java 7.

One (Let's call it webapp A) got converted pretty easy using Jdeveloper 12c, the other one (Webapp B) I converted to a java 7 Maven-project on Eclipse Kepler. (Don't ask me why, long story short: it didn't work on jdev...)

Anyways, both A and B use the same defined datasource on the weblogic container, both using pretty much the same code to retrieve the datasource.

It is working great for app A, but gives a class-cast exception on app B, and I can't seem to figure out why



This is pretty much the same code I use to get to my Connectionfactory and JMS queue's, which seems to work just fine...
The datasource name is correct, if I use anything else it fails alltogether. So, appaerantly it does find 'something', but of another type.

I can not really find an answer when I google this. I did read somewhere JDBC driver might be missing, so included oracle's thin client on my classpath (ojdbc7.jar). => Nothing

I am using apache CXF, if that matters... Not sure... It needs spring components, so there is an applicationContext.xml where I fiddled around with.
Found somewhere on google, so tried adding this. But it did not do the trick, and to be honoust, I have no clue what I'm doing here...



Is there anyone here who has a clue about what is happening here? Is there anyone who can explain to me how this stuff is supposed to work?
I'm not really into this java "magic" stuff... The InitContext for instance, how does it get the context from the server, while I am the one instantiating it with InitialContext initContext = new InitialContext() ?



Stacktrace:


Jan 30, 2014 11:54:50 PM org.apache.cxf.phase.PhaseInterceptorChain doDefaultLogging WARNING: Application {urn:hl7-org:v3}VaccinatiesOpvragen_Service#{urn:hl7-org:v3}VaccinatiesOpvragen_QueryResponse has thrown exception, unwinding now org.apache.cxf.interceptor.Fault: weblogic.jndi.internal.WLEventContextImpl cannot be cast to javax.sql.DataSource at org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:162) at org.apache.cxf.jaxws.AbstractJAXWSMethodInvoker.createFault(AbstractJAXWSMethodInvoker.java:213) at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:128) at org.apache.cxf.jaxws.AbstractJAXWSMethodInvoker.invoke(AbstractJAXWSMethodInvoker.java:178) at org.apache.cxf.jaxws.JAXWSMethodInvoker.invoke(JAXWSMethodInvoker.java:68) at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:75) at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37) at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:107) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272) at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121) at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:239) at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:248) at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:222) at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:153) at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:167) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:286) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:206) at javax.servlet.http.HttpServlet.service(HttpServlet.java:751) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:262) at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:280) at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:254) at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:136) at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:341) at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:238) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3363) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3333) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321) at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120) at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:57) at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2220) at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2146) at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2124) at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1564) at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:254) at weblogic.work.ExecuteThread.execute(ExecuteThread.java:295) at weblogic.work.ExecuteThread.run(ExecuteThread.java:254) Caused by: java.lang.ClassCastException: weblogic.jndi.internal.WLEventContextImpl cannot be cast to javax.sql.DataSource at nl.ordina.service.DbHandler.createConnection(DbHandler.java:444) at nl.ordina.service.DbHandler.<init>(DbHandler.java:74) at nl.ordina.service.DbHandler.instance(DbHandler.java:89) at nl.ordina.service.Verwerking.legVastInDB(Verwerking.java:421) at nl.ordina.service.Verwerking.verwerkBericht(Verwerking.java:143) at nl.ordina.service.VaccinatiesOpvragenProvider.invoke(VaccinatiesOpvragenProvider.java:62) at nl.ordina.service.VaccinatiesOpvragenProvider.invoke(VaccinatiesOpvragenProvider.java:1) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:180) at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96) ... 36 more



5 years ago
Same problem here, have not found a permanent solution yet. Workaround I found: Go to java console and set "Perform certificate revocation checks on" to "Do not check (not recommended)"
5 years ago
I found another way to get things working. My initial JNDI-problem however was solved by using...



... instead of setting Context.PROVIDER_URL.

Also, the only way I got things working at all is using a dependency on glassfish-embedded-all, which is a 35MB Jar. Which sounds kind of insane to me, considering I only want to sent simple text-messages to a queue. How hard can that be? Communication with code running outside a container is a major flaw in JEE in my opinion.

Anyways, thanks for the help.
Problems solved, thread closed.
Follow up on this thread: https://coderanch.com/t/594339/EJB-JEE/java/JMS-client-only-outside-container

I've got 2 laptops here, running next to eachother, connected to the same network switch. One is running an almost default instance of glassfish 3x, the other is running a client OUTSIDE of the container comprised of only a few lines of code to get a connectionFactory from the Glassfish server.
Running both on the same machine works like a charm now, but when ran on different machines it refuses to connect, and my head-ache is now getting worse by the minute...

Server side:
============
Running inside Netbeans IDE 7.2

GlassFish Server version: 3+
JMS Service Type: LOCAL (instead of EMBEDDED)
Created javax.jms.QueueConnectionFactory named "TapServiceConnectionFactory" under JMS Resources.

Glassfish configuration is otherwise untouched (I've fooled around lots, so created a clean glassfish instance for this example):

Startup log:



ClientSide:
===========

Simple maven application containing 1 class with a main-method:



POM.XML:



This is what happens if my glassfish server is running and the client is started:



Also not very sure which port to use, 3700 (JMS) or 7676 (IIOPS), however, I've tried both, but both fail.
I'm out of ideas :/
I found this example:


Then I should be able to get the connectionFactory from the context with this:

and the queue:

But I don't know what values to use in the properties to connect to my glassfish container. What type of InitialContextFactory should I use? What protocol should I use? vm:// or tcp://, or something else?

I tried using com.sun.enterprise.naming.SerialInitContextFactory and the url: iiop://127.0.0.1:17294
But then I get an Exception:



This is driving me crazy. How hard can it be to remotely connect to a queue and put a message on it?
Hello,

I have a standalone desktop application 'A' which needs to send messages to remote application 'B' running inside a JEE container. Application B has a JMS-queue to recieve messages. Application A should have minimal changes, and for Application B I have no access to functionality or source code whatsoever.

So the plan is to make a jar-library which can be used by creating a single call with some parameters to it from within Application A. The library should put messages on the queue in Application B.

I followed the Java EE 5 tutorial from oracle, in particular the part about JMS that has a 'server' (earthmdb demo) and a client (jupiterclient demo) running separately (http://docs.oracle.com/javaee/5/tutorial/doc/bnchx.html). I use the 'server' to mimic Application B so I can test my code. It is a simple class implementing the MessageListener interface and an onMessage() method. This is working just fine; I see messages get send from the client-application and they're being received in the onMessage() method correctly.

However, they both run inside the same Glassfish container. So I tried to seperate the client to a standalone application to eventually be able to put it in a jar that is to be used by application A.
I used Apache ActiveMQ as a JEE implementation, so I don't need to run inside a JEE/glassfish-container. The messages are send to "TapServiceQueue" running in the glassfish-container on the same machine (for now) on port 17294. My code runs, messages get send, but they are not received on the server-side somehow :/

Here's is the code of my client class:



I created my app as a Maven-app inside netbeans, so dependencies are taken care of automatically.
In my client I do a createQueue:



This seems rather strange to me, since the queue already exists. I've been searching for ages for a solution now, but there does not seem to be a way to get an existing queue reference :s How to do this? Can you guys see something wrong in my code? Or is my approach not the correct one somehow?

Any suggestions?



OS: Ubuntu 11.04
JAVA: 1.7
JEE: 5
IDE: Netbeans 7.2
JEE-container: Glassfish 3+

For completeness, here is the server-side code


K, for future reference by other people looking for the same info: I just found this: http://download.oracle.com/docs/cd/E17802_01/webservices/webservices/docs/2.0/tutorial/doc/JAXBUsing4.html Which is the closest to date what I'm looking for, although still a bit vague IMO. Unless someone reading this knows of a clearer overview, I think I'll manage with this one.
Perhaps taglib documentation is the wrong term then (although they seem pretty much the same to me), probably because I was looking for something similar as the JSTL-taglib reference (http://download.oracle.com/docs/cd/E17802_01/products/products/jsp/jstl/1.1/docs/tlddocs/index.html).
What I'm searching for is complete documentation on all the JAXB tags and elements used in XSD's and XJB's, especially for namespaces "http://java.sun.com/xml/ns/jaxb" and "http://hyperjaxb3.jvnet.org/ejb/schemas/customizations" (Hyperjaxb). For example: <jaxb:bindings>, <jaxb:package>, <hj:default-generated-id> etc. And all of their properties.

The link provided is just the namespace I found in an existing XJB, which happens to contain a webpage, not containing the documentation I'm searching for, and besides, very old.

There must be some complete overview of JAXB tags and elements somewhere!?