|
|
|
ejb lookup
|
|||
|---|---|---|---|
|
#18+
Делаю lookup в сервлете Context ctx; HelloWorldLocal bean = null; try { ctx = new InitialContext(); bean = (HelloWorldLocal) ctx.lookup("java:global/custom/EJB2/HelloWorld!com.simple.beans.HelloWorldLocal"); } catch (NamingException e) { // TODO Auto-generated catch block e.printStackTrace(); } и в main public static void main(String[] args) throws NamingException { Context ctx = new InitialContext(); HelloWorldRemote bean = (HelloWorldRemote) ctx.lookup("ejb:custom/EJB2//HelloWorld!com.simple.beans.HelloWorldRemote"); System.out.println(bean.sayHiRemote()); } если нет jndi.properties файла, в сервлете все ок, а в main ошибка namingException. если добавляю jndi.properties в main все ок, а в сервлете javax.naming.NamingException: JBAS011843: Failed instantiate InitialContextFactory jndi.properties java.naming.factory.initial=org.jboss.naming.remote.client.InitialContextFactory java.naming.factory.url.pkgs=org.jboss.ejb.client.naming java.naming.provider.url=remote://localhost:4447 java.naming.security.principal=admin java.naming.security.credentials=1234 в чем проблема? ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 03.08.2014, 14:37 |
|
||
|
ejb lookup
|
|||
|---|---|---|---|
|
#18+
sergey_magic, в main такая ощибка javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 03.08.2014, 14:38 |
|
||
|
ejb lookup
|
|||
|---|---|---|---|
|
#18+
Разобрался? Такая же проблема( ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 17.10.2014, 11:53 |
|
||
|
ejb lookup
|
|||
|---|---|---|---|
|
#18+
mytoffnaxРазобрался? Такая же проблема( В серлвете уже используется реализация InitialContext от контейнера и он должен подгрести все настройки контейнера. В main() всё зависит о того какие либы доступны в classpath. По-хорошему это должен быть специальный .jar из контейрена. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 17.10.2014, 11:55 |
|
||
|
|

start [/forum/topic.php?fid=59&msg=38779657&tid=2126437]: |
0ms |
get settings: |
5ms |
get forum list: |
13ms |
check forum access: |
2ms |
check topic access: |
2ms |
track hit: |
163ms |
get topic data: |
7ms |
get forum data: |
2ms |
get page messages: |
35ms |
get tp. blocked users: |
1ms |
| others: | 214ms |
| total: | 444ms |

| 0 / 0 |
