Question about calling ejb3.0 in jobss

Source: Internet
Author: User
Tags jboss

Ejb3.0 has been around for a long time. Although you can try it without a practical project, you still want to see its charm. Download jboss4.2-ga to develop ejb3.0's simplicity, it's just as easy as 2.0, saving a lot of xml configuration. This is the first time I feel the strong charm of jdk5.0, its custom annotation has time to study it. however, this experience is not smooth. after JBoss is successfully deployed, the written test program fails to be called, and an exception javax is reported. naming. communicationexception: cocould not obtain connection to any of these URLs: 127.0.0.1: 1099 and discovery failed with error: Java. security. accesscontrolexception: Access Denied (java.net. socketpermission 230.0.0.4 connect, accept, resolve) [root exception is javax. naming. communicationexception: failed to connect to server 127.0.0.1: 1099 [root exception is Java. security. accesscontrolexception: Access Denied (java.net. socketpermission 127.0.0.1: 1099 connect, resolve)] At Org. jnp. interfaces. namingcontext. checkref (namingcontext. 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 (initialcontext. java: 351) at JUnit. debug. ejbfactory. getejb (ejbfactory. java: 34) at JUnit. debug. helloworldtest. setupbeforeclass (helloworldtest. java: 15) at Sun. reflect. nativemethodaccessorimpl. invoke0 (native method) at Sun. reflect. nativemethodaccessorimpl. invoke (nativemethodaccessorimpl. java: 39) at Sun. reflect. delegatingmethodaccessorimpl. invoke (delegatingmethodaccessorimpl. java: 25) at java. lang. reflect. method. invoke (method. java: 585) at Org. JUnit. internal. runners. beforeandafterrunner. invokemethod (beforeandafterrunner. java: 74) at Org. JUnit. internal. runners. beforeandafterrunner. runbefores (beforeandafterrunner. java: 50) at Org. JUnit. internal. runners. beforeandafterrunner. runprotected (beforeandafterrunner. java: 33) at Org. JUnit. internal. runners. testclassrunner. run (testclassrunner. java: 52) at Org. eclipse. jdt. internal. junit4.runner. junit4testreference. run (junit4testreference. java: 38) at Org. eclipse. jdt. internal. JUnit. runner. testexecution. run (testexecution. java: 38) at Org. eclipse. jdt. internal. JUnit. runner. remotetestrunner. runtests (remotetestrunner. java: 460) at Org. eclipse. jdt. internal. JUnit. runner. remotetestrunner. runtests (remotetestrunner. java: 673) at Org. eclipse. jdt. internal. JUnit. runner. remotetestrunner. run (remotetestrunner. java: 386) at Org. eclipse. jdt. internal. JUnit. runner. remotetestrunner. main (remotetestrunner. java: 196)

Because the code system was added before the JNDI search. setproperty ("Java. security. policy "," client. policy "); If (system. getsecuritymanager () = NULL) system. setsecuritymanager, no reasonable answer was found. Finally, the JBoss was replaced by the High-point version 5.0, blocking the above security code, and the call was successful. in addition, if a local interface for bean is deployed to version 4.2 and cannot be found in the JNDI tree, you can only find remote. it can be found when it is changed to 5.0. before reading the information said 4.0 to the next jboss-ejb3.0-rc9 ant again, but I did not go down, maybe this problem? I have not demonstrated it yet. there is also a weak knowledge about security, and we will try to fix it in the near future. finally, paste the called code and mark it by yourself. // system. setproperty ("Java. security. policy "," client. policy "); // If (system. getsecuritymanager () = NULL) // system. setsecuritymanager (New rmisecuritymanager (); // properties props = NewProperties (); props. setproperty ("Java. naming. factory. initial "," org. jnp. interfaces. namingcontextfactory "); props. setproperty ("Java. naming. provider. URL "," 127.0.0.1: 1099 "); props. setproperty ("Java. naming. factory. URL. pkgs "," org. JBoss. naming: Org. jnp. interfaces ");/* props. setproperty ("Java. naming. factory. initial "," com. sun. enterprise. naming. serialinitcontextfactory "); props. setproperty ("Java. naming. factory. URL. pkgs "," com. sun. enterprise. naming "); props. setproperty ("Java. naming. provider. URL "," localhost: 3700 "); props. setproperty ("Java. naming. factory. state "," com. sun. CORBA. ee. impl. presentation. RMI. jndistatefactoryimpl "); */initialcontext CTX = NewInitialcontext (props); // initialcontext CTX = new initialcontext (); ReturnCTX. Lookup (jndipath );

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.