Visualizzazione dei risultati da 1 a 8 su 8
  1. #1

    JBoss + EJB guida J2EE di HTML.it

    Ciao ragazzi, mi sto approcciando al J2EE per la prima volta usando la guida di HTML.it http://www.html.it/guide/guida-j2ee/ il problema è che l'applicazione creata mi da un errore.

    Premetto che uso Jboss eap 6.2, Java 1.8, ed ho creato 1 progetto tramite Maven.
    Seguendo la guida ho creato le interfacce remote ed il codice di business però quando ho dovuto creare il descrittore XML ho avuto qualche problema http://www.html.it/pag/17166/stateless-session-bean/ devo per caso assegnare un nome particolare? come fa l'AS a catturare questo file?

    Come client ho creato il modulo "myweb" che preleva il contenuto del EJB creato prima e lo mostra tramite una servlet.

    Il deployment del progetto + il modulo "myweb" non fallisce però quando eseguo la servlet mi viene restituito un errore che scrivo alla fine del post.

    Ci sbatto la testa da un bel po ma non capisco dove sbaglio qui il link al codice completo: https://github.com/AndreaCatania/ejb2

    Grazie mille in anticipo a tutti

    codice:
    [31m09:19:25,137 ERROR [stderr] (http-/127.0.0.1:8080-1) javax.naming.CommunicationException: Could not obtain connection to any of these urls: localhost:1099 and discovery failed with error: javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out] [Root exception is javax.naming.CommunicationException: Failed to connect to server localhost:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server localhost:1099 [Root exception is java.net.ConnectException: Connection refused]]]
    [0m[31m09:19:25,137 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1562)
    [0m[31m09:19:25,138 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:634)
    [0m[31m09:19:25,138 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
    [0m[31m09:19:25,138 ERROR [stderr] (http-/127.0.0.1:8080-1)     at javax.naming.InitialContext.lookup(InitialContext.java:417)
    [0m[31m09:19:25,138 ERROR [stderr] (http-/127.0.0.1:8080-1)     at com.andrea.servlet.Test1.doGet(Test1.java:45)
    [0m[31m09:19:25,138 ERROR [stderr] (http-/127.0.0.1:8080-1)     at javax.servlet.http.HttpServlet.service(HttpServlet.java:734)
    [0m[31m09:19:25,138 ERROR [stderr] (http-/127.0.0.1:8080-1)     at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
    [0m[31m09:19:25,138 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295)
    [0m[31m09:19:25,138 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
    [0m[31m09:19:25,139 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
    [0m[31m09:19:25,139 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149)
    [0m[31m09:19:25,139 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169)
    [0m[31m09:19:25,139 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:145)
    [0m[31m09:19:25,139 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97)
    [0m[31m09:19:25,139 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102)
    [0m[31m09:19:25,139 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:336)
    [0m[31m09:19:25,139 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
    [0m[31m09:19:25,139 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653)
    [0m[31m09:19:25,139 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:920)
    [0m[31m09:19:25,140 ERROR [stderr] (http-/127.0.0.1:8080-1)     at java.lang.Thread.run(Thread.java:745)
    [0m[31m09:19:25,140 ERROR [stderr] (http-/127.0.0.1:8080-1) Caused by: javax.naming.CommunicationException: Failed to connect to server localhost:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server localhost:1099 [Root exception is java.net.ConnectException: Connection refused]]
    [0m[31m09:19:25,140 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:274)
    [0m[31m09:19:25,140 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1533)
    [0m[31m09:19:25,140 ERROR [stderr] (http-/127.0.0.1:8080-1)     ... 19 more
    [0m[31m09:19:25,140 ERROR [stderr] (http-/127.0.0.1:8080-1) Caused by: javax.naming.ServiceUnavailableException: Failed to connect to server localhost:1099 [Root exception is java.net.ConnectException: Connection refused]
    [0m[31m09:19:25,140 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:248)
    [0m[31m09:19:25,141 ERROR [stderr] (http-/127.0.0.1:8080-1)     ... 20 more
    [0m[31m09:19:25,141 ERROR [stderr] (http-/127.0.0.1:8080-1) Caused by: java.net.ConnectException: Connection refused
    [0m[31m09:19:25,141 ERROR [stderr] (http-/127.0.0.1:8080-1)     at java.net.PlainSocketImpl.socketConnect(Native Method)
    [0m[31m09:19:25,141 ERROR [stderr] (http-/127.0.0.1:8080-1)     at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:345)
    [0m[31m09:19:25,141 ERROR [stderr] (http-/127.0.0.1:8080-1)     at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
    [0m[31m09:19:25,142 ERROR [stderr] (http-/127.0.0.1:8080-1)     at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
    [0m[31m09:19:25,142 ERROR [stderr] (http-/127.0.0.1:8080-1)     at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
    [0m[31m09:19:25,142 ERROR [stderr] (http-/127.0.0.1:8080-1)     at java.net.Socket.connect(Socket.java:589)
    [0m[31m09:19:25,142 ERROR [stderr] (http-/127.0.0.1:8080-1)     at java.net.Socket.connect(Socket.java:538)
    [0m[31m09:19:25,142 ERROR [stderr] (http-/127.0.0.1:8080-1)     at java.net.Socket.<init>(Socket.java:434)
    [0m[31m09:19:25,143 ERROR [stderr] (http-/127.0.0.1:8080-1)     at java.net.Socket.<init>(Socket.java:328)
    [0m[31m09:19:25,143 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:84)
    [0m[31m09:19:25,143 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:77)
    [0m[31m09:19:25,143 ERROR [stderr] (http-/127.0.0.1:8080-1)     at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:244)
    [0m[31m09:19:25,143 ERROR [stderr] (http-/127.0.0.1:8080-1)     ... 20 more
    [0m

  2. #2
    2 Cose...

    1) Come mai vuoi imparare la specifica ejb 2 ? Specifica vecchia lacunosa e sopratutto usata raramente, meglio ejb 3....

    Il primo errore che è ho notato subito è che hai messo il file ejb-jar (che dovrebbe essere ejb-jar.xml) all'interno della cartella dei sorgenti e questo non va bene il file deve stare nella cartella META-INF (con maven java/main/resources/META-INF).

  3. #3
    Quote Originariamente inviata da francesco.muia Visualizza il messaggio
    2 Cose...

    1) Come mai vuoi imparare la specifica ejb 2 ? Specifica vecchia lacunosa e sopratutto usata raramente, meglio ejb 3....

    Il primo errore che è ho notato subito è che hai messo il file ejb-jar (che dovrebbe essere ejb-jar.xml) all'interno della cartella dei sorgenti e questo non va bene il file deve stare nella cartella META-INF (con maven java/main/resources/META-INF).
    Grazie mille per aver risposto. Onestamente non ho trovato una buona guida o articolo che spiega bene EJB 3 e comunque la guida di HTML.it consiglia di partire con la versione 2 perche si capisce meglio il funzionamento.

    Ho fatto la modifica che hai detto tu e adesso ottengo questo stack durante la fase di startup e deduco che adesso i bean vengono caricati .

    codice:
    10:09:55,735 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-4) JNDI bindings for session bean named ServerTime in deployment unit deployment "ejb-1.0-SNAPSHOT.war" are as follows:
    
    
    	java:global/ejb-1.0-SNAPSHOT/ServerTime!it.html.ejb.session.stateless.ServerTimeHome
    	java:app/ejb-1.0-SNAPSHOT/ServerTime!it.html.ejb.session.stateless.ServerTimeHome
    	java:module/ServerTime!it.html.ejb.session.stateless.ServerTimeHome
    	java:jboss/exported/ejb-1.0-SNAPSHOT/ServerTime!it.html.ejb.session.stateless.ServerTimeHome
    	java:global/ejb-1.0-SNAPSHOT/ServerTime!it.html.ejb.session.stateless.ServerTime
    	java:app/ejb-1.0-SNAPSHOT/ServerTime!it.html.ejb.session.stateless.ServerTime
    	java:module/ServerTime!it.html.ejb.session.stateless.ServerTime
    	java:jboss/exported/ejb-1.0-SNAPSHOT/ServerTime!it.html.ejb.session.stateless.ServerTime

    Il problema è che ottengo sempre lo stesso errore quando eseguo la servlet.

    Può essere che la porta di accesso è differente?

    Ho ricaricato le modifiche in GitHub https://github.com/AndreaCatania/ejb2.

  4. #4
    Ok,gli ejb vengono correttamente installati.
    Si certo potrebbe essere ho un problema di porta, se ricordo bene su jboss eap dovresti avere un file "jboss-service.xml" e qui dentro ci dovrebbero essere le configurazione dei vari servizi tra cui jboss:service=Naming guarda la porta che è settata.

  5. #5
    Provando la porta 4447 ottengo il seguente errore:

    codice:
    11:17:52,286 ERROR [stderr] (http-/127.0.0.1:8080-1) javax.naming.CommunicationException: Could not obtain connection to any of these urls: 127.0.0.1:4447 and discovery failed with error: javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out] [Root exception is javax.naming.CommunicationException: Failed to retrieve stub from server 127.0.0.1:4447 [Root exception is java.io.StreamCorruptedException: invalid stream header: 0000000C]]
    11:17:52,287 ERROR [stderr] (http-/127.0.0.1:8080-1) 	at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1562)
    11:17:52,287 ERROR [stderr] (http-/127.0.0.1:8080-1) 	at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:634)
    11:17:52,287 ERROR [stderr] (http-/127.0.0.1:8080-1) 	at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
    11:17:52,287 ERROR [stderr] (http-/127.0.0.1:8080-1) 	at javax.naming.InitialContext.lookup(InitialContext.java:417)
    11:17:52,287 ERROR [stderr] (http-/127.0.0.1:8080-1) 	at com.andrea.servlet.Test1.doGet(Test1.java:45)
    11:17:52,288 ERROR [stderr] (http-/127.0.0.1:8080-1) 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:734)
    11:17:52,288 ERROR [stderr] (http-/127.0.0.1:8080-1) 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
    11:17:52,288 ERROR [stderr] (http-/127.0.0.1:8080-1) 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295)
    11:17:52,288 ERROR [stderr] (http-/127.0.0.1:8080-1) 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)
    11:17:52,288 ERROR [stderr] (http-/127.0.0.1:8080-1) 	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
    11:17:52,288 ERROR [stderr] (http-/127.0.0.1:8080-1) 	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149)
    11:17:52,289 ERROR [stderr] (http-/127.0.0.1:8080-1) 	at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169)
    11:17:52,289 ERROR [stderr] (http-/127.0.0.1:8080-1) 	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:145)
    11:17:52,289 ERROR [stderr] (http-/127.0.0.1:8080-1) 	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97)
    11:17:52,289 ERROR [stderr] (http-/127.0.0.1:8080-1) 	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102)
    11:17:52,289 ERROR [stderr] (http-/127.0.0.1:8080-1) 	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:336)
    11:17:52,289 ERROR [stderr] (http-/127.0.0.1:8080-1) 	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
    11:17:52,289 ERROR [stderr] (http-/127.0.0.1:8080-1) 	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653)
    11:17:52,290 ERROR [stderr] (http-/127.0.0.1:8080-1) 	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:920)
    11:17:52,290 ERROR [stderr] (http-/127.0.0.1:8080-1) 	at java.lang.Thread.run(Thread.java:745)
    11:17:52,290 ERROR [stderr] (http-/127.0.0.1:8080-1) Caused by: javax.naming.CommunicationException: Failed to retrieve stub from server 127.0.0.1:4447 [Root exception is java.io.StreamCorruptedException: invalid stream header: 0000000C]
    11:17:52,290 ERROR [stderr] (http-/127.0.0.1:8080-1) 	at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:268)
    11:17:52,290 ERROR [stderr] (http-/127.0.0.1:8080-1) 	at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1533)
    11:17:52,291 ERROR [stderr] (http-/127.0.0.1:8080-1) 	... 19 more
    11:17:52,291 ERROR [stderr] (http-/127.0.0.1:8080-1) Caused by: java.io.StreamCorruptedException: invalid stream header: 0000000C
    11:17:52,291 ERROR [stderr] (http-/127.0.0.1:8080-1) 	at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:806)
    11:17:52,291 ERROR [stderr] (http-/127.0.0.1:8080-1) 	at java.io.ObjectInputStream.<init>(ObjectInputStream.java:299)
    11:17:52,292 ERROR [stderr] (http-/127.0.0.1:8080-1) 	at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:255)
    11:17:52,292 ERROR [stderr] (http-/127.0.0.1:8080-1) 	... 20 more
    
    Se volessi usare EJB 3 come dovrei implementare le classi?

  6. #6
    Posta la parte di configurazione del mbean jboss:service=Naming .

    Per quanto riguarda la configurazione EJB 3 è totalmente diversa, si usano le annotation rispetto all'implementazione delle interfacce etc...
    Puoi seguire questo tutorial che mi sembra sia fatto abbastanza bene.

  7. #7
    Adesso leggo quella guida, intanto posto il contenuto di standalone.xml: http://forum.html.it/forum/attachmen...1&d=1424342886

    Forse il tag che ci interessa è: "socket-binding-group"

    Comunque non trovo il file "jboss-service.xml"

    File allegati File allegati

  8. #8
    Ho implementato un EJB3 ma non si installa nel server.. Come mai?

    Vedo solamente l'installazione degli EJB2, Per caso serve un descriptor?

    Ho aggiornato il codice di GitHub.

    codice:
    [0m[0m16:21:46,404 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-12) JNDI bindings for session bean named ServerTime in deployment unit deployment "ejb-1.0-SNAPSHOT.war" are as follows:
    
        java:global/ejb-1.0-SNAPSHOT/ServerTime!it.html.ejb.session.stateless.ServerTimeHome
        java:app/ejb-1.0-SNAPSHOT/ServerTime!it.html.ejb.session.stateless.ServerTimeHome
        java:module/ServerTime!it.html.ejb.session.stateless.ServerTimeHome
        java:jboss/exported/ejb-1.0-SNAPSHOT/ServerTime!it.html.ejb.session.stateless.ServerTimeHome
        java:global/ejb-1.0-SNAPSHOT/ServerTime!it.html.ejb.session.stateless.ServerTime
        java:app/ejb-1.0-SNAPSHOT/ServerTime!it.html.ejb.session.stateless.ServerTime
        java:module/ServerTime!it.html.ejb.session.stateless.ServerTime
        java:jboss/exported/ejb-1.0-SNAPSHOT/ServerTime!it.html.ejb.session.stateless.ServerTime

Tag per questa discussione

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.