JBoss 6 creates instance of web service on startup - java

I'm migrating my ear application from JBoss 5 to 6.0.0.Final. I noticed that JBoss 6.0.0.Final instantiates beans which have #WebService annotation on startup. JBoss 5 didn't do that. Is it possible to disable this behaviour in JBoss 6?
Any help is appreciated.

The deploy directly contains all the modules that get started up.
What I usually do, is I first backup that deploy directly, and then start stripping out components and check to see if jboss still properly starts and does what I need it to do.
I then use 'netstat' (command line util, which I believe is also on Windows in the dos prompt), to check for any unexpected ports it might be listening on.
Crude. Not good enough to expose to the internet, but ok for intranet use.
Exposing to the internet is another kettle of fish. I'd use a scalable reverse proxy for that, but that's a whole other story.
Also check out JBoss 7. They're boasting about how "fast" it now is. Perhaps inspired by Glassfish which starts pretty much instantaneously...?

Related

How can I disable certain services and run only the ones I need in JBoss?

So I am new to JBoss and this might seem a little too trivial, but here goes. I have a downloaded version of JBoss on my remote and I basically want to start a cluster of HA-JNDI using the all/deploy/cluster directory. But what confuses me is what tells JBoss to run only the HA-JNDI cluster when I start JBoss? I have the hajndi-jboss-beans.xml to configure the HA-JNDI, but what if I do not want to start similar JBoss services. What do I have to do to achieve that? Please let me know if you need any other information. Thanks!
Use the {JBoss}/server/all server as a template for creating JBoss instances, since it is set up for clustering.
Copy the /all server as a new server (i.e: {JBoss}/server/ha).
Make configuration changes, such as removing unneeded JBoss services
(see JBoss Application Framework Trimming guide).

Tomcat and OSGi

I was wondering if it is possible to embed an OSGi container like Karaf inside a Tomcat instance. According to this SO question and a few others, it seems like its possible, but I can't seem to find any solid details on how to do this or what pitfalls/caveats to watch out for.
So:
Is it possible to embed an OSGi container inside Tomcat, so that I can hot-deploy OSGi bundles at any point to this container without having to restart Tomcat?
If the answer to #1 above is "yes", then what system services/ports does embedding OSGi inside Tomcat expose? I ask because I would like to deploy OSGi in a Tomcat server hosted on a Java PaaS where I don't have admin rights. And I'm wondering if - when I try to deploy the embedded OSGi container to Tomcat, that it will try to start listening on ports, or perhaps start doing something to the local file system. If this is the case I will likely receive security/permission errors.
Thanks in advance!
Is it possible to embed an OSGi container inside Tomcat?
Yes. In fact if you download Karaf and look in <KARAF_HOME>/demos/web you'll find a demo project that does exactly that.
what system services/ports does embedding OSGi inside Tomcat expose?
That would depend on what you install in it and how you configure it. Here is somewhat old (but IMHO stil relevant) discussion about default ports and how to configure them.
We deploy our application in the same fashion. We have deployed karaf in tomcat & on weblogic using a servelt bridge. The reason for using the container was to get past environment constraints where some customers are a "oracle" or an "ibm" shop and want all deployments done on these servers.
Since you will be using a servlet bridge it does not need to open a new port to list to http traffic. You may have issues with the karaf console if that port is blocked. Also I recall having issues with running cxf due to an embedded jetty instance it starts on another port.
Other than the ports you will need a karaf home directory with write access.

seamless redeploy for java web application

I am working at a startup, we are just about to roll out our first beta. Knowing that we will be having a good number of users, we want to have seamlessly deployment when we are adding new features.
I have worked with windows azure before, and I know they support seamless deployment, so I did some googling and cloudbees was the first result.
So the question is, with what we have now (geronimo server, rackspace hosting), is it possible to seamlessly redeploy a java web application? If so, how?
Are there other alternative solution, such as using another hosting provider or use a different web server? (Because it is a startup, it would be beneficial if the answer keeps scalability in mind)
If with a seamless redeploy, you mean an upgrade of your application without any downtime or restarting of your server, LiveRebel might be something to look at.
See http://zeroturnaround.com/liverebel
There are a lot of methods for doing this in the java world. If you don't use sessions (or use shared sessions between app servers) you can do a rolling stop/deploy/start of your appservers, taking 1 offline at a time and using a load balancer to ensure that traffic goes to the other servers.
I have heard Glassfish has such feature, the reference probably ment this (Glassfish 3.x redeploy command) : http://docs.oracle.com/cd/E19798-01/821-1758/6nmnj7q1h/index.html

How can I embed Weblogic server in java?

