[jboss-user] [Beginner's Corner] - InstantiationExceptionConstructorAccessorImpl when deploying simple web application

Niklas Jansson do-not-reply at jboss.com
Sat Aug 25 16:43:49 EDT 2012


Niklas Jansson [https://community.jboss.org/people/jansson] created the discussion

"InstantiationExceptionConstructorAccessorImpl when deploying simple web application"

To view the discussion, visit: https://community.jboss.org/message/755967#755967

--------------------------------------------------------------
Hello,

First of all - I'm a complete newbie to jBoss, first time ever trying to get a test-enviroment up and running. I have the jboss-7.1.1-Final application server running on a Linux box. And as a first project just want to create a simple webservice using javax.ws but I can't get the application to deploy, I'm using ant to build a simple .war file and then copying into {JBOSS_HOME}\standalone\deployments. However I get the exception:

23:28:20,665 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/webservice]] (MSC service thread 1-1) Servlet /webservice threw load() exception: java.lang.InstantiationException
        at sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(InstantiationExceptionConstructorAccessorImpl.java:48) [rt.jar:1.6.0_18]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:532) [rt.jar:1.6.0_18]
        at org.jboss.msc.value.ConstructedValue.getValue(ConstructedValue.java:61)
        at org.jboss.as.naming.ValueManagedReferenceFactory.getReference(ValueManagedReferenceFactory.java:49)
        at org.jboss.as.ee.component.ManagedReferenceInterceptorFactory$ManagedReferenceInterceptor.processInvocation(ManagedReferenceInterceptorFactory.java:90) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
        at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
        at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
        at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
        at org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:161) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
        at org.jboss.as.ee.component.BasicComponent.createInstance(BasicComponent.java:85) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
        at org.jboss.as.web.deployment.component.WebComponentInstantiator$1.<init>(WebComponentInstantiator.java:57) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
        at org.jboss.as.web.deployment.component.WebComponentInstantiator.getReference(WebComponentInstantiator.java:55) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
        at org.jboss.as.web.deployment.WebInjectionContainer.instantiate(WebInjectionContainer.java:99) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
        at org.jboss.as.web.deployment.WebInjectionContainer.newInstance(WebInjectionContainer.java:78) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
        at org.jboss.as.web.deployment.WebInjectionContainer.newInstance(WebInjectionContainer.java:72) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
        at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1156) [jbossweb-7.0.13.Final.jar:]
        at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1102) [jbossweb-7.0.13.Final.jar:]
        at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3655) [jbossweb-7.0.13.Final.jar:]
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:3873) [jbossweb-7.0.13.Final.jar:]
        at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
        at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
        at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.6.0_18]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.6.0_18]
        at java.lang.Thread.run(Thread.java:636) [rt.jar:1.6.0_18]


23:28:20,686 INFO  [org.jboss.web] (MSC service thread 1-1) JBAS018210: Registering web context: /webservice


My web.xml:
<web-app xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance http://www.w3.org/2001/XMLSchema-instance" xmlns=" http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee" xmlns:web=" http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation=" http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee  http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
  <display-name>Helloworld</display-name>
  <servlet>
    <servlet-name>Jersey REST Service</servlet-name>
    <servlet-class>javax.servlet.http.HttpServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>Jersey REST Service</servlet-name>
    <url-pattern>/rest/*</url-pattern>
  </servlet-mapping>
</web-app> 

My Helloworld.java:


import javax.ws.rs.GET;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;




public class HelloWorld {
            // This method is called if TEXT_PLAIN is request
            @GET
            @Produces(MediaType.TEXT_PLAIN)
            public String sayPlainTextHello() {
              return "Hello Jersey";
            }


            // This method is called if XML is request
            @GET
            @Produces(MediaType.TEXT_XML)
            public String sayXMLHello() {
              return "<?xml version=\"1.0\"?>" + "<hello> Hello World" + "</hello>";
            }


            // This method is called if HTML is request
            @GET
            @Produces(MediaType.TEXT_HTML)
            public String sayHtmlHello() {
              return "<html> " + "<title>" + "Hello World" + "</title>"
                  + "<body><h1>" + "Hello World" + "</body></h1>" + "</html> ";
            }
}

I'm a bit lost and googling all night haven't given me an answers, any pointers or ideas is much appreciated!
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/755967#755967]

Start a new discussion in Beginner's Corner at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2075]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20120825/4ad94756/attachment-0001.html 


More information about the jboss-user mailing list