Hello, I am using Netbeans 6.1 and JBoss 5.0.0.CR2.

I am trying out an example with a stateless session bean and servlet, but have 
some problems.

The error message:
HTTP Status 404 - Servlet QuatronServlet is not available

---------------------------------------------------------------------------------
The console output:
*** CONTEXTS IN ERROR: Name -> Error

<UNKNOWN 
jboss.j2ee:ear=Hydron.ear,jar=HydronEJB.jar,name=HydronEJB,service=EJB3> -> ** 
UNRESOLVED Demands 'jboss.ejb:service=EJBTimerService' **

jboss.jdbc:datasource=DefaultDS,service=metadata -> ** NOT FOUND Depends on 
'jboss.jdbc:datasource=DefaultDS,service=metadata' **

<UNKNOWN 
jboss.j2ee:ear=Quatron-ejb.jar,jar=Quatron-ejb.jar,name=QuatronEJBBean,service=EJB3>
 -> ** UNRESOLVED Demands 'jboss.ejb:service=EJBTimerService' **

<UNKNOWN 
jboss.j2ee:ear=Quatron.ear,jar=Quatron-ejb.jar,name=QuatronEJBBean,service=EJB3>
 -> ** UNRESOLVED Demands 'jboss.ejb:service=EJBTimerService' **

jboss.jca:name=DefaultDS,service=DataSourceBinding -> ** NOT FOUND Depends on 
'jboss.jca:name=DefaultDS,service=DataSourceBinding' **


        at 
org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:709)
        at 
org.jboss.deployers.plugins.main.MainDeployerImpl.checkComplete(MainDeployerImpl.java:661)
        at 
org.jboss.system.server.profileservice.hotdeploy.HDScanner.scan(HDScanner.java:291)
        at 
org.jboss.system.server.profileservice.hotdeploy.HDScanner.run(HDScanner.java:221)
        at 
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
        at 
java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
        at 
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
        at 
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181)
        at 
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
        at java.lang.Thread.run(Thread.java:619)


23:52:20,579 INFO  [[/Quatron]] Marking servlet QuatronServlet as unavailable
23:52:20,579 ERROR [[QuatronServlet]] Allocate exception for servlet 
QuatronServlet
javax.naming.NameNotFoundException: Quatron not bound
        at org.jnp.server.NamingServer.getBinding(NamingServer.java:564)
        at org.jnp.server.NamingServer.getBinding(NamingServer.java:572)
        at org.jnp.server.NamingServer.getObject(NamingServer.java:578)
        at org.jnp.server.NamingServer.lookup(NamingServer.java:288)
        at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:669)
        at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:629)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at org.jnp.interfaces.NamingContext.resolveLink(NamingContext.java:1251)
        at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:760)
        at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:629)
        at org.jboss.ejb3.JndiUtil.lookup(JndiUtil.java:44)
        at 
org.jboss.injection.JndiPropertyInjector.lookup(JndiPropertyInjector.java:75)
        at 
org.jboss.injection.JndiPropertyInjector.inject(JndiPropertyInjector.java:99)
        at 
org.jboss.web.tomcat.service.TomcatInjectionContainer.processInjectors(TomcatInjectionContainer.java:361)
        at 
org.jboss.web.tomcat.service.TomcatInjectionContainer.newInstance(TomcatInjectionContainer.java:244)
        at 
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1006)
        at 
org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:777)
        at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:129)
        at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at 
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:189)
        at 
org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:91)
        at 
org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:92)
        at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at 
org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
        at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:325)
        at 
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828)
        at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:601)
        at 
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
        at java.lang.Thread.run(Thread.java:619)
23:52:26,849 INFO  [[QuatronServlet]] Servlet QuatronServlet is currently 
unavailable


Here is the code:
----------------------------------------------------------------------------------
Application.xml

<?xml version="1.0" encoding="UTF-8"?>

    <display-name>Quatron</display-name>
        
            
                <web-uri>Quatron-war.war</web-uri>
                <context-root>/Quatron</context-root>
            
        
        
            Quatron-ejb.jar
        

----------------------------------------------------------------------------------
jboss-app.xml

<jboss-app>
  <loader-repository>
    quatron:archive=quatron.ear
  </loader-repository>
</jboss-app>
----------------------------------------------------------------------------------
QuatronEJBBean.java

package session;
import javax.ejb.Stateless;

@Stateless
public class QuatronEJBBean implements QuatronEJBLocal {
    public String getText() {
        return "test";
    }
}
----------------------------------------------------------------------------------
QuatronEJBLocal.java

package session;
import javax.ejb.Local;

@Local
public interface QuatronEJBLocal {
    String getText();
}

----------------------------------------------------------------------------------
web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd";>
    
        <servlet-name>QuatronServlet</servlet-name>
        <servlet-class>servlet.QuatronServlet</servlet-class>
    
    <servlet-mapping>
        <servlet-name>QuatronServlet</servlet-name>
        <url-pattern>/QuatronServlet</url-pattern>
    </servlet-mapping>
    <session-config>
        <session-timeout>
            30
        </session-timeout>
    </session-config>
    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>
    <ejb-local-ref>
        <ejb-ref-name>ejb/QuatronEJBBean</ejb-ref-name>
        <ejb-ref-type>Session</ejb-ref-type>
        session.QuatronEJBLocal
    </ejb-local-ref>    
</web-app>

----------------------------------------------------------------------------------
jboss-web.xml

<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
  <security-domain flushOnSessionInvalidation="false"/>
  <context-root>/Quatron</context-root>
  <ejb-local-ref>
        <ejb-ref-name>ejb/QuatronEJBBean</ejb-ref-name>
        session.QuatronEJBBean
        <local-jndi-name>Quatron/QuatronEJBBean/local</local-jndi-name>
    </ejb-local-ref>
</jboss-web>
----------------------------------------------------------------------------------
QuatronServlet.java

package servlet;

import java.io.IOException;
import java.io.PrintWriter;
import javax.ejb.EJB;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import session.QuatronEJBLocal;

/**
 *
 * @author gruen
 */
public class QuatronServlet extends HttpServlet {
  
    
    @EJB
    private QuatronEJBLocal quatron;

    protected void processRequest(HttpServletRequest request, 
HttpServletResponse response)
    throws ServletException, IOException {
        response.setContentType("text/html;charset=UTF-8");
        PrintWriter out = response.getWriter();
        
        try {
            out.println("Test" + quatron.getText());
        } finally { 
            out.close();
        }
    } 

        protected void doGet(HttpServletRequest request, HttpServletResponse 
response)
    throws ServletException, IOException {
        processRequest(request, response);
    } 

    protected void doPost(HttpServletRequest request, HttpServletResponse 
response)
    throws ServletException, IOException {
        processRequest(request, response);
    }

  
}


Thanks a lot for any answers! By the way, when should I use <ejb-link> and when 
just ?



View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4181342#4181342

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4181342
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to