Joe carco

Ranch Hand
+ Follow
since Apr 14, 2009
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Joe carco

Thank you for your reply, but I already know hat. If you read my posting carefully, you will See hat your suggestion is not an option. I dont have access to the marshaller as I am passing my jaxb object directly to the webservice end point. My Guess is that Metro uses the marshaller internally.
11 years ago
This is a question that was posted on StackOverflow, that nobody has answered yet.
I hope nobody minds me repeating the question here at the saloon:

I'm using the Metro stack bundled with Java 6 SE to call a web service. The web service expects XML as a parameter. I use JAXB classes to create content and pass my JAXB root element to the web service endpoint.

Now to my Problem: I can't find any way to make the marshaller include the schemaLocation of the XSD file since I can't directly access the marshaller. (If you have direct access to the marshaller it is possible do set the schemalocation as a property, but when using metro, all the marshalling seems to be happening internally.)

I've tried setting the xsi:schemaLocation in the XmlSchema annotation in the generated class, but this had no effect on the xml generated.

Does anyone have any ideas how to solve this problem?
11 years ago
about a year ago i read a blog post about an "all in one Enterprise Java Bean" or something similar.
I was about a guy who wrote a single class which was annotated as an Entity, Stateless, WebServlet and a couple more and apparently it even deployed! It was quite a humorous post. sadly I forgot to bookmark it. Does anyone by chance know where I can find this article?
12 years ago
Websocket now has its own official RFC:
And Websocket is apparently supported by Glssfish 3.1, so I hope it won't be long until Tomcat gets a "WebSocketEngine" too
12 years ago

I have a question about Context lookups and dependency Injection regarding the following scenario:

I'm using JBoss 6, JSF 2.0, EJB 3.1
I have and ejb jar and a war archive packaged together in an ear.
My ejb-jar contains a stateless, no interface session bean.
My war has a session scoped managed bean.

Inside my managed bean, I use the EJB annotation to inject an instance of my no-interface session bean - works like a charm!
When I deploy the ejb-jar and the war archives separately (without the ear) I get an error, stating that "Could not resolve @EJB reference ... ". However when I remove the EJB annotation in my managed bean and do a "InitialContext.doLookup("..."), I get NO errors and everything is fine.

Why doesn't dependency Injection using the EJB annotation work when deploying the artifacts sepeparately but a manual lookup does?
(I first deploy my ejb-jar and afterwards I deploy the war.)

Does anyone have a clue?
Thanks Ulf! that was exactly what I was looking for!
13 years ago

does anyone know if its possible to change the content of an HttpServletResponse in a ServletFilter?
I know that as long as the response hasn't been committed, I can add content as follows:

but is it possible to capture the responseoutput and change its contents according to certain rules?
13 years ago
Looks like your in the wrong Forum. Your question has nothing to do with Servlets.

Seems like youre confusing parsing and formatting. To format a date you need a Date and not a String. If you want to create a Date from a String try this:

if you want to format:

13 years ago
Ok I think I've got this one figured out:

Only a reference to the StatusBackingBean that is injected via CDI has a valid reference to the StatusFace SLSB, even though the object hashcode of the StatusBackingBean is the same throughout the entire Application. Seems to me that only the Proxy Object created when Injecting via CDI has an initialized Statusfacade an List of Statuses. It seems to me as if accessing any Field from the statusChanged method when the Event fires causes a NullPointerException because it is a different ProxyObject.

So this is what I did:

... works like a charm :-)
The way I see it, its impossible to help you unless you provide a lot more information.
Its the same a posting a problem in an automobile forum saying: my car isn't running, why?

Post some code, tell us what ApplicationServer you are using etc etc etc. the more information the more chance you have being helped, maybe a stacktrace could be useful

my problem concerns the following code

This ApplicationScoped Named Bean is accessed mainly from a Facelet using JSF 2.0. It is ApplicationScoped becuase the data it holds is fairly small and is only very rarely updated. So whenever a "Status" is changed, I fire an Event<Status> from the class that changes it via a CRUD operation. When the StatusBackingBean is initially created and the @PostConstruct method is called, obviously the statusFacade (a StatelessSessionBean) in correctly injected and is not null. When the event fires when a "Status" object is changed, I want to reload all the statuses from the database, so that all users have a freshly updated list of Statuses. However when calling statusFacade.findAll(); in the method private void statusChanged(@Observes Status status) I get a NullPointerException stating that the StatusFacade is null.

Is it not true that in an ApplicationScoped Bean, injected Enterprise Beans should always have a reference to a valid instance. Why is it NULL when accessed for a second time when the statusChanged method is fired even though it is the same object every time? is the injected StatusFacade instance nulled right after the method annotated with "PostConstruct" returns?

I am using GlassFish 3 (with WELD), NetBeans 3.9.1
there are several configuration points where things could have gone "wrong".
First, check to see if you have added your project to the tomcat instance that you have setup in the server view in Eclipse
Second, double click on the tomcat configuration in the Server view and check your settings in the "Publishing" section.
If nothing helps, have a look at your tomcat logs. Make sure your not keeping a handle on one of your published files in tomcat, i.e. make sure you havent opened a file in the tomcats project webapp folder for eg. with an editor
sorry I dont understand: youre creating a dynamic web project without a servlet container?
what is it you want to know? what exactly is your question??
republish sounds to me like youre using either a servlet or ejb container with your project?