Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

JBOSS SocketException PermissionDenied

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
I am running a simple "HelloUser" client with the Session Bean deployed on JBoss 4.2.2 AS. No Eclipse IDE is used.
When I try to run the client I get the following exception - any clue How I can get past over it-
--------------------------------------------------------------------------
javax.naming.CommunicationException: Could not obtain connection to any of these urls: 127.0.0.1:1099
and discovery failed with error: javax.naming.CommunicationException: Permission denied: Datagram send failed [Root exception is java.net.SocketException: Permission denied: Datagram send failed] [Root ex
ception is javax.naming.CommunicationException: Failed to connect to server 127.0.0.1:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server 127.0.0.1:1099 [Root exception is java.net.SocketException: Permission denied: connect]]]
at org.jnp.interfaces.NamingContext.checkRefNamingContext.java:1562)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:634)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
at javax.naming.InitialContext.lookup(Unknown Source)
at ejb3inaction.example.HelloUserClient.main(HelloUserClient.java:16)
Caused by: javax.naming.CommunicationException: Failed to connect to server 127.0.0.1:1099 [Root excep
tion is javax.naming.ServiceUnavailableException: Failed to connect to server 127.0.0.1:1099 [Root exc
eption is java.net.SocketException: Permission denied: connect]]
at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:274)
at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1533)
... 4 more
Caused by: javax.naming.ServiceUnavailableException: Failed to connect to server 127.0.0.1:1099 [Root
exception is java.net.SocketException: Permission denied: connect]
at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:248)
... 5 more
Caused by: java.net.SocketException: Permission denied: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at org.jnp.interfaces.TimedSocketFactory.createSocketTimedSocketFactory.java:84)
at rg.jnp.interfaces.TimedSocketFactory.createSocketTimedSocketFactory.java:77)
at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:244)
... 5 more
---------------------------------jndi.properties-------------------------
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.factory.url.pkgs=org.jnp.interfaces
java.naming.provider.url=127.0.0.1:1099 [same exception when localhost is used]
-----------------------------------Client Code-----------------------------
package ejb3inaction.example;

import javax.ejb.EJB;
import javax.naming.InitialContext;
import javax.naming.Context;
import javax.naming.NamingException;

public class HelloUserClient {
public static void main(String[] args) {
try{
Context ic = new InitialContext();
HelloUser helloUser = (HelloUser)ic.lookup("HelloUserBean");
helloUser.sayHello("Curious George");
System.out.println("Invoked EJB successfully .. see server console for output");
}
catch(Exception e){
e.printStackTrace();
}
}
private static Context getInitialContext() throws NamingException{
Context ic = new InitialContext();
return ic;
}
}
--------------------------------------------------------------------------

Thanks & Regards
Vivek
[ May 06, 2008: Message edited by: Vivek Gupta ]
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How do you start JBoss? Do you use any -b option while starting JBoss? Can you post the console logs from JBoss when the server has started?
 
Jaikiran Pai
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And which Operating System and Java version do you use?
 
Vivek Gupta
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OS: Microsoft Windows XP [Home Edition Version 2002, Service Pack 2].
----------------------------------------------------------------------
JAVA: java version "1.5.0_15"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_15-b04)
Java HotSpot(TM) Client VM (build 1.5.0_15-b04, mixed mode, sharing)
----------------------------------------------------------------------
I start JBoss using the "run" batch in the bin folder of JBOSS. No -b option is used. The hosts file has an entry of 127.0.0.1 with host name as "localhost".
----------------------------------------------------------------------
===============================================================================

JBoss Bootstrap Environment

JBOSS_HOME: C:\jboss4

JAVA: C:\Program Files\Java\jdk1.5.0_15\\bin\java

JAVA_OPTS: -Dprogram.name=run.bat -server -Xms128m -Xmx512m
-Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=
3600000

CLASSPATH: C:\Program
Files\Java\jdk1.5.0_15\\lib\tools.jar;C:\jboss4\bin\run.jar

===============================================================================

