tutorials.de Buch-Aktion 05/2012
ERLEDIGT
JA
ANTWORTEN
8
ZUGRIFFE
6585
EMPFEHLEN
  • An Twitter übertragen
  • An Facebook übertragen
AUF DIESES THEMA
ANTWORTEN
  1. #1
    Avatar von schnuffie
    schnuffie schnuffie ist offline Mitglied Platin
    Registriert seit
    Oct 2004
    Ort
    Ober-Roden (Hessen)
    Beiträge
    725
    Hallo Experten,

    leider habe ich hier und beim Googlen keine Lösung gefunden.
    Mein Problem ist folgendes:

    Ich verwende EJB3 (mit Hibernate-Persistence - nur zur Info erwähnt) mit JBoss 4.2 und deploye über Eclipse 3.3. Das funktioniert auch alles super, bis auf:

    Ich bekomme keinen Lookup hin. Aus diesem Grund habe ich zum Testen ein ganz einfaches Beispiel erstellt:

    Bean-Code:
    Code :
    1
    2
    3
    4
    5
    6
    
    [B][SIZE=2][COLOR=#7f0055]import[/COLOR][/SIZE][/B][SIZE=2][COLOR=#7f0055][/COLOR][/SIZE][SIZE=2] javax.ejb.Remote;[/SIZE]
    [SIZE=2][COLOR=#646464]@Remote[/COLOR][/SIZE][B][SIZE=2][COLOR=#7f0055]public[/COLOR][/SIZE][/B][SIZE=2][COLOR=#7f0055][/COLOR][/SIZE][B][SIZE=2][COLOR=#7f0055]interface[/COLOR][/SIZE][/B][SIZE=2][COLOR=#7f0055][/COLOR][/SIZE][SIZE=2] SimpleBean {
    [/SIZE][B][SIZE=2][COLOR=#7f0055]public[/COLOR][/SIZE][/B][SIZE=2][COLOR=#7f0055][/COLOR][/SIZE][SIZE=2] String sayHello(String name);[/SIZE]
    [SIZE=2] 
    }
    [/SIZE]
    Code :
    1
    2
    3
    4
    5
    6
    7
    8
    9
    
    [B][SIZE=2][COLOR=#7f0055]import[/COLOR][/SIZE][/B][SIZE=2][COLOR=#7f0055][/COLOR][/SIZE][SIZE=2] javax.ejb.*; [/SIZE]
    [SIZE=2][COLOR=#646464]@Stateless[/COLOR][/SIZE][SIZE=2](name=[/SIZE][SIZE=2][COLOR=#2a00ff]"Example"[/COLOR][/SIZE][SIZE=2], mappedName=[/SIZE][SIZE=2][COLOR=#2a00ff]"java:comp/env/SimpleBean"[/COLOR][/SIZE][SIZE=2])
    [/SIZE][B][SIZE=2][COLOR=#7f0055]public[/COLOR][/SIZE][/B][SIZE=2][COLOR=#7f0055][/COLOR][/SIZE][B][SIZE=2][COLOR=#7f0055]class[/COLOR][/SIZE][/B][SIZE=2][COLOR=#7f0055][/COLOR][/SIZE][SIZE=2] SimpleBeanImpl [/SIZE][B][SIZE=2][COLOR=#7f0055]implements[/COLOR][/SIZE][/B][SIZE=2][COLOR=#7f0055][/COLOR][/SIZE][SIZE=2] SimpleBean {[/SIZE]
    [B][SIZE=2][COLOR=#7f0055]public[/COLOR][/SIZE][/B][SIZE=2][COLOR=#7f0055][/COLOR][/SIZE][SIZE=2] String sayHello(String name) { 
    [/SIZE][B][SIZE=2][COLOR=#7f0055]return[/COLOR][/SIZE][/B][SIZE=2][COLOR=#7f0055][/COLOR][/SIZE][SIZE=2][COLOR=#2a00ff]"Hello "[/COLOR][/SIZE][SIZE=2] + name + [/SIZE][SIZE=2][COLOR=#2a00ff]"!"[/COLOR][/SIZE][SIZE=2]; 
    } 
     
    }
    [/SIZE]

    Lookup-Klasse:
    Code :
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    
    [B][SIZE=2][COLOR=#7f0055]import[/COLOR][/SIZE][/B][SIZE=2][COLOR=#7f0055][/COLOR][/SIZE][SIZE=2] java.io.ByteArrayOutputStream;
    [/SIZE][B][SIZE=2][COLOR=#7f0055]import[/COLOR][/SIZE][/B][SIZE=2][COLOR=#7f0055][/COLOR][/SIZE][SIZE=2] java.io.PrintStream;
     
    [/SIZE][B][SIZE=2][COLOR=#7f0055]import[/COLOR][/SIZE][/B][SIZE=2][COLOR=#7f0055][/COLOR][/SIZE][SIZE=2] javax.ejb.EJB;
    [/SIZE][B][SIZE=2][COLOR=#7f0055]import[/COLOR][/SIZE][/B][SIZE=2][COLOR=#7f0055][/COLOR][/SIZE][SIZE=2] javax.naming.InitialContext;
     
    [/SIZE][B][SIZE=2][COLOR=#7f0055]import[/COLOR][/SIZE][/B][SIZE=2][COLOR=#7f0055][/COLOR][/SIZE][SIZE=2] com.webnobis.storehousesystem.facade.SimpleBean;[/SIZE]
    [B][SIZE=2][COLOR=#7f0055]public[/COLOR][/SIZE][/B][SIZE=2][COLOR=#7f0055][/COLOR][/SIZE][B][SIZE=2][COLOR=#7f0055]class[/COLOR][/SIZE][/B][SIZE=2][COLOR=#7f0055][/COLOR][/SIZE][SIZE=2] SimpleClient {
     
    [/SIZE][B][SIZE=2][COLOR=#7f0055]private[/COLOR][/SIZE][/B][SIZE=2][COLOR=#7f0055][/COLOR][/SIZE][SIZE=2] SimpleBean [/SIZE][SIZE=2][COLOR=#0000c0]bean[/COLOR][/SIZE][SIZE=2];
    [/SIZE][B][SIZE=2][COLOR=#7f0055]private[/COLOR][/SIZE][/B][SIZE=2][COLOR=#7f0055][/COLOR][/SIZE][SIZE=2] String [/SIZE][SIZE=2][COLOR=#0000c0]text[/COLOR][/SIZE][SIZE=2] = [/SIZE][SIZE=2][COLOR=#2a00ff]"Banane"[/COLOR][/SIZE][SIZE=2];[/SIZE]
    [B][SIZE=2][COLOR=#7f0055]public[/COLOR][/SIZE][/B][SIZE=2][COLOR=#7f0055][/COLOR][/SIZE][SIZE=2] SimpleClient() {
    [/SIZE][B][SIZE=2][COLOR=#7f0055]try[/COLOR][/SIZE][/B][SIZE=2][COLOR=#7f0055][/COLOR][/SIZE][SIZE=2] {
    InitialContext ctx = [/SIZE][B][SIZE=2][COLOR=#7f0055]new[/COLOR][/SIZE][/B][SIZE=2][COLOR=#7f0055][/COLOR][/SIZE][SIZE=2] InitialContext();
    [/SIZE][B][SIZE=2][COLOR=#7f0055]this[/COLOR][/SIZE][/B][SIZE=2][COLOR=#7f0055][/COLOR][/SIZE][SIZE=2].[/SIZE][SIZE=2][COLOR=#0000c0]bean[/COLOR][/SIZE][SIZE=2] = (SimpleBean)ctx.lookup([/SIZE][SIZE=2][COLOR=#2a00ff]"java:comp/env/SimpleBean"[/COLOR][/SIZE][SIZE=2]);
    } [/SIZE][B][SIZE=2][COLOR=#7f0055]catch[/COLOR][/SIZE][/B][SIZE=2][COLOR=#7f0055][/COLOR][/SIZE][SIZE=2] (Exception e) {
    ByteArrayOutputStream bout = [/SIZE][B][SIZE=2][COLOR=#7f0055]new[/COLOR][/SIZE][/B][SIZE=2][COLOR=#7f0055][/COLOR][/SIZE][SIZE=2] ByteArrayOutputStream();
    e.printStackTrace([/SIZE][B][SIZE=2][COLOR=#7f0055]new[/COLOR][/SIZE][/B][SIZE=2][COLOR=#7f0055][/COLOR][/SIZE][SIZE=2] PrintStream(bout));
    [/SIZE][SIZE=2][COLOR=#0000c0]text[/COLOR][/SIZE][SIZE=2] = [/SIZE][B][SIZE=2][COLOR=#7f0055]new[/COLOR][/SIZE][/B][SIZE=2][COLOR=#7f0055][/COLOR][/SIZE][SIZE=2] String(bout.toByteArray());
    }
    }
     
     
    [/SIZE][B][SIZE=2][COLOR=#7f0055]public[/COLOR][/SIZE][/B][SIZE=2][COLOR=#7f0055][/COLOR][/SIZE][SIZE=2] String getText() {
    [/SIZE][B][SIZE=2][COLOR=#7f0055]return[/COLOR][/SIZE][/B][SIZE=2][COLOR=#7f0055][/COLOR][/SIZE][SIZE=2][COLOR=#2a00ff]text[/COLOR][/SIZE][SIZE=2];
    }
     
     
     
    [/SIZE][B][SIZE=2][COLOR=#7f0055]public[/COLOR][/SIZE][/B][SIZE=2][COLOR=#7f0055][/COLOR][/SIZE][SIZE=2] String getBeanText() {
    [/SIZE][B][SIZE=2][COLOR=#7f0055]return[/COLOR][/SIZE][/B][SIZE=2][COLOR=#7f0055][/COLOR][/SIZE][SIZE=2] ([/SIZE][SIZE=2][COLOR=#0000c0]bean[/COLOR][/SIZE][SIZE=2] != [/SIZE][B][SIZE=2][COLOR=#7f0055]null[/COLOR][/SIZE][/B][SIZE=2][COLOR=#7f0055][/COLOR][/SIZE][SIZE=2])? [/SIZE][SIZE=2][COLOR=#0000c0]bean[/COLOR][/SIZE][SIZE=2].sayHello([/SIZE][SIZE=2][COLOR=#2a00ff]"Steffen"[/COLOR][/SIZE][SIZE=2]): [/SIZE][SIZE=2][COLOR=#2a00ff]"bean = null"[/COLOR][/SIZE][SIZE=2];
    }
     
     
     
    }
    [/SIZE]

    Die beiden Methoden-Rückgaben gebe ich testweise in einer ganz simplen JSP aus:
    HTML-Code:
    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <%@page import="com.webnobis.storehousesystem.delegate.SimpleClient;"%>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Insert title here</title>
    </head>
    <body>
    
    <jsp:declaration>
    SimpleClient sc = new SimpleClient();
    </jsp:declaration>
    
    <p>#<%=sc.getText() %>#</p>
    <p>##<%=sc.getBeanText() %>##</p>
    
    </body>
    </html>
    Dabei erscheint dann aber:
    HTML-Code:
    #javax.naming.NameNotFoundException: SimpleBean not bound at org.jnp.server.NamingServer.getBinding(NamingServer.java:529) at org.jnp.server.NamingServer.getBinding(NamingServer.java:537) at org.jnp.server.NamingServer.getObject(NamingServer.java:543) at org.jnp.server.NamingServer.lookup(NamingServer.java:296) at org.jnp.server.NamingServer.lookup(NamingServer.java:270) at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:625) at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:716) at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587) at javax.naming.InitialContext.lookup(Unknown Source) at com.webnobis.storehousesystem.delegate.SimpleClient.(SimpleClient.java:21) at org.apache.jsp.index_jsp.(index_jsp.java:12) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at java.lang.Class.newInstance0(Unknown Source) at java.lang.Class.newInstance(Unknown Source) at org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:143) at org.apache.jasper.servlet.JspServletWrapper.getDependants(JspServletWrapper.java:260) at org.apache.jasper.compiler.Compiler.isOutDated(Compiler.java:416) at org.apache.jasper.compiler.Compiler.isOutDated(Compiler.java:342) at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:562) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:308) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:228) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179) at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104) at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:216) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:624) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:445) at java.lang.Thread.run(Unknown Source) #
    ##bean = null##
    Auf der Kommandozeile wird beim Deployen kein Fehler ausgegeben. Die JSP funktioniert auch. Nur der Lookup bringt null. Da ich nicht glaube, daß die JBosser ein Problem in ihrem App-Server haben, gehe ich davon aus, daß ich ein entscheidendes Detail übersehen habe und ihr mir das bestimmt sagen könnt, wo mein Fehler liegt.

    Zusatzinfo:
    Bei EJB3 sind die Deployment-Descriptoren optional, daher habe ich keine angelegt. Soweit ich weiß, wird durch die Angabe des "mappedName" der Name im App-Server hinterlegt, oder irre ich da? Mit der Annotation "@EJB" statt InitialContext komme ich hier leider auch nicht weiter.

    Unter dem Link http://localhost:8080/jmx-console/Ht...ice%3DJNDIView, "Output JNDI info as text", Button "Invoke", erscheint dieser JNDI-name auch nicht.

    Was mache ich noch falsch?
    Geändert von schnuffie (19.10.07 um 13:46 Uhr) Grund: Ausgabe ergänzt
     
    CU schnuffie

    Fragliche Fragen stellende Fragensteller sind für verantwortungslose Antworten antwortender verantwortlicher Antworter selbst verantwortlich.

  2. #2
    Avatar von schnuffie
    schnuffie schnuffie ist offline Mitglied Platin
    Registriert seit
    Oct 2004
    Ort
    Ober-Roden (Hessen)
    Beiträge
    725
    Ergänzend möchte ich noch erwähnen, daß ich das Serverprofil "all" verwende und eine Ergänzung der "jndi.properties" im "conf"-Verzeichnis um die folgende Zeile brachte leider auch keinen Erfolg:
    HTML-Code:
    java.naming.provider.url=jnp://localhost:1099
    Inhalt der "jndi.properties" jetzt:
    HTML-Code:
    # DO NOT EDIT THIS FILE UNLESS YOU KNOW WHAT YOU ARE DOING
    #
    java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
    java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
    java.naming.provider.url=jnp://localhost:1099
    In zahlreichen Foren wird dieses Problem beschrieben, doch eine Lösung habe ich leider noch nicht gefunden. Ich hoffe, Ihr könnt mir helfen.
     
    CU schnuffie

    Fragliche Fragen stellende Fragensteller sind für verantwortungslose Antworten antwortender verantwortlicher Antworter selbst verantwortlich.

  3. #3
    Avatar von schnuffie
    schnuffie schnuffie ist offline Mitglied Platin
    Registriert seit
    Oct 2004
    Ort
    Ober-Roden (Hessen)
    Beiträge
    725
    Nun habe ich eine weitere Bean geschrieben:
    Code :
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    
    import javax.ejb.Remote;
     
     
    @Remote
    public interface OtherBean {
     
     
    public SimpleBean getSimpleBean();
     
     
    }
    Code :
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    
    import javax.ejb.EJB;
    import javax.ejb.Stateless;
     
    @Stateless(name="Example2", mappedName="ejb/OtherBeanJNDI")
    public class OtherBeanImpl implements OtherBean {
     
     @EJB
     private SimpleBean simple;
     
     @Override
     public SimpleBean getSimpleBean() {
      return simple;
     }
     
    }

    In meiner Testklasse werte ich das dann auch aus:
    Code :
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    
    //...
    public String getOtherText() {
    try {
    InitialContext ctx = new InitialContext();
    OtherBean bean1 = (OtherBean) ctx.lookup("ejb/OtherBeanJNDI");
    SimpleBean bean2 = bean1.getSimpleBean();
    if (bean2 != null) {
    return bean2.sayHello("Fritz");
    } else {
    return "OtherBean(SimpleBean) = null";
    }
    } catch (Exception e) {
    ByteArrayOutputStream bout = new ByteArrayOutputStream();
    e.printStackTrace(new PrintStream(bout));
    return new String(bout.toByteArray());
    }
    }
    //...

    In der JSP wird das dann ausgegeben:
    HTML-Code:
    <!-- ... -->
    <p>###<%=sc.getOtherText() %>###</p>
    <!-- ... -->
    Ergebnis:
    HTML-Code:
    #Banane#
    ##Hello Steffen!##
    ###Hello Fritz!###
    Und warum?:
    Weil die Annotation-Angabe "mappedName" anscheinend völlig Wurscht ist, denn es funktionierte erst, als ich im META-INF-Verzeichnis die angeblich bei EJB3 nicht mehr erforderliche spezielle App-Server-Datei "jboss.xml" anlegte:
    HTML-Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <jboss>
    <enterprise-beans>
    <session>
    <ejb-name>Example</ejb-name>
    <jndi-name>ejb/SimpleBeanJNDI</jndi-name>
    </session>
    <session>
    <ejb-name>Example2</ejb-name>
    <jndi-name>ejb/OtherBeanJNDI</jndi-name>
    </session>
    </enterprise-beans>
    </jboss>
    Nun hatte ich mir lang genug "einen Wolf" gesucht und kann mich nun endlich auf die eigentlichen Projektinhalte konzentrieren. Ich hoffe nur, daß das, was ich eben herausgefunden habe auch vielen anderen EJB3-Geplagten nützt.
    Geändert von schnuffie (19.10.07 um 16:37 Uhr)
     
    CU schnuffie

    Fragliche Fragen stellende Fragensteller sind für verantwortungslose Antworten antwortender verantwortlicher Antworter selbst verantwortlich.

  4. #4
    Registriert seit
    Jun 2002
    Ort
    Saarbrücken (Saarland)
    Beiträge
    9.886
    Blog-Einträge
    29
    Hallo,

    warum einfach wenns auch kompliziert geht...

    Unser Service Interface:
    Code java:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    
    /**
     * 
     */
    package de.tutorials.services;
     
    import javax.ejb.Remote;
     
    /**
     * @author Thomas.Darimont
     *
     */
    @Remote
    public interface IBusinessService {
      String businessOperation(String arg);
    }


    Unsere Service Implementierung:
    Code java:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    
    /**
     * 
     */
    package de.tutorials.services.internal;
     
    import javax.ejb.Stateless;
     
    import de.tutorials.services.IBusinessService;
     
    /**
     * @author Thomas.Darimont
     *
     */
    @Stateless
    public class BusinessService implements IBusinessService{
     
      public String businessOperation(String arg) {
        return arg + " rockz!";
      }
     
    }

    Unser Client:
    Code java:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    
    /**
     * 
     */
    package de.tutorials;
     
    import javax.naming.InitialContext;
     
    import de.tutorials.services.IBusinessService;
     
    /**
     * @author Thomas.Darimont
     */
    public class Client {
     
      /**
       * @param args
       */
      public static void main(String[] args) throws Exception {
        InitialContext initialContext = new InitialContext();
        IBusinessService businessService = (IBusinessService) initialContext.lookup("java:/BusinessService/remote");
        System.out.println(businessService.businessOperation("tutorials.de"));
      }
     
    }

    jndi.properties im Classpath des Clients:
    Code :
    1
    2
    3
    
    java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
    java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
    java.naming.provider.url=jnp://localhost:1099

    JBoss 4.2 mit run -c all in der all - Konfiguration gestartet.

    Klassen aus bin in tutorials-ejb3-example.jar exportieren und nach %JBOSS_HOME%\server\all\deploy kopieren.
    Fertig.

    Das tutorials-ejb3-example.jar liegt im deploy Verzeichnis des Projekts im Anhang.

    Gruß Tom
    Angehängte Dateien Angehängte Dateien
     
    Java rocks!
    How to become a good Java Programmer?
    Does IT in Java and .Net
    The only valid measurement of code quality: WTFs / minute
    Blog
    Xing
    Twitter

  5. #5
    Avatar von schnuffie
    schnuffie schnuffie ist offline Mitglied Platin
    Registriert seit
    Oct 2004
    Ort
    Ober-Roden (Hessen)
    Beiträge
    725
    So einfach geht's leider nicht Tom, denn für JNDI-Namen != "Klasse/remote" funktioniert's nicht ohne die jboss.xml-Einträge:

    Code :
    1
    
    @Stateless(name="ManagementFacade", mappedName="ejb/ManagementFacade")

    Code :
    1
    2
    
    [LEFT]InitialContext ctx = new InitialContext();
    ManagementFacade mf = (ManagementFacade) ctx.lookup("java:/ejb/ManagementFacade");[/LEFT]

    HTML-Code:
    javax.naming.NameNotFoundException: ManagementFacade not bound
     at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
     at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
     at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
     at org.jnp.server.NamingServer.lookup(NamingServer.java:296)
     at org.jnp.server.NamingServer.lookup(NamingServer.java:270)
     at sun.reflect.GeneratedMethodAccessor80.invoke(Unknown Source)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     at java.lang.reflect.Method.invoke(Method.java:597)
     at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
     at sun.rmi.transport.Transport$1.run(Transport.java:159)
     at java.security.AccessController.doPrivileged(Native Method)
     at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
     at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
     at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
     at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
     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)
     at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:255)
     at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:233)
     at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:142)
     at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
     at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:625)
     at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
     at javax.naming.InitialContext.lookup(InitialContext.java:392)
     at com.webnobis.storehousesystem.delegate.SimpleClient.getCustomerName(SimpleClient.java:63)
     at org.apache.jsp.index_jsp._jspService(index_jsp.java:79)
     at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
     at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:384)
     at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
     at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
     at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:228)
     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
     at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
     at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
     at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:216)
     at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
     at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:624)
     at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:445)
     at java.lang.Thread.run(Thread.java:619)
    Erst wenn ich den Eintrag in die jboss.xml übernehme, funktioniert's wieder.
     
    CU schnuffie

    Fragliche Fragen stellende Fragensteller sind für verantwortungslose Antworten antwortender verantwortlicher Antworter selbst verantwortlich.

  6. #6
    Avatar von zerix
    zerix zerix ist offline Hausmeister
    tutorials.de Moderator
    Registriert seit
    May 2005
    Beiträge
    4.335
    Hallo,

    Ich hab auch noch nie was in die jboss.xml eingetragen.

    MFG

    zEriX
     
    Es ist schwer Allwissend zu sein. Aber ich komme damit klar. ;-)

  7. #7
    Registriert seit
    Jun 2002
    Ort
    Saarbrücken (Saarland)
    Beiträge
    9.886
    Blog-Einträge
    29
    Hallo,

    normalerweise verwendet man für in-container Lookup's die Local Interfaces anstatt Remote Interfaces. Bei EJB 3.0 sollte man auch manuelle Lookups vermeiden und statt dessen den vom Container bereitgestellten Dependency Injection Mechanismus (@EJB / @Resource ...) verwenden, damit spart man sich die fehleranfälligen manuellen Lookups.
    Weiterhin kann man mit EJB 3.0 Annotations so ziemlich all das machen was man früher mit Deployment-Descriptoren (ejb-jar.xml / jboss-ejb.xml, etc.). Deployment-Descriptoren verwendet man heute noch um Applikationsweite Metadaten (wie Standard Interceptoren etc.) zu definieren oder um Werte der Annotations basierten Konfiguration zu überschreiben.

    Gruß Tom
     
    Java rocks!
    How to become a good Java Programmer?
    Does IT in Java and .Net
    The only valid measurement of code quality: WTFs / minute
    Blog
    Xing
    Twitter

  8. #8
    thirdman Tutorials.de Gastzugang
    Hallo,
    ich habe ein ähnliches Problem mit dem Lookup. Kann es sein, dass sich das ganze wieder anders verhält, wenn kein "JAR" sondern ein "EAR" deployed wird?

    Danke für jeden Tip.
    Grüsse
     

  9. #9
    hss81 hss81 ist offline Mitglied
    Registriert seit
    Nov 2008
    Beiträge
    13
    Hallo zusammen,

    es sind zwar nun fast 4 Jahre das Problem habe ich auch.

    ich habe ein ähnliches Problem mit dem Lookup. Kann es sein, dass sich das ganze wieder anders verhält, wenn kein "JAR" sondern ein "EAR" deployed wird?

    Ich habe ein Beispiel gefunden
    http://andrevollimweb.de/docs/Tutorial%20EJB.pdf

    Das Beispiel läuft unter JBOss 5.0.1 sollte doch auch unter 4.2.1 laufen****?

    Ich erhalte jedoch immer einen "Nullpointer" und zwar dort, wo auf die EJB verwiesen wird.



    Danke im Voraus.
    Viele Grüße
    Geändert von hss81 (20.07.11 um 20:48 Uhr)
     

Ähnliche Themen

  1. Problem mit JPA und JBoss
    Von devian_der_999 im Forum Enterprise Java (JEE, J2EE, Spring & Co.)
    Antworten: 1
    Letzter Beitrag: 13.01.11, 11:15
  2. Problem mit JBoss-4.2.1.GA
    Von Bumbum564 im Forum Enterprise Java (JEE, J2EE, Spring & Co.)
    Antworten: 2
    Letzter Beitrag: 16.02.09, 09:04
  3. Spring lookup bean auf jboss server
    Von grob im Forum Enterprise Java (JEE, J2EE, Spring & Co.)
    Antworten: 3
    Letzter Beitrag: 17.12.08, 08:56
  4. Name Lookup (Koenigs-Lookup)
    Von HPB im Forum C/C++
    Antworten: 1
    Letzter Beitrag: 23.07.08, 09:20
  5. JBoss JMS Problem
    Von fsmarine im Forum Enterprise Java (JEE, J2EE, Spring & Co.)
    Antworten: 1
    Letzter Beitrag: 18.02.08, 18:04