Hi Dayvyd,

If I get it right, your code is a Cayenne tutorial with some
customization for your own model. So your settings look good to me.
And I just checked this tutorial in Cayenne 4.2 and it works fine with
authorization.

The exception itself tells only that the answer from the server
couldn't be parsed (that could be an HTTP error for example).
Are there any errors reported by the Jetty on the server-side? Maybe
you could add (or enable) request logging?

Additionally, you could fast check that the server is ok by opening
Cayenne servlet directly in the browser.
It should pass authorization and return something like a 405 HTTP error.

On Sun, Jul 5, 2020 at 5:30 PM Dayvyd . <[email protected]> wrote:
>
> Server:
>
> Jetty 6.1.26
> Project: saudeplusserver
> WebApp dir: src/main/webapp
>
> Em sáb, 4 de jul de 2020 05:21, Andrus Adamchik <[email protected]>
> escreveu:
>
> > Hi Dayvyd,
> >
> > Which version of Cayenne is this and how is the server setup?
> >
> > Andrus
> >
> > > On Jul 2, 2020, at 12:20 AM, Dayvyd . <[email protected]>
> > wrote:
> > >
> > > Hi,
> > >
> > > Has anyone encountered this error when running Main.java using BASIC
> > > authentication? Without authentication it works normally!
> > >
> > > Error: org.apache.cayenne.rop.HttpClientConnection - unknown code for
> > > readObject at 0x3c (<); nested exception is:
> > >
> > >
> > -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> > > public class Main {
> > >
> > > public static void main(String[] args) {
> > >
> > > Map<String, String> properties = new HashMap<>();
> > > properties.put(ClientConstants.ROP_SERVICE_URL_PROPERTY, "
> > > http://localhost:8080/saudeplusserver";);
> > > properties.put(ClientConstants.ROP_SERVICE_USERNAME_PROPERTY,
> > "saudeplus");
> > > properties.put(ClientConstants.ROP_SERVICE_PASSWORD_PROPERTY, "dna1614");
> > > properties.put(ClientConstants.ROP_SERVICE_REALM_PROPERTY, "Cayenne
> > Realm");
> > >
> > > ClientRuntime runtime = ClientRuntime.builder()
> > >                .properties(properties)
> > >                .build();
> > > ObjectContext context = runtime.newContext();
> > >
> > > inserirCardapio(context);
> > > runtime.shutdown();
> > > }
> > >
> > -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> > > [main] INFO org.eclipse.jetty.util.log - Logging initialized @1527ms to
> > > org.eclipse.jetty.util.log.Slf4jLog
> > > [main] INFO org.apache.cayenne.rop.http.JettyHttpROPConnector - Adding
> > > authentication
> > > User: saudeplus
> > > Realm: Cayenne Realm
> > > [main] INFO org.apache.cayenne.rop.http.JettyHttpROPConnector -
> > Connecting
> > > to [saudeplus:*******@http://localhost:8080/saudeplusserver] - dedicated
> > > session.
> > > [main] INFO org.apache.cayenne.rop.HttpClientConnection - unknown code
> > for
> > > readObject at 0x3c (<); nested exception is:
> > > com.caucho.hessian.io.HessianProtocolException: unknown code for
> > readObject
> > > at 0x3c (<)
> > > java.rmi.RemoteException: unknown code for readObject at 0x3c (<); nested
> > > exception is:
> > > com.caucho.hessian.io.HessianProtocolException: unknown code for
> > readObject
> > > at 0x3c (<)
> > > at
> > >
> > org.apache.cayenne.rop.ProxyRemoteService.establishSession(ProxyRemoteService.java:46)
> > > at
> > >
> > org.apache.cayenne.rop.HttpClientConnection.connect(HttpClientConnection.java:93)
> > > at
> > >
> > org.apache.cayenne.rop.HttpClientConnection.getServerEventBridge(HttpClientConnection.java:71)
> > > at
> > >
> > org.apache.cayenne.remote.ClientChannel.setupRemoteChannelListener(ClientChannel.java:279)
> > > at org.apache.cayenne.remote.ClientChannel.<init>(ClientChannel.java:77)
> > > at
> > >
> > org.apache.cayenne.configuration.rop.client.ClientChannelProvider.get(ClientChannelProvider.java:45)
> > > at
> > >
> > org.apache.cayenne.configuration.rop.client.ClientChannelProvider.get(ClientChannelProvider.java:30)
> > > at
> > >
> > org.apache.cayenne.di.spi.CustomProvidersProvider.get(CustomProvidersProvider.java:39)
> > > at
> > >
> > org.apache.cayenne.di.spi.FieldInjectingProvider.get(FieldInjectingProvider.java:43)
> > > at
> > >
> > org.apache.cayenne.di.spi.DefaultScopeProvider.get(DefaultScopeProvider.java:50)
> > > at
> > >
> > org.apache.cayenne.di.spi.DefaultInjector.getInstance(DefaultInjector.java:139)
> > > at
> > >
> > org.apache.cayenne.di.spi.FieldInjectingProvider.value(FieldInjectingProvider.java:103)
> > > at
> > >
> > org.apache.cayenne.di.spi.FieldInjectingProvider.injectMember(FieldInjectingProvider.java:68)
> > > at
> > >
> > org.apache.cayenne.di.spi.FieldInjectingProvider.injectMembers(FieldInjectingProvider.java:59)
> > > at
> > >
> > org.apache.cayenne.di.spi.FieldInjectingProvider.get(FieldInjectingProvider.java:44)
> > > at
> > >
> > org.apache.cayenne.di.spi.DefaultScopeProvider.get(DefaultScopeProvider.java:50)
> > > at
> > >
> > org.apache.cayenne.di.spi.DefaultInjector.getInstance(DefaultInjector.java:134)
> > > at
> > >
> > org.apache.cayenne.configuration.CayenneRuntime.newContext(CayenneRuntime.java:124)
> > > at br.com.saudeplus.model.client.Main.main(Main.java:25)
> > > Caused by: com.caucho.hessian.io.HessianProtocolException: unknown code
> > for
> > > readObject at 0x3c (<)
> > > at com.caucho.hessian.io.HessianInput.error(HessianInput.java:1697)
> > > at com.caucho.hessian.io.HessianInput.readObject(HessianInput.java:1177)
> > > at
> > >
> > org.apache.cayenne.rop.HessianROPSerializationService.deserialize(HessianROPSerializationService.java:67)
> > > at
> > >
> > org.apache.cayenne.rop.ProxyRemoteService.establishSession(ProxyRemoteService.java:44)
> > > ... 18 more
> > > Exception in thread "main" org.apache.cayenne.CayenneRuntimeException:
> > > [v.4.2.M1 Apr 15 2020 09:23:45] unknown code for readObject at 0x3c (<);
> > > nested exception is:
> > > com.caucho.hessian.io.HessianProtocolException: unknown code for
> > readObject
> > > at 0x3c (<)
> > > at
> > >
> > org.apache.cayenne.rop.HttpClientConnection.connect(HttpClientConnection.java:97)
> > > at
> > >
> > org.apache.cayenne.rop.HttpClientConnection.getServerEventBridge(HttpClientConnection.java:71)
> > > at
> > >
> > org.apache.cayenne.remote.ClientChannel.setupRemoteChannelListener(ClientChannel.java:279)
> > > at org.apache.cayenne.remote.ClientChannel.<init>(ClientChannel.java:77)
> > > at
> > >
> > org.apache.cayenne.configuration.rop.client.ClientChannelProvider.get(ClientChannelProvider.java:45)
> > > at
> > >
> > org.apache.cayenne.configuration.rop.client.ClientChannelProvider.get(ClientChannelProvider.java:30)
> > > at
> > >
> > org.apache.cayenne.di.spi.CustomProvidersProvider.get(CustomProvidersProvider.java:39)
> > > at
> > >
> > org.apache.cayenne.di.spi.FieldInjectingProvider.get(FieldInjectingProvider.java:43)
> > > at
> > >
> > org.apache.cayenne.di.spi.DefaultScopeProvider.get(DefaultScopeProvider.java:50)
> > > at
> > >
> > org.apache.cayenne.di.spi.DefaultInjector.getInstance(DefaultInjector.java:139)
> > > at
> > >
> > org.apache.cayenne.di.spi.FieldInjectingProvider.value(FieldInjectingProvider.java:103)
> > > at
> > >
> > org.apache.cayenne.di.spi.FieldInjectingProvider.injectMember(FieldInjectingProvider.java:68)
> > > at
> > >
> > org.apache.cayenne.di.spi.FieldInjectingProvider.injectMembers(FieldInjectingProvider.java:59)
> > > at
> > >
> > org.apache.cayenne.di.spi.FieldInjectingProvider.get(FieldInjectingProvider.java:44)
> > > at
> > >
> > org.apache.cayenne.di.spi.DefaultScopeProvider.get(DefaultScopeProvider.java:50)
> > > at
> > >
> > org.apache.cayenne.di.spi.DefaultInjector.getInstance(DefaultInjector.java:134)
> > > at
> > >
> > org.apache.cayenne.configuration.CayenneRuntime.newContext(CayenneRuntime.java:124)
> > > at br.com.saudeplus.model.client.Main.main(Main.java:25)
> > > Caused by: java.rmi.RemoteException: unknown code for readObject at 0x3c
> > > (<); nested exception is:
> > > com.caucho.hessian.io.HessianProtocolException: unknown code for
> > readObject
> > > at 0x3c (<)
> > > at
> > >
> > org.apache.cayenne.rop.ProxyRemoteService.establishSession(ProxyRemoteService.java:46)
> > > at
> > >
> > org.apache.cayenne.rop.HttpClientConnection.connect(HttpClientConnection.java:93)
> > > ... 17 more
> > > Caused by: com.caucho.hessian.io.HessianProtocolException: unknown code
> > for
> > > readObject at 0x3c (<)
> > > at com.caucho.hessian.io.HessianInput.error(HessianInput.java:1697)
> > > at com.caucho.hessian.io.HessianInput.readObject(HessianInput.java:1177)
> > > at
> > >
> > org.apache.cayenne.rop.HessianROPSerializationService.deserialize(HessianROPSerializationService.java:67)
> > > at
> > >
> > org.apache.cayenne.rop.ProxyRemoteService.establishSession(ProxyRemoteService.java:44)
> > > ... 18 more
> > >
> > >
> > > --
> > > Att, Dayvyd
> > >
> > >
> > > <
> > http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail
> > >
> > > Livre
> > > de vírus. www.avg.com
> > > <
> > http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail
> > >.
> > > <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
> >
> >



-- 
Best regards,
Nikita Timofeev

Reply via email to