10:22:57,703 INFO [Server] Starting JBoss (MX MicroKernel)...
10:22:57,734 INFO [Server] Release ID: JBoss [Trinity] 4.2.2.GA
(build: SVNTag=JBoss_4_2_2_GA date=200710221139)
10:22:57,765 INFO [Server] Home Dir: C:\jboss4
10:22:57,765 INFO [Server] Home URL: file:/C:/jboss4/
10:22:57,765 INFO [Server] Patch URL: null
10:22:57,765 INFO [Server] Server Name: default
10:22:57,765 INFO [Server] Server Home Dir: C:\jboss4\server\default
10:22:57,765 INFO [Server] Server Home URL: file:/C:/jboss4/server/default/
10:22:57,765 INFO [Server] Server Log Dir: C:\jboss4\server\default\log
10:22:57,765 INFO [Server] Server Temp Dir: C:\jboss4\server\default\tmp
10:22:57,765 INFO [Server] Root Deployment Filename: jboss-service.xml
10:22:58,500 INFO [ServerInfo] Java version: 1.5.0_15,Sun Microsystems Inc.
10:22:58,500 INFO [ServerInfo] Java VM: Java HotSpot(TM) Server VM 1.5.0_15-b04,Sun Microsystems Inc.
10:22:58,500 INFO [ServerInfo] OS-System: Windows XP 5.1,x86
10:22:59,937 INFO [Server] Core system initialized
10:23:07,328 INFO [WebService] Using RMI server codebase: http://127.0.0.1:8083/
10:23:07,343 INFO [Log4jService$URLWatchTimerTask] Configuring from URL: resource:jboss-log4j.xml
10:23:09,734 INFO [TransactionManagerService] JBossTS Transaction Service (JTA version) - JBoss Inc.
10:23:09,734 INFO [TransactionManagerService] Setting up property manager MBean and JMX layer
10:23:10,234 INFO [TransactionManagerService] Starting recovery manager
10:23:10,375 INFO [TransactionManagerService] Recovery manager started
10:23:10,390 INFO [TransactionManagerService] Binding TransactionManager JNDI Reference
10:23:17,906 INFO [EJB3Deployer] Starting java:comp multiplexer
10:23:18,781 INFO [STDOUT] no object for null
10:23:18,781 INFO [STDOUT] no object for null
10:23:18,906 INFO [STDOUT] no object for null
10:23:18,953 INFO [STDOUT] no object for {urn:jboss:bean-deployer}supplyType
10:23:19,031 INFO [STDOUT] no object for {urn:jboss:bean-deployer}dependsType
10:23:24,000 INFO [NativeServerConfig] JBoss Web Services - Native
10:23:24,000 INFO [NativeServerConfig] jbossws-native-2.0.1.SP2 (build=200710210837)
10:23:26,578 INFO [Embedded] Catalina naming disabled
10:23:26,796 INFO [AprLifecycleListener] The Apache Tomcat Native library which allows optimal performance in production environments
was not found on the java.library.path: C:\Program
Files\Java\jdk1.5.0_15\bin;.;C:\WINDOWS\system32;C:\WINDOWS;C:\Borland\BCC55\Bin;C:\
Program Files\Java\jre1.5.0_15\bin;C:\Program
Files\Java\jdk1.5.0_15\bin;C:\apache-ant-1.7.0\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WIND
OWS\System32\Wbem
10:23:27,265 INFO [Http11Protocol] Initializing Coyote HTTP/1.1 on http-127.0.0.1-8080
10:23:27,265 INFO [AjpProtocol] Initializing Coyote AJP/1.3 on ajp-127.0.0.1-8009
10:23:27,265 INFO [Catalina] Initialization processed in 683 ms
10:23:27,265 INFO [StandardService] Starting service jboss.web
10:23:27,265 INFO [StandardEngine] Starting Servlet Engine: JBossWeb/2.0.1.GA
10:23:27,328 INFO [Catalina] Server startup in 62 ms
10:23:27,546 INFO [TomcatDeployer] deploy, ctxPath=/, warUrl=.../deploy/jboss-web.deployer/ROOT.war/
10:23:29,281 INFO [TomcatDeployer] deploy, ctxPath=/invoker, warUrl=.../deploy/http-invoker.sar/invoker.war/
10:23:29,609 INFO [TomcatDeployer] deploy, ctxPath=/jbossws, warUrl=.../deploy/jbossws.sar/jbossws-context.war/
10:23:30,687 INFO [TomcatDeployer] deploy, ctxPath=/jbossmq-httpil, warUrl=.../deploy/jms/jbossmq-httpil.sar/jbossmq-httpil.war/
10:23:32,921 INFO [TomcatDeployer] deploy, ctxPath=/web-console, warUrl=.../deploy/management/console-mgr.sar/web-console.war/
10:23:34,671 INFO [MailService] Mail Service bound to java:/Mail
10:23:34,890 INFO [RARDeployment] Required license terms exist, view META-INF/ra.xml in .../deploy/jboss-ha-local-jdbc.rar
10:23:34,968 INFO [RARDeployment] Required license terms exist, view META-INF/ra.xml in .../deploy/jboss-ha-xa-jdbc.rar
10:23:35,015 INFO [RARDeployment] Required license terms exist, view META-INF/ra.xml in .../deploy/jboss-local-jdbc.rar
10:23:35,109 INFO [RARDeployment] Required license terms exist, view META-INF/ra.xml in .../deploy/jboss-xa-jdbc.rar
10:23:35,187 INFO [RARDeployment] Required license terms exist, view META-INF/ra.xml in .../deploy/jms/jms-ra.rar
10:23:35,281 INFO [RARDeployment] Required license terms exist, view META-INF/ra.xml in .../deploy/mail-ra.rar
10:23:35,343 INFO [RARDeployment] Required license terms exist, view META-INF/ra.xml in .../deploy/quartz-ra.rar
10:23:35,343 INFO [QuartzResourceAdapter] start quartz!!!
10:23:35,453 INFO [SimpleThreadPool] Job execution threads will use class loader of thread: main
10:23:35,484 INFO [QuartzScheduler] Quartz Scheduler v.1.5.2 created.
10:23:35,500 INFO [RAMJobStore] RAMJobStore initialized.
10:23:35,500 INFO [StdSchedulerFactory] Quartz scheduler 'DefaultQuartzScheduler' initialized from default resource file in Quartz pac
kage: 'quartz.properties'
10:23:35,500 INFO [StdSchedulerFactory] Quartz scheduler version: 1.5.2
10:23:35,500 INFO [QuartzScheduler] Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED started.
10:23:36,343 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=DefaultDS' to JN
DI name 'java efaultDS'
10:23:37,031 INFO [A] Bound to JNDI name: queue/A
10:23:37,031 INFO [B] Bound to JNDI name: queue/B
10:23:37,031 INFO [C] Bound to JNDI name: queue/C
10:23:37,031 INFO [D] Bound to JNDI name: queue/D
10:23:37,046 INFO [ex] Bound to JNDI name: queue/ex
10:23:37,093 INFO [testTopic] Bound to JNDI name: topic/testTopic
10:23:37,109 INFO [securedTopic] Bound to JNDI name: topic/securedTopic
10:23:37,109 INFO [testDurableTopic] Bound to JNDI name: topic/testDurableTopic
10:23:37,109 INFO [testQueue] Bound to JNDI name: queue/testQueue
10:23:37,171 INFO [UILServerILService] JBossMQ UIL service available at : /127.0.0.1:8093
10:23:37,718 INFO [DLQ] Bound to JNDI name: queue/DLQ
10:23:37,921 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=ConnectionFactoryBinding,name=JmsXA' to
JNDI name 'java:JmsXA'
10:23:38,000 INFO [TomcatDeployer] deploy, ctxPath=/jmx-console, warUrl=.../deploy/jmx-console.war/
10:23:38,437 INFO [EARDeployer] Init J2EE application: file:/C:/jboss4/server/default/deploy/chapter1.ear
10:23:38,796 INFO [JmxKernelAbstraction] creating wrapper delegate for: org.jboss.ejb3.stateless.StatelessContainer
10:23:38,796 INFO [JmxKernelAbstraction] installing MBean:
jboss.j2ee:ear=chapter1.ear,jar=chapter1-ejb.jar,name=HelloUserBean,service
=EJB3 with dependencies:
10:23:39,140 INFO [EJBContainer] STARTED EJB: ejb3inaction.example.HelloUserBean ejbName: HelloUserBean
10:23:39,218 INFO [EJB3Deployer] Deployed: file:/C:/jboss4/server/default/tmp/deploy/tmp37664chapter1.ear-contents/chapter1-ejb.jar
10:23:39,359 INFO [EARDeployer] Started J2EE application: file:/C:/jboss4/server/default/deploy/chapter1.ear
10:23:39,484 INFO [Http11Protocol] Starting Coyote HTTP/1.1 on http-127.0.0.1-8080
10:23:39,515 INFO [AjpProtocol] Starting Coyote AJP/1.3 on ajp-127.0.0.1-8009
10:23:39,531 INFO [Server] JBoss (MX MicroKernel) [4.2.2.GA (build:
SVNTag=JBoss_4_2_2_GA date=200710221139)] Started in 41s:766ms
 
