EzDevInfo.com

jboss interview questions

Top jboss frequently asked interview questions

What is the difference between Tomcat, JBoss and Glassfish?

I am starting to look into Enterprise Java and the book I am following mentions that it will use JBoss. Netbeans ships with Glassfish. I have used Tomcat in the past.

What are the differences between these three programs?


Source: (StackOverflow)

How to use BOM file with Maven?

I have done considerable research in internet and I haven't found any easy explanation what to do with BOM files with Maven.

The problem is that I use JBoss 7.1.1 and I want to include all JBoss client jars in pom.xml. JBoss has a manual that says that I should use BOM files, but I don't know how to use it in my pom.xml.

Please help.


Source: (StackOverflow)

Advertisements

Using HeapDumpOnOutOfMemoryError parameter for heap dump for JBoss

I was told I can add the -XX:+HeapDumpOnOutOfMemoryError parameter to my JVM start up options to my JBoss start up script to get a heap dump when we get an out of memory error in our application. I was wondering where this data gets dumped? Is it just to the console, or to some log file? If it's just to the console, what if I'm not logged into the unix server through the console?

Thanks


Source: (StackOverflow)

Error starting jboss server

I've just finished re-installing my OS, and as always install and test standard tools which I use, and now I get this error like never before when I tried to start Jboss 5 from eclipse, its quite big exeption :

3:53:10,693 ERROR [AbstractKernelController] Error installing to Instantiated: name=AttachmentStore state=Described
java.lang.IllegalArgumentException: Wrong arguments. new for target java.lang.reflect.Constructor expected=[java.net.URI] actual=[java.io.File]
    at org.jboss.reflect.plugins.introspection.ReflectionUtils.handleErrors(ReflectionUtils.java:395)
    at org.jboss.reflect.plugins.introspection.ReflectionUtils.newInstance(ReflectionUtils.java:153)
    at org.jboss.reflect.plugins.introspection.ReflectConstructorInfoImpl.newInstance(ReflectConstructorInfoImpl.java:106)
    at org.jboss.joinpoint.plugins.BasicConstructorJoinPoint.dispatch(BasicConstructorJoinPoint.java:80)
    at org.jboss.aop.microcontainer.integration.AOPConstructorJoinpoint.createTarget(AOPConstructorJoinpoint.java:282)
    at org.jboss.aop.microcontainer.integration.AOPConstructorJoinpoint.dispatch(AOPConstructorJoinpoint.java:103)
    at org.jboss.kernel.plugins.dependency.KernelControllerContextAction$JoinpointDispatchWrapper.execute(KernelControllerContextAction.java:241)
    at org.jboss.kernel.plugins.dependency.ExecutionWrapper.execute(ExecutionWrapper.java:47)
    at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchExecutionWrapper(KernelControllerContextAction.java:109)
    at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchJoinPoint(KernelControllerContextAction.java:70)
    at org.jboss.kernel.plugins.dependency.InstantiateAction.installActionInternal(InstantiateAction.java:66)
    at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:54)
    at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:42)
    at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)
    at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71)
    at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
    at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
    at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
    at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
    at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
    at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
    at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:774)
    at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:540)
    at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.deployBean(AbstractKernelDeployer.java:319)
    at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.deployBeans(AbstractKernelDeployer.java:297)
    at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.deploy(AbstractKernelDeployer.java:130)
    at org.jboss.kernel.plugins.deployment.BasicKernelDeployer.deploy(BasicKernelDeployer.java:76)
    at org.jboss.bootstrap.microcontainer.TempBasicXMLDeployer.deploy(TempBasicXMLDeployer.java:91)
    at org.jboss.bootstrap.microcontainer.TempBasicXMLDeployer.deploy(TempBasicXMLDeployer.java:161)
    at org.jboss.bootstrap.microcontainer.ServerImpl.doStart(ServerImpl.java:138)
    at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:450)
    at org.jboss.Main.boot(Main.java:221)
    at org.jboss.Main$1.run(Main.java:556)
    at java.lang.Thread.run(Thread.java:619)
Failed to boot JBoss:
java.lang.IllegalStateException: Incompletely deployed:

DEPLOYMENTS IN ERROR:
  Deployment "AttachmentStore" is in error due to: java.lang.IllegalArgumentException: Wrong arguments. new for target java.lang.reflect.Constructor expected=[java.net.URI] actual=[java.io.File]

