Hi Alex,

Thanks for the response! Here's the output from trace. It's neat to
see, but I don't know enough to interpret it:

java -DPID=42 -cp .;picolisp.jar;simple-4.1.21.jar PicoLisp lib.l go.l +
 interface : "org.simpleframework.http.core.Container" handle
((Request Response) (java Response 'close))
 interface = $$Proxy0
 java : "org.simpleframework.transport.connect.SocketConnection" T $$Proxy0
 java = $SocketConnection
 java : "java.net.InetSocketAddress" T 8005
 java = $InetSocketAddress
 java : $SocketConnection connect $InetSocketAddress
 java = $InetSocketAddress
:  java : $ResponseEntity close
!? (5 $4354460 $3195425)
java.lang.IllegalAccessException: Class PicoLisp$Number can not access a member
of class org.simpleframework.http.core.ResponseEntity with modifiers "public"
?


Another question: I started down an alternate path to use
java.net.ServerSocket but it doesn't seem to like threads/thread pool
calls.

Here's a really simple example:

: (setq Thread (java "java.lang.Thread" T (interface
"java.lang.Runnable" 'run '(() (prinl "hi"))))))
-> $Thread
(java Thread "start")
: -> NIL
: Exception in thread "Thread-1" java.lang.NullPointerException
        at PicoLisp$Number$1.invoke(Unknown Source)
        at $Proxy0.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)

Any clues on this one either?


Thank you!
Joe


On Sat, Jan 28, 2012 at 7:18 AM, Alexander Burger <a...@software-lab.de> wrote:
> Hello Joe,
>
>> I'm trying to write a simple java web server using the simpleframework. I'm
>> close, but I process anything in the method handler:
>
> OK. I can't reproduce the problem, as I don't have access to that
> framework. But perhaps I can give some hints to help locate the problem.
>
>
>> (de handler (request response) (java response 'close))
>> (setq cont (interface "org.simpleframework.http.core.Container" 'handle
>> handler))
>> (setq con (java "org.simpleframework.transport.connect.SocketConnection" T
>> cont))
>> (setq addr (java "java.net.InetSocketAddress" T 8005))
>> (java con 'connect addr)
>
> One note first: In PicoLisp, it is advisable to use uppercase names for
> (local) variables, because otherwise there is a risc for name conflicts.
>
> For example, the expression
>
>   (setq con (java "org.simpleframework...
>
> changes the value of the symbol 'con', which happens to be a function
> (setting the CDR of a cell). Later calls to that function will crash.
> This risk also exists for function parameters, so I would write the
> above as:
>
>   (de handler (Request Response)
>      (java Response 'close) )
>
>   (setq Cont
>      (interface "org.simpleframework.http.core.Container" 'handle handler) )
>
>   (setq Con
>      (java "org.simpleframework.transport.connect.SocketConnection" T Cont) )
>
>   (setq Addr (java "java.net.InetSocketAddress" T 8005))
>
>   (java Con 'connect Addr)
>
>
> But this is probably not the problem here.
>
>
>> When I run this and then curl http://localhost:8005 I get the following
>> exception:
>>
>> java.lang.IllegalAccessException: Class PicoLisp$Number can not access a
>> member
>> of class org.simpleframework.http.core.ResponseEntity with modifiers
>> "public"
>
> It would be interesting to see _where_ things get wrong. Could you
> try to trace the execution? Please call
>
>   (trace 'java)
>   (trace 'interface)
>
> before starting execution. And possibly trace other functions too, e.g.
> (trace 'handler), or (traceAll) to trace all Lisp-level functions.
>
> There must be a situation where perhaps the argument type (number?)
> doesn't match.
>
> Cheers,
> - Alex
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to