Ranch Hand
Posts: 329
Oracle Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try the following in your jndi.properties:



I have used JBoss to run the very same example from EJB 3 in action. However I am running JBoss on Linux, not on windows.
 
Vivek Gupta
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi
it does not help. I end up with the same error.
Thanks.
 
Ranch Hand
Posts: 198
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
use these jndi properties

 
Dinuka Arsakularatne
Ranch Hand
Posts: 198
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the above post did not appear correctly.... use these settings,

java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory

java.naming.factory.url.pkgs=org.jboss.naming: org.jnp.interfaces

java.naming.provider.url=localhost

try these in your jndi.properties file and see.
 
Vivek Gupta
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello,
I set up the JBoss App Server on my official notebook and was successful in calling up the HelloWorldEJB and print the "Hello" on the StandardOutput of App Server. No special configuration required to set up the environment and simply followed the O'Reilly's book, JBoss Installation & Configuration guide..etc..all standard stuff.

Probably the machine I used before had some other issues, may be with some firewall settings or any "illicit" software installed which would prohibit such remote calls, I could not figure out the exact reason though.

Thanks a lot guys for your valuable inputs and continued support.

Regards
Vivek
[Preparing for SCBCD 5 ...]
 
reply
    Bookmark Topic Watch Topic
  • New Topic