B4J Question [ABMaterial] Update to 4.0 problem

MichalK73

Well-Known Member
Licensed User
Longtime User
Everything went away according to instructions, but still the application does not start. I do not know where to find fault.
B4X:
Waiting for debugger to connect...
Program started.
init sqlite
Start B4J Analyse!
When an error occurs, check the B4JAnalyse.log file in the Objects folder to see the last B4J line it was working on.
Collecting data from B4J source files... (1/2)
ABMShared.bas
DBM.bas
firebasemessage.bas
ABMCacheControl.bas
ABMCacheScavenger.bas
ABMRootFilter.bas
ABMUploadHandler.bas
moblogin.bas
register.bas
ABMApplication.bas
ABMPageTemplate.bas
ABMPageTemplateAlternative.bas
editoperator.bas
historia.bas
historia2.bas
historia5.bas
home.bas
login.bas
message.bas
operator.bas
szczegoly.bas
user.bas
userview.bas
view.bas
pager.b4j
Analysing data from B4J source files... (2/2)
loading C:\b4x\fastlink\PAGERN~1\Objects: copymewithjar.needs...
Using cache system: 3.0
Needs material/awesome icons
Building core.min.1510053986594.css...
2017-11-07 12:26:30.618:INFO::main: Logging initialized @4697ms to org.eclipse.jetty.util.log.StdErrLog
Error occurred on line: 167
java.lang.ClassNotFoundException: com.ab.template.abmerrorhandler
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:264)
    at anywheresoftware.b4j.object.ServerWrapper.Start(ServerWrapper.java:156)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at anywheresoftware.b4a.shell.Shell.runVoidMethod(Shell.java:657)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:234)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:159)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:90)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:93)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:77)
    at com.ab.template.main.main(main.java:29)
Program terminated (StartMessageLoop was not called).
 

alwaysbusy

Expert
Licensed User
Longtime User
I think you forgot to add the ABMErrorHandler class (or you could comment the following lines in StartServer and StartServerHTTP2 if you do not want to use it):

B4X:
srvr.SetCustomErrorPages(CreateMap("org.eclipse.jetty.server.error_page.global": "/" & ABMShared.AppName & "/error")) ' OPTIONAL
srvr.AddHandler("/" & ABMShared.AppName & "/error", "ABMErrorHandler", False) ' OPTIONAL
 
Upvote 0

MichalK73

Well-Known Member
Licensed User
Longtime User
I remove addhandler in Main
B4X:
    'handler
    'srvr.AddHandler("/register", "register", True)
    'srvr.AddHandler("/login", "moblogin", True)

Still the same fault.
 
Upvote 0

alwaysbusy

Expert
Licensed User
Longtime User
You have to remove these two lines (they are exactly this, not your own handlers). There is a comment ' OPTIONAL next to them.

B4X:
srvr.SetCustomErrorPages(CreateMap("org.eclipse.jetty.server.error_page.global": "/" & ABMShared.AppName & "/error")) ' OPTIONAL
srvr.AddHandler("/" & ABMShared.AppName & "/error", "ABMErrorHandler", False) ' OPTIONAL

They are two times in the code, in both the StartServer and StartServerHTTP2 methods.
 
Upvote 0

MichalK73

Well-Known Member
Licensed User
Longtime User
I have created a new project based on Template 4.0. I linked it individually from the old project. Amazingly, it worked and worked.
So I lost the base ABM files from this new (Templates) to the old one. Still the same.
I noticed the difference in the header in the file name_projekt.b4j.
I changed from this new template to old one and the project was compiled without error.
B4X:
Version=5.9
AppType=StandardJava
NumberOfModules=26
Module1=ABMShared
Module2=ABMApplication
Module3=home
Module4=login
Module5=operator
Module6=editoperator
Module7=message
Module8=firebasemessage
Module9=moblogin
Module10=register
Module11=historia
Module12=historia2
Module13=historia5
Module14=szczegoly
Module15=user
Module16=userview
Module17=view
Module18=ABMPageTemplate
Module19=ABMCacheControl
Module20=ABMErrorHandler
Module21=ABMCustomComponentTemplate
Module22=ABMPageTemplateAlternative
Module23=ABMUploadHandler
Module24=ABMCacheScavenger
Module25=DBM
Module26=ABMRootFilter
Build1=Default,com.ab.template
NumberOfFiles=0
NumberOfLibraries=8
Library1=jcore
Library2=jserver
Library3=abmaterial
Library4=javaobject
Library5=jsql
Library6=jokhttputils2
Library7=okhttp
Library8=json
@EndOfDesignText@

I've had so many changes since I did not know where this was.
I will move the next project from 3.75 to 4 I hope I will be more mature.
 
Upvote 0

MichalK73

Well-Known Member
Licensed User
Longtime User
this one should work, as it has the ABMErrorHandler class. It is there that the jetty library failed as it did not have this class.

B4X:
Module20=ABMErrorHandler

So this is the good version on which it works. I did not copy the old content from the old project. But there was a difference, so I changed. Maybe there was a problem there was not there.

I find old version:
B4X:
Version=5.9
AppType=StandardJava
NumberOfModules=25
Module1=ABMApplication
Module2=ABMShared
Module3=ABMPageTemplate
Module4=DBM
Module5=historia
Module6=ustawienia
Module7=editoperator
Module8=login
Module9=ABMUploadHandler
Module10=message
Module11=ABMCacheControl
Module12=operator
Module13=user
Module14=home
Module15=view
Module16=userview
Module17=historia2
Module18=szczegoly
Module19=firebasemessage
Module20=historia5
Module21=moblogin
Module22=register
Module23=ABMCacheScavenger
Module24=ABMPageTemplateAlternative
Module25=ABMRootFilter
Build1=Default,com.ab.template
NumberOfFiles=0
NumberOfLibraries=8
Library1=jcore
Library2=jserver
Library3=abmaterial
Library4=javaobject
Library5=jsql
Library6=json
Library7=jokhttputils2_nonui
Library8=okhttp
@EndOfDesignText@

And there is no such module.
 
Upvote 0
Top