DEPLOYMENTS MISSING DEPENDENCIES:
  Deployment "ProfileServiceBootstrap" is missing the following dependencies:
    Dependency "ProfileService" (should be in state "Installed", but is actually in state "Instantiated")
    Dependency "jboss.kernel:service=Kernel" (should be in state "Installed", but is actually in state "**ERROR**")
  Deployment "ProfileServiceDeployer" is missing the following dependencies:
    Dependency "AttachmentStore" (should be in state "Installed", but is actually in state "**ERROR**")
  Deployment "ProfileService" is missing the following dependencies:
    Dependency "ProfileServiceDeployer" (should be in state "Installed", but is actually in state "Instantiated")
    Dependency "jboss.kernel:service=KernelController" (should be in state "Installed", but is actually in state "**ERROR**")
  Deployment "ProfileServicePersistenceDeployer" is missing the following dependencies:
    Dependency "AttachmentStore" (should be in state "Installed", but is actually in state "**ERROR**")

    at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.internalValidate(AbstractKernelDeployer.java:278)
    at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.validate(AbstractKernelDeployer.java:174)
    at org.jboss.bootstrap.microcontainer.ServerImpl.doStart(ServerImpl.java:142)
    at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:450)
    at org.jboss.Main.boot(Main.java:221)
    at org.jboss.Main$1.run(Main.java:556)
    at java.lang.Thread.run(Thread.java:619)
23:53:11,600 INFO  [ServerImpl] Runtime shutdown hook called, forceHalt: true
23:53:11,615 INFO  [ServerImpl] Shutdown complete 

Did anyone had the similar problem before?I've never encountered it so far


Source: (StackOverflow)

Advantages/Disadvantages to exploded wars

An answer to a question I read today suggested deploying an application as an exploded WAR. It got me thinking.

Every deployment I've ever done to a JBoss/Tomcat has been with a a WAR/EAR file. At least as far as I can remember.

Have I been making a mistake all these years?

Are there advantages to deploying an app in its expanded form rather than packaged up?


Source: (StackOverflow)

How do I Install JBoss AS / WildFly Server in Eclipse for Java EE

When I went to the "new server wizard" I can't find the category for JBoss AS.

When I clicked "Download new server adapter" I don't get any JBoss AS adapter in the list.


Source: (StackOverflow)

How do you specify the root context in your tags in web.xml?

I would like specify the root context of my Java web application in my WAR file. How can I do this using valid web-app XML in a web.xml file?

Oh, yes I would like to do this in an application server agnostic way.

Thank you in advance, Rob


Source: (StackOverflow)

Would you, at present date, use JBoss or Glassfish (or another) as Java EE server for a new project? [closed]

If you started a new Java EE project today which is to be finished in about a year, which application server would you choose and why?

Part of your answer should include your arguments for your decision. And also how much experience you have with the Java EE server you choose and with the other available servers on the market. These are interesting as we all get a sense of the investigation and thought that was put into your answer.


Source: (StackOverflow)

Starting JBoss from Eclipse

Staring JBoss server from within Eclipse Ganymede gives me the following problem: "Server JBoss v4.0 at localhost was unable to start within 120 seconds. If the server requires more time, try increasing the timeout in the server editor."

The console shows JBoss has started in so and so minutes but soon after, there is a pop up if the above message. I can also start the JBoss externally.


Source: (StackOverflow)

Hot deploy on JBoss - how do I make JBoss "see" the change?

I am developing a Java EE application that I deploy over and over again on a local JBoss installation during development. I want to speed up the build by hot deploying my application straight into [JBOSS]/server/default/deploy/myApp

It seems to work - but there also seems to be a somewhat arbitrary delay between the hard deploy and when JBoss starts using the new classes. I am not very familiar with JBoss, but I assume it caches classes, and that this is what causes the problem.

Am I correct, and if so, how do I make JBoss flush it's cache?


Source: (StackOverflow)

@Column(s) not allowed on a @ManyToOne property

I have a JPA entity with a property set as

@ManyToOne
@Column(name="LicenseeFK")
private Licensee licensee;

But when I deploy on JBoss 6 the application throws an error saying:

org.hibernate.AnnotationException: @Column(s) not allowed on a @ManyToOne property

I use Hibernate 3.5 as the JPA 2.0 implementation.

What should I use to reference the foreign key column?


Source: (StackOverflow)

How do you generate module dependencies in MANIFEST.MF for JBoss AS 7 with maven?

In JBoss AS 7, a Web application that depends on libraries contained in the AS, must declare those dependencies in META-INF/MANIFEST.MF like this:

Dependencies: <package-name>

Example:

Dependencies: org.slf4j

(This is comparable to Import-Package: for OSGi.) Further information can be found in the articles about migration from older versions, class loading and implicit module dependencies for deployments

The project is built with Maven. All dependencies included in the AS are declared with scope 'provided'.

Now the question

Is there a simple way to create this list of dependencies automatically with Maven?

Only dependencies with declared scope 'provided' should be included, because all others are already included in the WAR.


Source: (StackOverflow)