I am searching any way for embedding Weblogic server in Java , I know its possible because we have maven plugins for Weblogic which embeds Weblogic in maven, But googling for it did'nt gave me useful output, Does anybody know how can we embed wemlogic in java program ?
WebLogic doesn't provide an embedded API so, even if it's a pure Java Server and if you can thus call weblogic.Server from Java code, you will have to handle everything yourself (starting the container, waiting until it's started, deploying things, waiting until they are deployed, etc). In other words, this will require some work.
Maybe have a look at the sources of Cargo, although Cargo isn't really starting an embedded Weblogic (i.e. running weblogic.Server in the same JVM). This will give you an idea of what has to be done. Or, depending on your needs, use Cargo Java API.
But if you need a full Java EE server and if this is an option, I would use GlassFish v3 in embedded mode instead of WebLogic, it will be much simpler. Check the following links and see yourself:
Embedding Glassfish V3 in Unit Test - Two Jars, Three Lines Of Code And Five Seconds Start With Deployment
Embedding EJB 3.1 Container Into Your Unit Tests - Boot Time: 5 Seconds
Using the EJBContainer API with or without Maven (but with GlassFish v3)
TOTD #128: EJBContainer.createEJBContainer: Embedded EJB using GlassFish v3
Do you need WLS specifically, of any servlet container would do? If the latter is OK, then use Jetty.
WLS is not designed to be embeddable. But you can do it. After all, WLS is just a class named weblogic.Server. Setup classpath correctly, setup PATH and other environment variables (see setDomainEnv.sh and startWeblogic.sh), start that class from Java, and you have an "embedded" WLS.
There is probably a way, but I don't know it. My experience from writing maven plugins tells me that the most likely way that the plugin works is that it starts up a new command line process just like you would normally start up the server. So in a sense, not really embedded it.
The best way to see is to track down the source of the plugin and see how they did it.
WebLogic doesn't support embedded mode like Glassfish but you can have control over your Weblogic using "WebLogic Maven Plugin", this provide several maven goals for managing and working with Weblogic instance.
See this link for further information.

Which application server should i choose for my project?

I am currently developing an application for some researchers in my university.It's a small java program that you can use by command line. The next step is to package that program and deploy it to an application server. Some clients program will submit requests to the server who will call the tool that I wrote. Lately, we will add more tools to the server and he has to dispatch the requests to the right tool.
Which application server fits my needs ? I have looked for Tomcat, Jetty and Glassfish but it seems that they are only used for web application.
Is it possible to use those servers in some context different from web context? Which package archive should i use (jar, war) ?
Any advice?
Some clients program will submit requests to the server who will call the tool that I wrote.
The big question is what server-side technology and what communication protocol can you use between the clients and the server. You basically have two major options: HTTP and web services (in that case, consider using either JAX-WS or JAX-RS) or RMI-IIOP and EJBs (in that case, you'll have to use a Java EE compliant server like GlassFish).
I have looked for Tomcat, Jetty and Glassfish but it seems that they are only used for web application.
Not really. As I said, they can also be used for web services oriented applications. And GlassFish can be used for EJBs applications.
Which package archive should i use (jar, war)
The packaging will depend on the type of application you'll write, it's not something that you choose upfront, it's just a consequence. EJBs are packaged in an EJB JAR and typically deployed inside an EAR; Servlet based web services are deployed inside a WAR.
You really need to think about what technology to use first (with the current level of detail, I can't provide more guidance).
Do you even need an application server? There's nothing stopping you from adding the necessary network bindings and deploying it on its own.
Of the servers you mention, you've got 2 different categories: servlet containers and full-stack Java EE servers
Tomcat and Jetty are servlet containers. That doesn't mean that you can only do web stuff with them and you could manually add the required libraries to get a full Java EE server.
Glassfish is a full-stack Java EE server and can be compared with JBoss (both are open source) or the commercial rivals Weblogic and Websphere.
Sometimes this question is simple as the environment you are working in mandates a particular flavour of app server. You should check this first.
If you're not forced to use an app server, I'd ask why you think you need to use an app server?
I don't see why you would want to use tomcat, glassfish or jetty for a command line program.
If it's command-line based, and you want it to run server-side, you could write a little program that allows users to, for instance, telnet to your server, which in turn starts the CLI-application in question, and relays input / output to the client.
You may also want to look into Java Webstart, which makes deployment of new versions a breeze.
Actually we can't answer with so few elements.
- What are you planning to do
- With what technologies
- Where are you planning to host your application (have you got budget?)
- In which language are written the clients (even the future ones)?
- Could clients be on mobile phones (add some technlogy constraints...)
....
It would also be great to know what kind of request the clients will do, and what kind of response the server will provide...
Actually with what you tell us, all those application servers can do what you want...
I have looked for Tomcat, Jetty and
Glassfish but it seems that they are
only used for web application
You could even make a webapplication (servlet) and on the clientside use a httpclient to call that servlet... there are so many options :)
vive Paris!

Categories