Deploying a Jersey webapp on Jboss AS 7

Currently running some webapps on Jboss AS 4/5 and I am testing migration to jboss7. When I try to deploy a jersey based webapp on JBoss AS 7 (full profile with standalone-preview config file), I get:

org.jboss.as.server.deployment.DeploymentUnitProcessingException: Only one JAX-RS Application Class allowed.

I've done a bit of hunting around on it and found that RestEasy is the default JAX-RS implementation embedded into Application Server. Posts like http://community.jboss.org/message/579996 and https://issues.jboss.org/browse/JBAS-8830) mention that the RestEasy deployer takes over.

In AS 6, it seems easier to remove the deployer whereas I have not seen any solutions for AS 7.


Source: (StackOverflow)

PersistenceContext EntityManager injection NullPointerException

I have a war containing the following:

META-INF/MANIFEST.MF
WEB-INF/classes/META-INF/persistence.xml
WEB-INF/classes/com/test/service/TestServlet.class
WEB-INF/classes/com/test/service/TestEntity.class
WEB-INF/classes/jndi.properties
WEB-INF/classes/postgresql-ds.xml
WEB-INF/jboss-web.xml
WEB-INF/web.xml
index.jsp

persistence.xml:

<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0">
    <persistence-unit name="test">
        <provider>org.hibernate.ejb.HibernatePersistence</provider>
        <jta-data-source>java:/TestDS</jta-data-source>

        <properties>
            <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>
            <property name="hibernate.hbm2ddl.auto" value="update" />
            <property name="hibernate.show_sql" value="true" />
        </properties>
    </persistence-unit>
</persistence>

web.xml:

<!DOCTYPE web-app PUBLIC
 "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
 "http://java.sun.com/dtd/web-app_2_3.dtd" >

<web-app>
  <display-name>Test Web Application</display-name>

    <context-param>
        <param-name>resteasy.scan</param-name>
        <param-value>true</param-value>
    </context-param>
    <listener>
        <listener-class>org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap</listener-class>
    </listener>
    <servlet>
        <servlet-name>Resteasy</servlet-name>
        <servlet-class>org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>Resteasy</servlet-name>
        <url-pattern>/service/*</url-pattern>
    </servlet-mapping>

    <resource-ref>
        <res-ref-name>TestDS</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <res-auth>Container</res-auth>
        <res-sharing-scope>Shareable</res-sharing-scope>
    </resource-ref>
</web-app>

My TestServlet class is as follows:

package com.test.service;

import java.util.*;
import javax.persistence.*;
import javax.ws.rs.*;

@Path("/service")
public class TestService {

    @PersistenceContext(unitName = "test")
    private EntityManager em;

    @GET
    @Path("/get")
    @Produces("application/json")
    public List get() {
        return em.createQuery("from TestEntity").getResultList();
    }
}

When the get() method is invoked I get a NullPointerException; the EntityManager hasn't been injected. Any suggestions on what I might be missing or how I can diagnose it? There's very little in the server log.

I'm sure I had this working without the jboss-web.xml or the datasource entry in web.xml. I've deployed the ds.xml to the deploy directory separately too and that's definitely picked up - I can see it in the JMX console.

Tried using JBoss 4.2.3 and a 6.0 build with the same result.


Source: (StackOverflow)

Benefits (and tips) of an upgrade from JBoss 4.2.x to JBoss 5.x, 6.x, 7.x and WildFly 8.x?

Please assume that I do not need to worry about development time and costs: I am interested in general technical benefits (improved performance? improved APIs?) and new features.

I am currently working on products using 4.2.x, and we consider a major shift for versions that are a long time ahead and need to converge.

I had a brief look at the release notes of each version and some articles about each release for 5.x, 6.x, 7.x and 8.x. But I would be glad to have first-hand feedback from people who have made the switch.

I noticed there are some important changes surrounding messaging (switching from JBoss MQ to JBoss Messenging), and that for JBoss 7.x it seems to change a fair bit its configuration layer. Then there's a lot more going on when switching to JBoss/WildFly 8.x.

Please recommend good articles pointing at pitfalls if you can. I found a few for migrations to JBoss 5.x, but not that many for 6.x or even 7.x, and someone else is evaluating 8.x for us now. Feel free to recommend alternatives as well if you think they are relevant, though I'd prefer to focus only on JBoss.

For information, we use a mix of JPF- and OSGi-enabled (using Eclipse Equinox) plugin-based systems, with clients developed in Swing (some deployed via WebStart).

Update: Though this question brought some great answers already, I think it deserves an update for WildFly (and actually, our internal projects delayed making the switch from 4.2.x to 7.x as originally planned to wait for WildFly). New thoughts and answers are welcome.


Source: (StackOverflow)